Skip to content

Commit 48bab37

Browse files
rjaegersCopilot
andauthored
ci: fix zizmor findings (#967)
* ci: replace marocchino/sticky-pull-request-comment by gh cli * ci: update comments * ci: remove social-interaction workflow Rely on the content in the README, CONTRIBUTING and GitHubs native functionality surrounding that documentation to help first-time contributers. * Update .github/workflows/pr-conventional-title.yml Co-authored-by: Copilot <[email protected]> Signed-off-by: Ron <[email protected]> * chore: fix issues identified in workflow * ci: refactor to re-usable workflow * chore: process more review feedback * style: add yaml start token * chore: apply review comments * chore: add checkout action * chore: restore after failed experiment * chore: remove more fall-out * ci: least privilege and add documentation * ci: fix out of date version comment * ci: fix more zizmor findings * chore: fix more zizmor findings * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> Signed-off-by: Ron <[email protected]> * ci: add cooldown to dependabot * ci: document permissions * chore: fix more findings * chore: document all permissions * chore: fix template injection possibility --------- Signed-off-by: Ron <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 610993d commit 48bab37

20 files changed

+80
-108
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ version: 2
33

44
updates:
55
- package-ecosystem: github-actions
6+
cooldown:
7+
default-days: 7
68
directory: /
79
schedule:
810
interval: weekly
@@ -14,16 +16,22 @@ updates:
1416
commit-message:
1517
prefix: "ci(deps)"
1618
- package-ecosystem: docker
19+
cooldown:
20+
default-days: 7
1721
directories:
1822
- .devcontainer/cpp
1923
- .devcontainer/rust
2024
schedule:
2125
interval: weekly
2226
- package-ecosystem: devcontainers
27+
cooldown:
28+
default-days: 7
2329
directory: /
2430
schedule:
2531
interval: weekly
2632
- package-ecosystem: npm
33+
cooldown:
34+
default-days: 7
2735
directory: /
2836
schedule:
2937
interval: weekly
@@ -35,6 +43,8 @@ updates:
3543
commit-message:
3644
prefix: "test(deps)"
3745
- package-ecosystem: pip
46+
cooldown:
47+
default-days: 7
3848
directory: .devcontainer
3949
schedule:
4050
interval: weekly

.github/workflows/continuous-integration.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ jobs:
2525
TEST_GITHUB_PASSWORD: ${{ secrets.TEST_GITHUB_PASSWORD }}
2626
TEST_GITHUB_TOTP_SECRET: ${{ secrets.TEST_GITHUB_TOTP_SECRET }}
2727
permissions:
28-
actions: read
29-
attestations: write
30-
checks: write
31-
contents: write
32-
id-token: write
33-
packages: write
34-
pull-requests: write
28+
actions: read # is needed by anchore/sbom-action to find workflow artifacts when attaching release assets
29+
attestations: write # is needed by actions/attest-build-provenance to push attestations
30+
contents: write # is needed by anchore/sbom-action for artifact uploads
31+
id-token: write # is needed by actions/attest-build-provenance to obtain an OIDC token
32+
packages: write # is needed to push image manifest when using GitHub Container Registry
33+
pull-requests: write # is needed by marocchino/sticky-pull-request-comment to post comments
3534
with:
3635
devcontainer-metadata-file: .devcontainer/${{ matrix.flavor }}/devcontainer-metadata.json
3736
dockerfile: .devcontainer/${{ matrix.flavor }}/Dockerfile
@@ -46,14 +45,14 @@ jobs:
4645
uses: ./.github/workflows/wc-dependency-review.yml
4746
permissions:
4847
contents: read
49-
pull-requests: write
48+
pull-requests: write # is needed by actions/dependency-review-action to write PR summaries
5049

5150
publish-test-results:
5251
name: 📊 Publish Test Results
5352
runs-on: ubuntu-latest
5453
permissions:
55-
checks: write
56-
pull-requests: write
54+
checks: write # is needed by EnricoMi/publish-unit-test-result-action to add a check run with test results
55+
pull-requests: write # is needed by EnricoMi/publish-unit-test-result-action to annotate PRs
5756
needs: build-push-test
5857
if: ${{ !cancelled() }}
5958
steps:

.github/workflows/image-cleanup.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
name: 🧹 Clean Images
1414
runs-on: ubuntu-latest
1515
permissions:
16-
# dataaxiom/ghcr-cleanup-action needs packages write permission
17-
# to delete untagged and orphaned images
18-
packages: write
16+
packages: write # is needed by dataaxiom/ghcr-cleanup-action to delete untagged and orphaned images
1917
steps:
2018
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
2119
with:

.github/workflows/issue-cleanup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
name: ♻️ Close Stale Issues & PRs
1313
runs-on: ubuntu-latest
1414
permissions:
15-
issues: write
16-
pull-requests: write
15+
issues: write # is needed by actions/stale to close/comment on issues
16+
pull-requests: write # is needed by actions/stale to close/comment on PRs
1717
steps:
1818
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
1919
with:

.github/workflows/issue-creation-tool-versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Create tool version evaluation issue
1414
runs-on: ubuntu-latest
1515
permissions:
16-
issues: write
16+
issues: write # is needed by gh cli to create/close/pin/unpin issues
1717
steps:
1818
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
1919
with:

.github/workflows/linting-formatting.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@ concurrency:
1414
group: ${{ github.ref }}-${{ github.workflow }}
1515
cancel-in-progress: true
1616

17-
permissions:
18-
contents: read
17+
permissions: {}
1918

2019
jobs:
2120
linter:
2221
name: 🧹 Lint & Format
2322
runs-on: ubuntu-latest
2423
permissions:
2524
contents: read
26-
actions: read
27-
pull-requests: write
28-
security-events: write
25+
actions: read # is needed by zizmorcore/zizmor-action
26+
pull-requests: write # is needed by oxsecurity/megalinter and reviewdog/action-suggester to post PR comments
27+
security-events: write # is needed by oxsecurity/megalinter for uploading sarif files
2928
steps:
3029
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
3130
with:
@@ -55,6 +54,6 @@ jobs:
5554
name: Linter Report
5655
path: |
5756
megalinter-reports
58-
- uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # v1.19.0
57+
- uses: reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # v1.24.0
5958
with:
6059
tool_name: MegaLinter

.github/workflows/ossf-scorecard.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ on:
99
push:
1010
branches: [main]
1111

12-
permissions: read-all
12+
permissions: {}
1313

1414
jobs:
1515
ossf-scorecard:
1616
name: 🛡️ OpenSSF Scorecard
1717
runs-on: ubuntu-latest
1818
permissions:
19-
security-events: write
20-
id-token: write
19+
contents: read
20+
security-events: write # is needed by github/codeql-action/upload-sarif to upload sarif files
21+
id-token: write # is needed by ossf/scorecard-action to authenticate with OIDC
2122
steps:
2223
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
2324
with:

.github/workflows/pr-conventional-title.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: ✅ Validate PR Title
1616
runs-on: ubuntu-latest
1717
permissions:
18-
pull-requests: write
18+
pull-requests: write # is needed by marocchino/sticky-pull-request-comment to post comments on PRs
1919
steps:
2020
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
2121
with:
@@ -44,9 +44,8 @@ jobs:
4444
:warning: Details
4545
4646
${{ steps.pr-title.outputs.error_message }}
47-
48-
- if: steps.pr-title.outputs.error_message == null
49-
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
47+
- uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
48+
if: steps.pr-title.outputs.error_message == null
5049
with:
5150
header: pr-title-lint-error
5251
delete: true

.github/workflows/pr-image-cleanup.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: 🗑️ Delete PR Images
1313
runs-on: ubuntu-latest
1414
permissions:
15-
packages: write
15+
packages: write # is needed by dataaxiom/ghcr-cleanup-action to delete images
1616
steps:
1717
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
1818
with:
@@ -26,8 +26,7 @@ jobs:
2626
name: 🧹 Cleanup Cache
2727
runs-on: ubuntu-latest
2828
permissions:
29-
# actions: write permission is required to delete the cache
30-
actions: write
29+
actions: write # is needed to delete workflow run caches
3130
steps:
3231
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
3332
with:

.github/workflows/pr-report.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
name: 📊 Add PR Report
1313
permissions:
1414
contents: read
15-
checks: read
16-
pull-requests: write
17-
repository-projects: read
18-
actions: read
15+
checks: read # is needed by philips-software/pull-request-report-action to fetch check run information
16+
pull-requests: write # is needed by philips-software/pull-request-report-action to post the report as a comment on the PR
17+
repository-projects: read # is needed by philips-software/pull-request-report-action to fetch project information
18+
actions: read # is needed by philips-software/pull-request-report-action to fetch workflow run information
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1

0 commit comments

Comments
 (0)