I think this is a great idea - especially as on some boards like the Original or ESP8266 it's now getting to be a squeeze to fit everything in.
To work around the security issues I believe you can either use a chroot to stop access to any sensitive files, or could spin up a Docker container (which I think is more or less the same thing, but maybe a bit more heavyweight?). For http://www.espruino.com/InlineC I disabled the preprocessor, but that's not really sensible for entire C files.
I do wonder how many people would actually supply their own C code? It would be really hard to write new code by repeatedly uploading source code and checking for compile errors - so I guess for development it makes a lot more sense to build locally?
I imagine it might be more use if there was a registry of pre-tested C code that could be compiled into Espruino? I guess if we had a separate GitHub repo for that we could at least sanity check PRs before merging them - although I really haven't seen much interest in it. If I was getting lots of contributions for new Espruino C libraries it might be different, but the only one I can remember was you wanting to add support for the P3 matrices to ESP32.
Maybe in a way it's more useful to have the other features working than it is to allow custom C files and then have to worry about all the security implications?
© Espruino, powered by microcosm.
Report a problem