Repository navigation
Make --bind-data files have permissions 0666 - #265
alexlarsson wants to merge 1 commit into
Conversation
When you use --bind-data or --ro-bind-data the file currently ends up with permission 0600, as this is the mkstemp() default. All other codepaths in bubblewrap creates 0666 files so that other users can read the files, which is more common than top-secret files only readable by the user. We fix this by fchmod()ing to 0666
|
I've wanted the ability to make files executable with the And I have a concern that someone was relying on the permissions being tighter. It's probably unlikely because to have permissions matter you really need multiple uids, which we don't emphasize much with bwrap today. How about something like:
|
|
I like the --perms approach. Would it apply to the next argument only though, or set some default? |
|
I think next arg only. |
|
I'd prefer to have secure defaults, and make the caller open up "wider" permissions if that's what they want.
Do we really want other users (on the host system) to be able to write files?! That seems like a trap: if other users can write a file, then we can't trust the integrity of its contents. |
All of those code paths hopefully respect umask, resulting in permissions more like 06[64][40] depending on the system's security model; but fchmod doesn't apply the mask. I think it's important to distinguish between maximum permissions that will be masked according to the umask, and exact permissions that will be applied as-is.
I'm fairly sure the answer is: no, unless the umask says yes. |
smcv
left a comment
There was a problem hiding this comment.
This isn't safe unless it's either explicitly requested, or takes into account the umask with which bubblewrap was invoked.
It might also be a good idea to set the umask to 077 during startup, and set it back to its original value after we drop privileges - that would go well with the fact that we have to change the umask in order to read it.
Implemented in #406 with the syntax you suggest. I also added
I'd still prefer this, but it would be a behaviour change for |
|
I think #406 is going to be a better route to make this possible. |
When you use --bind-data or --ro-bind-data the file currently ends up with
permission 0600, as this is the mkstemp() default. All other codepaths in
bubblewrap creates 0666 files so that other users can read the files,
which is more common than top-secret files only readable by the user.
We fix this by fchmod()ing to 0666