-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable using 'require' command from within 'config.ld' #308
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to contribute!
I think this makes sense for some use cases, but would you be able to add documentation for it? It seems like this project should probably document all it's options ;-)
Doesn't this also largely defeat the purpose of having the config file sanboxed off so tightly? This should be made optional in some way that the person executing it has to explicitly allow this action. |
Is this minor change not a huge security hole ?!
IMHU allowing Regards, |
@tst2005 As I commented above, yes this does defeat the purpose. What I didn't realize before is that the list of allowed commands wasn't just a whitelist allowing some things through from the Lua VM, it is a complete sandbox with all available commands re-implemented. That does change my view of how this should be handled a bit. Note that we're not just talking about the config file here, were talking about the code in templates as well which has the same sandboxing. I still thing the feature makes sense to have, but doing it just for this one command and not for all commands is silly and would be easy for people to blow off the security ramifications. Even if in their mind they are just using it for an Rather than this PR as implemented, for the use cases where this really does make sense I think we could accept a kind of |
Sorry for the delay. I just want to say we (AwesomeWM) also want to have an option to disable the sandbox. I had to implement really nasty hacks to poke a hole and get rid of it by abusing a reference to penlight accessible from the template, then reverse-forward it back to config.ld. I needed to add code to https://awesomewm.org/apidoc/core_components/client.html The resulting code is horrifying: https://github.com/awesomeWM/awesome/blob/master/docs/config.ld . Having no sandbox, being able to use penlight and having a proper/official way to access the AST would allow me to cleanup this mess. I would also like to further go down that rabbit hole and have custom post-processor on the AST to be able to:
|
About LDOC the need I see is to load or enable one or more feature (for now the only one i see is Why not create a Sample: Inside return require "string.split" Inside config.ld: local split = feature("string.split") By this way anyone can expose any lua module but not all of them. |
I'm AFK right now, but thanks for the input. Can someone open an issue to track adding a way to surface modules and/or completely disable the sandbox. Re-opening this PR doesn't seem like the right move but this does need to be followed up on. |
Done. I split into 5 smaller issues required to implement a proper module system to extend Not much as to actually be done to support modules. Most of the work needed is to undo things like the sandbox and document some pseudo-private-but-used-by-the-template-so-they-are-in-fact-public APIs. |
Adds
ldoc.require
to be used inconfig.ld
:See #304.