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

Remember input file permissions for when using --output-files. #625

Open
GrahamDumpleton opened this issue Mar 11, 2022 · 7 comments
Open
Labels
enhancement This issue is a feature request priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. surprising to users

Comments

@GrahamDumpleton
Copy link

GrahamDumpleton commented Mar 11, 2022

Describe the problem/challenge you have

When you use --output-files, files are always generated with user permissions of rwx------ and the original user permissions are not used. Further, output files have no group/other permissions at all.

This can cause problems due to execute bits being added to files.

Describe the solution you'd like

Remember the user permissions for input files, and when written to disk as separate files when --output-files is used, keep the same user permissions.

It is arguable that the group/other permissions should also be remembered and used as well. Alternatively, at least copy user permissions to group/other, with what permissions persist for those being dependent on users umask.

At the same time directories should always be created with 0777 and allow the active umask to then modify this to remove group/other write bit for example.

Anything else you would like to add:

Nope.


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@GrahamDumpleton GrahamDumpleton added carvel triage This issue has not yet been triaged for relevance enhancement This issue is a feature request labels Mar 11, 2022
@pivotaljohn pivotaljohn added surprising to users and removed carvel triage This issue has not yet been triaged for relevance labels Mar 21, 2022
@pivotaljohn
Copy link
Contributor

(triaged w/ @cari-lynn and @vmunishwar)

This issue was also discussed in #302 and carvel-dev/imgpkg#93.
What's different here is that in this situation, there are a variety of file permissions, all of which are intentionally set and likely having an affect on whether downstream use is successful or not.
For those who are using ytt in the context described in this issue, this behavior is surprising. 👍🏻

As noted in those referenced issues, ytt resets permissions as part of a secure-by-default stance. We expect ytt to be used heavily in automation (containers running in CI or a cluster) which pulls on files sourced from a source code repository wherein the permissions are not necessarily set with information hiding in mind. Such circumstances are (currently) the primary conditions under which ytt is used.

To enable this sort of use-case, we propose adding a flag to the tool specifically to preserve permissions (e.g. --output-files-preserve-permissions).

At this time, the maintainers cannot commit to a timeline for said feature. However, we would make space to support a contribution.

@pivotaljohn pivotaljohn added the priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. label Mar 21, 2022
@GrahamDumpleton
Copy link
Author

Is --output-files-preserve-permissions intended to be applied on imgpkg push. So the OCI image would contain the full permissions, vs, the idea I proposed of at least unpacking permissions akin to what git does.

@pivotaljohn
Copy link
Contributor

The proposed flag is for ytt. We mentioned the corresponding imgpkg GitHub issue for context rather than definition.

Was thinking that we'd preserve the owner's permission bits very much like how imgpkg is — as of v0.7.0 — is doing.

Would this be sufficient for this use-case, @GrahamDumpleton?

@GrahamDumpleton
Copy link
Author

Ahhh, getting things mixed up my head again. :-)

As to what you are suggesting, seems I still need to fix up group/other permissions since it is the loss of them which is also part of the issue for me.

@pivotaljohn
Copy link
Contributor

seems I still need to fix up group/other permissions since it is the loss of them which is also part of the issue for me.

Can you elaborate on the difficulty, there? What happens/breaks when you lose the "group" and/or "other" permissions?

@GrahamDumpleton
Copy link
Author

As separately explained with imgpkg there are situations like where using the output as subsequent input to a docker build that can result in failure when group/other permissions are lost. Eg., files copied into a docker image which when run as a container is run as non root, which then fails as non root user can't read the files copied into the image as group/other permissions were thrown away by ytt when generating files with --output-files. Adding execute bits on everything causes problems in things such as setup.d like handling where scripts are executed only if the script is executable. By adding execute bits to everything, that means scripts could be run which weren't intended to be run.

@pivotaljohn
Copy link
Contributor

Well, then. I'm apt to want to preserve all permissions: all nine bits for existing files, umask for new files.

@aaronshurley aaronshurley moved this to To Triage in Carvel Aug 18, 2022
@pivotaljohn pivotaljohn moved this from To Triage to Unprioritized in Carvel Sep 27, 2022
@github-project-automation github-project-automation bot moved this to To Triage in Carvel Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a feature request priority/unprioritized-backlog Higher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome. surprising to users
Projects
Status: To Triage
Development

No branches or pull requests

2 participants