Skip to content

Commit

Permalink
fix(executor): add test for non-root user creating a script (#6905)
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
  • Loading branch information
bobh66 committed Oct 18, 2021
1 parent 79d03a9 commit 73d6010
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,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)
if err != nil {
return errors.InternalWrapError(err)
}
Expand Down

0 comments on commit 73d6010

Please sign in to comment.