-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: special-case workflow_call in excessive-permissions (#473)
- Loading branch information
Showing
14 changed files
with
229 additions
and
28 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -6,6 +6,8 @@ on: | |
pull_request: | ||
branches: ["*"] | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
zizmor: | ||
name: zizmor latest via Cargo | ||
|
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
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,21 @@ | ||
--- | ||
source: tests/snapshot.rs | ||
expression: "zizmor().workflow(workflow_under_test(\"excessive-permissions/issue-472-repro.yml\")).run()?" | ||
snapshot_kind: text | ||
--- | ||
warning[excessive-permissions]: overly broad permissions | ||
--> @@INPUT@@:19:3 | ||
| | ||
19 | / job2: | ||
20 | | # normal permissions finding here, since callers are always | ||
21 | | # responsible for setting permissions, even if the workflow | ||
22 | | # is reusable-only | ||
23 | | uses: ./.github/workflows/fake.yml | ||
| | - | ||
| |_______________________________________| | ||
| this job | ||
| default permissions used due to no permissions: block | ||
| | ||
= note: audit confidence → Medium | ||
|
||
3 findings (2 suppressed): 0 unknown, 0 informational, 0 low, 1 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,19 @@ | ||
--- | ||
source: tests/snapshot.rs | ||
expression: "zizmor().workflow(workflow_under_test(\"excessive-permissions/reusable-workflow-call.yml\")).run()?" | ||
snapshot_kind: text | ||
--- | ||
warning[excessive-permissions]: overly broad permissions | ||
--> @@INPUT@@:7:3 | ||
| | ||
7 | / job1: | ||
8 | | # finding: reusable jobs should always specify their permissions | ||
9 | | uses: ./.github/workflows/zizmor-child.yml | ||
| | - | ||
| |_______________________________________________| | ||
| this job | ||
| default permissions used due to no permissions: block | ||
| | ||
= note: audit confidence → Medium | ||
|
||
2 findings (1 suppressed): 0 unknown, 0 informational, 0 low, 1 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,47 @@ | ||
--- | ||
source: tests/snapshot.rs | ||
expression: "zizmor().workflow(workflow_under_test(\"excessive-permissions/reusable-workflow-other-triggers.yml\")).run()?" | ||
snapshot_kind: text | ||
--- | ||
warning[excessive-permissions]: overly broad permissions | ||
--> @@INPUT@@:1:1 | ||
| | ||
1 | / name: reusable-workflow-other-triggers | ||
2 | | | ||
... | | ||
20 | | # responsible for setting permissions | ||
21 | | uses: ./.github/workflows/fake.yml | ||
| |_______________________________________- default permissions used due to no permissions: block | ||
| | ||
= note: audit confidence → Medium | ||
|
||
warning[excessive-permissions]: overly broad permissions | ||
--> @@INPUT@@:11:3 | ||
| | ||
11 | / job1: | ||
12 | | # regular job-level finding, since we can be triggered by | ||
... | | ||
15 | | steps: | ||
16 | | - run: echo hello | ||
| | - | ||
| |_______________________| | ||
| this job | ||
| default permissions used due to no permissions: block | ||
| | ||
= note: audit confidence → Medium | ||
|
||
warning[excessive-permissions]: overly broad permissions | ||
--> @@INPUT@@:18:3 | ||
| | ||
18 | / job2: | ||
19 | | # normal permissions finding here, since callers are always | ||
20 | | # responsible for setting permissions | ||
21 | | uses: ./.github/workflows/fake.yml | ||
| | - | ||
| |_______________________________________| | ||
| this job | ||
| default permissions used due to no permissions: block | ||
| | ||
= note: audit confidence → Medium | ||
|
||
3 findings: 0 unknown, 0 informational, 0 low, 3 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,23 @@ | ||
# repro case for https://github.com/woodruffw/zizmor/issues/472 | ||
|
||
name: issue-472-repro | ||
|
||
on: | ||
workflow_call: | ||
|
||
# no non-pedantic top-level permissions finding, since | ||
# the workflow is reusable-only | ||
|
||
jobs: | ||
job1: | ||
# no non-pedantic job-level permissions finding, since | ||
# the workflow is reusable-only | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- run: echo hello | ||
|
||
job2: | ||
# normal permissions finding here, since callers are always | ||
# responsible for setting permissions, even if the workflow | ||
# is reusable-only | ||
uses: ./.github/workflows/fake.yml |
9 changes: 9 additions & 0 deletions
9
tests/test-data/excessive-permissions/reusable-workflow-call.yml
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,9 @@ | ||
name: reusable-workflow-call | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
job1: | ||
# finding: reusable jobs should always specify their permissions | ||
uses: ./.github/workflows/zizmor-child.yml |
21 changes: 21 additions & 0 deletions
21
tests/test-data/excessive-permissions/reusable-workflow-other-triggers.yml
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,21 @@ | ||
name: reusable-workflow-other-triggers | ||
|
||
on: | ||
workflow_call: | ||
push: | ||
|
||
# regular top-level finding, since we can be triggered by | ||
# either a workflow call or a push | ||
|
||
jobs: | ||
job1: | ||
# regular job-level finding, since we can be triggered by | ||
# either a workflow call or a push | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- run: echo hello | ||
|
||
job2: | ||
# normal permissions finding here, since callers are always | ||
# responsible for setting permissions | ||
uses: ./.github/workflows/fake.yml |