Repository navigation
Implement --perms and --chmod - #406
Conversation
cgwalters
left a comment
There was a problem hiding this comment.
OK, I gave this one a superficial review and it LGTM. If you prefer it can be merged as is. Will try to do a deeper pass soon.
|
Changes in today's push:
|
This allows files and directories created programmatically by bubblewrap to be made less permissive (as requested in containers#346) or more permissive (as requested in containers#131 and containers#329). Resolves: containers#131 Resolves: containers#329 Resolves: containers#346 Signed-off-by: Simon McVittie <[email protected]>
which caused by inappropriate permission of /dev/shm bug: containers/bubblewrap#329 bug: https://bugs.gentoo.org/496328 pr: containers/bubblewrap#406
which caused by inappropriate permission of /dev/shm bug: containers/bubblewrap#329 bug: https://bugs.gentoo.org/496328 pr: containers/bubblewrap#406
which caused by inappropriate permission of /dev/shm bug: containers/bubblewrap#329 bug: https://bugs.gentoo.org/496328 pr: containers/bubblewrap#406
| if (next_perms >= 0) | ||
| op->perms = next_perms; | ||
| else | ||
| op->perms = 0666; |
There was a problem hiding this comment.
Previously though, since we weren't calling fchmod() the 0666 permission was modified by umask. Oh I see, but we invoke umask(0) explicitly.
But wait...that means we've been defaulting to making e.g. files world writable by default? That seems...pretty broken? Obviously not related to your PR, and your PR will let us fix it but...ew? May be worth adding something to the docs about this.
There was a problem hiding this comment.
But wait...that means we've been defaulting to making e.g. files world writable by default?
Yes, for at least --file.
That seems...pretty broken?
I personally think so, but it's what we always did. If you want to change the defaults, that would be an incompatible change, but maybe a worthwhile one.
ew?
Agreed. However, note that #265 was going to realign --file with --bind-data by making --bind-data use mode 0666 (which I didn't like).
May be worth adding something to the docs about this
This branch explicitly documents the defaults in the man page. Previously, you could only find this out by reading the source code or experimenting.
There was a problem hiding this comment.
Yep agreed with all that! I should have been clearer there was no problem with your PR, I just found the default surprising.
Based on #405 to avoid conflicts in
test-run.sh, but could be separated if maintainers object to #405 for some reason.Implement --perms and --chmod
This allows files and directories created programmatically by bubblewrap
to be made less permissive (as requested in Need option to set permissions on created files/dir #346) or more permissive
(as requested in --tmpfs with mode=777 #131 and /dev/shm has permissions 755 #329).
Resolves: --tmpfs with mode=777 #131
Resolves: /dev/shm has permissions 755 #329
Resolves: Need option to set permissions on created files/dir #346