-
Notifications
You must be signed in to change notification settings - Fork 34
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
Allow bind mounts prefixed with /mnt/ for ephemeral storage #320
Allow bind mounts prefixed with /mnt/ for ephemeral storage #320
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 picking this up!
@@ -114,10 +114,13 @@ pub fn bind(variant: &str, dirs: Vec<String>) -> Result<()> { | |||
|
|||
let mount_point = format!("/mnt/{}", EPHEMERAL_MNT); | |||
let mount_point = Path::new(&mount_point); | |||
let allowed_dirs = allowed_bind_dirs(variant); | |||
let (allowed_exact, allowed_prefixes) = allowed_bind_dirs(variant); |
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.
Two concerns:
- We should disallow paths starting with
/mnt/.ephemeral
(the value inmount_point
) since that directory and its subdirectories are used for keeping state and siloing content of the different mount points. - We should reject any paths that contain
..
as that could traverse outside/mnt
or over-mount other paths within it.
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.
@bcressey thanks for the feedback, I have added checks for presence of .. and /mnt/.ephemeral in the next commit.
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.
af1b7ec
to
2d5c361
Compare
@yeazelm Let me know if I should make any more changes to this PR. I marked it as draft initially but I'm happy with it being merged as is if the PR code is acceptable. |
Hey @zaheer-merali, I just saw this was out for testing, sorry for the delay! I'll test it out now and come back as soon as I'm done. |
I was able to validate this works (mostly) like we expect. I can now pass a directory in For a basic test:
And the directory exists
If I try to put something in
Output
I also tried to sneak in under a path and that is blocked:
With it being marked essential, we should be failing but this behavior is happening with the current code so we can track that problem separately. |
f976003
to
8e0e4b7
Compare
The changes look good, can we get the commits squashed again into one? |
a6acee5
to
8a6aee2
Compare
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.
LGTM! Thanks for the contribution!
8a6aee2
to
8e028ee
Compare
@yeazelm it missed the struct having to be made public to allow the struct to be exposed to mod.rs. So I resquashed the 4 character change. |
I caught the same thing when testing the build and you beat me to it! Nice catch!z |
Issue number:
Closes #
Description of changes:
Testing done:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.