-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: template-injection: filter static envs (#318)
Signed-off-by: William Woodruff <william@yossarian.net>
- Loading branch information
Showing
8 changed files
with
167 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
source: tests/snapshot.rs | ||
expression: "zizmor().workflow(workflow_under_test(\"template-injection/static-env.yml\")).run()?" | ||
snapshot_kind: text | ||
--- | ||
help[template-injection]: code injection via template expansion | ||
--> @@INPUT@@:39:9 | ||
| | ||
39 | - name: step-level-non-static | ||
| --------------------------- help: this step | ||
40 | / run: | | ||
41 | | echo ${{ env.bar }} | ||
| |_____________________________- help: env.bar may expand into attacker-controllable code | ||
| | ||
= note: audit confidence → High | ||
|
||
help[template-injection]: code injection via template expansion | ||
--> @@INPUT@@:46:9 | ||
| | ||
46 | - name: job-level-non-static | ||
| -------------------------- help: this step | ||
47 | / run: | | ||
48 | | echo ${{ env.foo }} | ||
| |_____________________________- help: env.foo may expand into attacker-controllable code | ||
| | ||
= note: audit confidence → High | ||
|
||
help[template-injection]: code injection via template expansion | ||
--> @@INPUT@@:51:9 | ||
| | ||
51 | - name: workflow-level-non-static | ||
| ------------------------------- help: this step | ||
52 | / run: | | ||
53 | | echo ${{ env.quux }} | ||
| |_______________________________- help: env.quux may expand into attacker-controllable code | ||
| | ||
= note: audit confidence → High | ||
|
||
3 findings: 0 unknown, 0 informational, 3 low, 0 medium, 0 high |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: static-env | ||
on: | ||
pull_request: | ||
|
||
env: | ||
foo: foo | ||
bar: ${{ github.event.issue.title }} | ||
baz: baz | ||
quux: ${{ github.event.issue.title }} | ||
|
||
jobs: | ||
static-env-1: | ||
name: static-env | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
foo: ${{ github.event.issue.title }} | ||
bar: bar | ||
|
||
steps: | ||
# OK: foo is static (step-level) | ||
- name: step-level-static | ||
run: | | ||
echo ${{ env.foo }} | ||
env: | ||
foo: foo | ||
|
||
# OK: bar is static (job-level) | ||
- name: job-level-static | ||
run: | | ||
echo ${{ env.bar }} | ||
# OK: baz is static (workflow-level) | ||
- name: workflow-level-static | ||
run: | | ||
echo ${{ env.baz }} | ||
# NOT OK: bar is not static (step-level) | ||
- name: step-level-non-static | ||
run: | | ||
echo ${{ env.bar }} | ||
env: | ||
bar: ${{ github.event.issue.title }} | ||
|
||
# NOT OK: foo is not static (job-level) | ||
- name: job-level-non-static | ||
run: | | ||
echo ${{ env.foo }} | ||
# NOT OK: quux is not static (workflow-level) | ||
- name: workflow-level-non-static | ||
run: | | ||
echo ${{ env.quux }} |