Repository navigation
Create files as mount points with read-only permissions - #405
Merged
Merged
Conversation
smcv
force-pushed
the
create-mountpoint-ro
branch
2 times, most recently
from
February 16, 2021 12:04
293b18a to
f036772
Compare
Collaborator
Author
|
I'd also be happy with consistently using 0644, 0600 or 0400 if maintainers would prefer those. In the equivalent code paths for directories, we use 0755 whenever we create directories to mount onto. |
If two mount namespaces can both see a directory, and we bind-mount a
non-directory into that directory, we have to create a non-directory
to mount it onto:
$ ls -l ~/tmp/mountpoint
ls: cannot access '/home/smcv/tmp/mountpoint': No such file or directory
$ bwrap --bind / / --bind /etc/os-release ~/tmp/mountpoint true
$ ls -l ~/tmp/mountpoint
-rw-rw-rw- 1 smcv smcv 0 Feb 16 10:27 /home/smcv/tmp/mountpoint
The mount point is currently created as an empty world-writable file,
but this doesn't seem like a least-astonishment thing to do.
Create it with read-only permissions instead, to make it clearer that
it's just a placeholder and prevent other users from filling it.
Resolves: containers#337
Signed-off-by: Simon McVittie <[email protected]>
smcv
force-pushed
the
create-mountpoint-ro
branch
from
April 7, 2021 11:51
f036772 to
411135b
Compare
cgwalters
approved these changes
Apr 16, 2021
cgwalters
left a comment
Collaborator
There was a problem hiding this comment.
Ooh, good catch. World writable is always a terrible idea, almost always a mistake since modern UNIX has ACLs.
(One motivation for SELinux was actually that people can accidentally or deliberately make files world writable/readable, i.e. discretionary access control whereas with a MAC one can actively stop that)
Collaborator
Author
|
@cgwalters If you like this, you'll love #406! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If two mount namespaces can both see a directory, and we bind-mount a
non-directory into that directory, we have to create a non-directory
to mount it onto:
The mount point is currently created as an empty world-writable file,
but this doesn't seem like a least-astonishment thing to do.
Create it with read-only permissions instead, to make it clearer that
it's just a placeholder and prevent other users from filling it.
Resolves: #337