-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add a root scope protection option to increase module security. #22
base: master
Are you sure you want to change the base?
Add a root scope protection option to increase module security. #22
Conversation
Thank you for the contribution! I'm looking at your PR. |
What do you think about using the Also, I think we should release a new major version of this plugin to have the |
I was afraid that keeping the only option However your proposal of a new version is reasonable and shows that you're really concerned by security problems, it sounds good to me ! |
The On the contrary, when the Am I miss something? Also I see another check that could be added. What do you think to control the extension of the file to include?. Should we only accept |
Hello, In this case,
|
I am not sure I have fully understood your previous comment. Let me explain my idea through two examples: First set of options
In this case there are not any restrictions on the paths (as today). The paths below are accepted:
No check done on the extension files as the Second set of options:
In this case only paths under the root dir are accepted:
and the paths above the root dir or referencing another different root dir are not allowed:
As the
From these examples, I still don't see a need to add an additional |
I totally understood your point, I just want to warn you about a case, in which you would provide security, but you are not able to predict where is the first document in the tree of the directories (see my example above). So to mix security with flexibility you should support both of the two options. I propose a deal: next reply from you will definetly close the debate, as you are the one that have the final word 😉. Maybe I will be not fully satisfied with that but I think this is fair to accept your decisions. About the extension restrictions, I have to reconsider my opinion: your last example seems very cool and easy to configure, nice proposal ! |
Could you elaborate your example? I really want to understand before taking any decision and be sure I'm not missing an important use case. |
Hello, To be clear, just start from my use case. Basically my application allows users to clone GIT repositories in the server's directory in order to visualize markdown files, in the form of So it is possible to get this kind organization:
Now suppose a MD file that is filed under The inclusion syntax of First case, with a set of options like: {
root: 'my_application/repositories/a_cloned_repo/md_files/main',
rootScopeProtection: true,
allowedExtensions: ['.md', '.txt']
} I have security but it will not allow to include my template file, as it is above Second case, with a set of options like: {
root: 'my_application/repositories/a_cloned_repo/md_files/main',
rootScopeProtection: false,
allowedExtensions: ['.md', '.txt']
} I cannot provide security, even if I'm sure that no file should be included above So to catch my case, the only way is to support the two options |
Using this awesome module, I was able to leak a system file using the inclusion tag inside a MD file. I consider this as a security breach. However it's not a big deal to offer a security option to user.
I choose to add an option, disabled by default to not change deployed modules at update, but this can be challenged, backward compatibility vs security...