-
Notifications
You must be signed in to change notification settings - Fork 64
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
campaigns: widen permissions on mounted paths #366
Conversation
This fixes #365 by ensuring that files and workspaces mounted into campaign containers are world readable, writable, and executable as appropriate.
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.
Nice 👍
// that the file is globally writable. If the execute bit is normally | ||
// set on the zipped up file, let's ensure we propagate that to the | ||
// group and other permission bits too. | ||
if f.Mode()&0111 != 0 { |
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.
Nice catch
internal/campaigns/run_steps.go
Outdated
@@ -97,6 +97,12 @@ func runSteps(ctx context.Context, wc *WorkspaceCreator, repo *graphql.Repositor | |||
} | |||
defer os.Remove(runScriptFile.Name()) | |||
|
|||
// This file needs to be readable within the container regardless of | |||
// the user the container is running as. | |||
if err := runScriptFile.Chmod(0644); err != nil { |
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.
does it not need to be executable?
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.
Counter intuitively, no! The Docker command basically boils down to this:
docker run --entrypoint /bin/bash -- sha256:CONTAINER_ID /tmp/some-horrible-script-name
Since the shell is the entrypoint, only that needs to be executable, and the script being run is just a regular old command line parameter.
OK, it looks like we have some Windows issues, so please hold while I figure out how much they matter. (My suspicion is: not much, given the different Docker execution model on Windows.) |
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.
Thanks for getting to this so quickly!
|
||
have := mustGetPerm(t, path) | ||
|
||
// Go maps Windows file attributes onto Unix permissions in a fairly trivial |
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.
🤯
Thanks for finding this!
Good stuff! |
This fixes #365 by ensuring that files and workspaces mounted into campaign containers are world readable, writable, and executable as appropriate.
This fixes #365 by ensuring that files and workspaces mounted into campaign containers are world readable, writable, and executable as appropriate.