Skip to content

Commit

Permalink
Merge pull request #48 from snyk/fix/no-sudo-for-snyk-test
Browse files Browse the repository at this point in the history
fix: only use sudo for installing snyk and snyk-to-html
  • Loading branch information
maxjeffos authored Apr 23, 2020
2 parents 9cf0e4f + 5e7a500 commit 01562a0
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -47,19 +48,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --docker myImage --file=Dockerfile --someAdditionalArgs --json": {
"/usr/bin/snyk test --docker myImage --file=Dockerfile --someAdditionalArgs --json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --docker myImage --file=Dockerfile --org=some-snyk-org --project-name=some-projectName --someAdditionalArgs": {
"/usr/bin/snyk monitor --docker myImage --file=Dockerfile --org=some-snyk-org --project-name=some-projectName --someAdditionalArgs": {
code: 0,
stdout: "No issues found"
}
Expand Down
13 changes: 5 additions & 8 deletions snykTask/src/__tests__/_test-mock-config-basic-smoke-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -45,19 +46,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --someAdditionalArgs --json": {
"/usr/bin/snyk test --someAdditionalArgs --json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org --project-name=some-projectName --someAdditionalArgs": {
"/usr/bin/snyk monitor --org=some-snyk-org --project-name=some-projectName --someAdditionalArgs": {
code: 0,
stdout: "No issues found"
}
Expand Down
13 changes: 5 additions & 8 deletions snykTask/src/__tests__/_test-mock-config-monitorOnBuild-false.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -45,19 +46,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org": {
"/usr/bin/snyk monitor --org=some-snyk-org": {
code: 0,
stdout: "No issues found"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -43,19 +44,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 1,
stdout: "Issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --project-name=someProjectName": {
"/usr/bin/snyk monitor --project-name=someProjectName": {
code: 0,
stdout: "No issues found"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -43,19 +44,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 1,
stdout: "Issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor": {
"/usr/bin/snyk monitor": {
code: 0,
stdout: "No issues found"
}
Expand Down
13 changes: 7 additions & 6 deletions snykTask/src/__tests__/_test-mock-config-no-organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -39,23 +40,23 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Ok"
},
"/usr/bin/snyk auth some-authToken": {
"/usr/bin/auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
"/usr/bin/snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor": {
"/usr/bin/snyk monitor": {
code: 0,
stdout: "No issues found"
}
Expand Down
13 changes: 5 additions & 8 deletions snykTask/src/__tests__/_test-mock-config-no-projectName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -46,19 +47,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org": {
"/usr/bin/snyk monitor --org=some-snyk-org": {
code: 0,
stdout: "No issues found"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -46,19 +47,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 1,
stdout: "Issues found"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org": {
"/usr/bin/snyk monitor --org=some-snyk-org": {
code: 0,
stdout: "Ok"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -45,19 +46,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 0,
stdout: "Ok"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org --project-name=someProjectName": {
"/usr/bin/snyk monitor --org=some-snyk-org --project-name=someProjectName": {
code: 3,
stdout: ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -45,19 +46,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 0,
stdout: "Ok"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org --project-name=someProjectName": {
"/usr/bin/snyk monitor --org=some-snyk-org --project-name=someProjectName": {
code: 2,
stdout: ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const answers: ma.TaskLibAnswers = {
ls: "/bin/ls",
npm: "/usr/bin/npm",
snyk: "/usr/bin/snyk",
sudo: "/usr/bin/sudo"
sudo: "/usr/bin/sudo",
"snyk-to-html": "/usr/bin/snyk-to-html"
},
exec: {
"/bin/ls -la": {
Expand All @@ -45,19 +46,15 @@ const answers: ma.TaskLibAnswers = {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk auth some-authToken": {
code: 0,
stdout: "Snyk CLI authorized!"
},
"/usr/bin/sudo snyk test --json": {
"/usr/bin/snyk test --json": {
code: 2,
stdout: "Ok"
},
"/usr/bin/sudo snyk-to-html -i null/report.json": {
"/usr/bin/snyk-to-html -i null/report.json": {
code: 0,
stdout: "No issues found"
},
"/usr/bin/sudo snyk monitor --org=some-snyk-org": {
"/usr/bin/snyk monitor --org=some-snyk-org": {
code: 0,
stdout: "Ok"
}
Expand Down
Loading

0 comments on commit 01562a0

Please sign in to comment.