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

fix(executor): change script file permissions to 0o644 and add test for non-root user creating a script #6905

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,34 @@ func (s *FunctionalSuite) TestDataTransformation() {
})
}

func (s *FunctionalSuite) TestScriptAsNonRoot() {
s.Given().
Workflow(`
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: script-nonroot-
spec:
entrypoint: whalesay
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsNonRoot: true
templates:
- name: whalesay
script:
image: argoproj/argosay:v2
command: ["bash"]
source: |
ls -l /argo/staging
cat /argo/stahing/script
sleep 10s
`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeSucceeded)
}

func TestFunctionalSuite(t *testing.T) {
suite.Run(t, new(FunctionalSuite))
}
2 changes: 1 addition & 1 deletion workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (we *WorkflowExecutor) StageFiles() error {
default:
return nil
}
err := ioutil.WriteFile(filePath, body, 0o600)
err := ioutil.WriteFile(filePath, body, 0o644)
Copy link
Contributor

Choose a reason for hiding this comment

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

We could probably get this fix out to v3.1 and v3.2 soon. @sarabala1979

if err != nil {
return errors.InternalWrapError(err)
}
Expand Down