Skip to content

campaigns: widen permissions on mounted paths#366

Merged
LawnGnome merged 4 commits into
mainfrom
aharvey/fix-permissions
Nov 5, 2020
Merged

campaigns: widen permissions on mounted paths#366
LawnGnome merged 4 commits into
mainfrom
aharvey/fix-permissions

Conversation

@LawnGnome

Copy link
Copy Markdown
Contributor

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.
@LawnGnome LawnGnome requested a review from a team November 4, 2020 21:22

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Comment thread internal/campaigns/archive_fetcher.go
// 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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

Comment thread internal/campaigns/run_steps.go Outdated

// 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 {

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

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.

@LawnGnome

Copy link
Copy Markdown
Contributor Author

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.)

@chrispine chrispine left a comment

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯
Thanks for finding this!

@mrnugget

mrnugget commented Nov 5, 2020

Copy link
Copy Markdown
Contributor

Good stuff!

@LawnGnome LawnGnome merged commit 58838e8 into main Nov 5, 2020
@LawnGnome LawnGnome deleted the aharvey/fix-permissions branch November 5, 2020 17:53
scjohns pushed a commit that referenced this pull request Apr 24, 2023
This fixes #365 by ensuring that files and workspaces mounted into
campaign containers are world readable, writable, and executable as
appropriate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

campaigns: create files/directories that might be mounted into the container with global permissions

4 participants