Skip to content
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

umask is inverted #38

Closed
ryantm opened this issue May 5, 2021 · 4 comments · Fixed by #44
Closed

umask is inverted #38

ryantm opened this issue May 5, 2021 · 4 comments · Fixed by #44
Labels

Comments

@ryantm
Copy link
Owner

ryantm commented May 5, 2021

pennae ryantm: since we see you, i think you inverted the umask in agenix by accident
ryantm pennae: Are you talking about

(umask 0400; LANG=${config.i18n.defaultLocale} ${ageBin} --decrypt ${identities} -o "$TMP_FILE" "${secretType.file}")
?
pennae yeah
ryantm pennae: Could you be more specific what you mean about "inverted"?
pennae as it stands it'll clear the owner-read bit and leave all others untouched either we can't brain right now or you probably meant 0177
ryantm pennae: I think you're right; thanks for letting me know. I'll look into fixing it.
pennae also there might be a bug with a root secret "something.tmp" and a non-root secret "something" that'll delete the root secret? not sure about that tho

@ryantm ryantm added the security label May 5, 2021
@asymmetric
Copy link
Contributor

asymmetric commented May 5, 2021

umask supports symbolic arguments, which are IMO more intuitive: umask u=r would be equivalent to umask 0377, IIUC.

@pennae
Copy link

pennae commented May 5, 2021

that's not entirely portable across shells though, eg on bash umask u=r seems to completely recalculate the umask while busybox ash only modifies the current umask with the given modifiers. this could be a problem since the activation script starts out with umask 0022.

@asymmetric
Copy link
Contributor

asymmetric commented May 5, 2021

I’m fine with using numeric values, but we control the shell this script executes with (bash), so portability should not be an issue.

EDIT: or can system.activationScripts be executed with other shells?

@pennae
Copy link

pennae commented May 5, 2021

activation scripts run under pkgs.runtimeShell, which can theoretically be overridden (and we think someone on irc said they do).

that said, umask u=r,g=,o= should be portable across them all

ryantm added a commit that referenced this issue May 13, 2021
@ryantm ryantm mentioned this issue May 13, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants