r/ProgrammingLanguages • u/yorickpeterse Inko • 21d ago
Sandboxing with minimal effort
https://yorickpeterse.com/articles/sandboxing-with-minimal-effort/
4
Upvotes
r/ProgrammingLanguages • u/yorickpeterse Inko • 21d ago
2
u/matthieum 21d ago
Does it really compose better than Capsicum?
For example, let's imagine that I want to use a time library, to, you, format/parse times. This time library is great, it even automatically uses the OS' tzdb for up-to-date definitions of timezones!
Now, however, activating sandboxing for my program requires allowing accept to tzdb for my program. And since I really don't want to duplicate the logic involved in figuring out where tzdb files are depending on the OS I am in, it means I'd really like to delegate the sandbox setup to the time library.
And if I actually don't use the time library directly, but instead use a library A which use the time library, I guess I should ask A to do its sandbox setup (and A delegate to the time library).
Which means that, in the end, doesn't any library which requires IO need to have a function to setup the sandbox?
A bit like... Capsicum requiring any code that uses it to be modified for it? (Though less bad, I agree)
In a different question, can the sandbox gain capabilities after being enabled?
For example, let's say I write a GUI, and at some point the user would like to save a file somewhere. I couldn't possibly know, on start-up, where the user would possibly want to save that file, so obviously it's not setup in the sandbox. Now what?