-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
nixos/gitea: set umask for secret creation #121299
Conversation
@ofborg test gitea |
@@ -477,6 +477,7 @@ in | |||
in '' | |||
# copy custom configuration and generate a random secret key if needed | |||
${optionalString (cfg.useWizard == false) '' | |||
umask 027 |
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.
You don't want to run this in a sub-shell?
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.
AFAIU the only file creation operations only happen within this block, so unless I'm missing something right now, this shouldn't be needed.
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.
That will cause problems though if another file creation has to be added at a later point.
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.
@dotlambda updated.
This ensures that newly created secrets will have the permissions `0640`. With this change it's ensured that no sensitive information will be word-readable at any time. Related to NixOS#121293. Strictly speaking this is a breaking change since each new directory (including data-files) aren't world-readable anymore, but actually these shouldn't be, unless there's a good reason for it.
|
||
# Migrate LFS_JWT_SECRET filename | ||
if [[ -e ${oldLfsJwtSecret} && ! -e ${lfsJwtSecret} ]]; then | ||
mv ${oldLfsJwtSecret} ${lfsJwtSecret} |
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.
This will preserve permissions but I guess that's fine.
Motivation for this change
This ensures that newly created secrets will have the permissions
0640
. With this change it's ensured that no sensitive information willbe word-readable at any time.
Related to #121293.
Strictly speaking this is a breaking change since each new directory
(including data-files) aren't world-readable anymore, but actually these
shouldn't be, unless there's a good reason for it.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)