-
Notifications
You must be signed in to change notification settings - Fork 122
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
Set umask in main? #1521
Comments
Additional input from @morphis:
|
ops itself doesn't do much writing of files. Excluding the testing frameworks, podspec, and os.lib, there's:
Then there's Pebble - it's not spawned by ops, so wouldn't be influenced by ops doing a umask. Remotely, That leaves the charm code, which could obviously include anything. I do agree that a more restrictive default would be better - having people opt into less secure options rather than the other way around. However, it seems likely that this would break things - maybe semi-official tools like jhack and probably some charms that are relying on the current behaviour. For the latter, I'll try running with this change against a bunch of charm unit tests and see what happens. In the meantime, it seems like it would be trivial for charms to opt into this behaviour by just doing the umask call themselves (in the charm's |
Thanks @tonyandrewmeyer! |
No failures over the 115 charms I tried. Unit tests aren't a great check for this - there's a reasonable chance that they're mocking out actual file creation, and/or aren't tying together pieces that separately create and use files, but I still don't have a good way of running a lot of charm integration tests against a branch. When I figure that out, I'll try it out with this too. |
Problem
By default, when charm code
open
s a file for writing without additional args, we get world-readable files (rw-r--r--
).We may want to avoid leaking sensitive files to other services that run next to ours.
One way of doing this is for ops to call e.g.
umask o-rx,g=r
as part ofmain
. This would work for VM charms and the charm container, but not sure what's implemented for pebble-push into a workload container.At first glance, the centralized default umask approach seems easy and harmless.
Additional context
User=
andGroup=
, but not sure if this kind of control is available for snaps and charms.The text was updated successfully, but these errors were encountered: