Skip to content

Commit c0d93db

Browse files
[ci] Integrate zizmor static analysis (#2810)
Integrates the zizmor static analysis tool into the CI pipeline to enforce security best practices for GitHub Actions. - Added a zizmor job to ci.yml with persona: pedantic to enforce strict checking. - Configured the job to fail the build on findings, blocking merges. - Refactored run scripts in all workflows to use environment variables instead of inline interpolation, preventing potential template injection vulnerabilities. - Pinned action versions and tightened permissions across all workflows. - Added concurrency groups to all workflows to manage parallel runs. - Suppressed false positives and necessary write permissions where appropriate. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent aa09c4f commit c0d93db

File tree

8 files changed

+228
-72
lines changed

8 files changed

+228
-72
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
version: 2
1010
updates:
11-
- package-ecosystem: github-actions
11+
- package-ecosystem: github-actions # zizmor: ignore[dependabot-cooldown] (Dependabot cooldown not desired)
1212
directory: /
1313
schedule:
1414
interval: daily

.github/workflows/backport-pr.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ on:
1818
required: true
1919
default: 'main'
2020

21-
permissions: read-all
21+
permissions: {}
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
2226

2327
jobs:
2428
release:
29+
permissions:
30+
contents: write # Need to write to repo to cherry-pick
31+
pull-requests: write # zizmor: ignore[excessive-permissions] (Needed to create pull requests)
2532
runs-on: ubuntu-latest
2633
name: Backport PR
2734
steps:
@@ -35,16 +42,18 @@ jobs:
3542
fetch-depth: 0
3643
persist-credentials: false
3744
- name: Cherry-pick commit
45+
env:
46+
COMMIT: ${{ github.event.inputs.commit }}
3847
run: |
3948
set -eo pipefail
4049
41-
AUTHOR_NAME="$(git log -1 --pretty='%an' ${{ github.event.inputs.commit }})"
42-
AUTHOR_EMAIL="$(git log -1 --pretty='%ae' ${{ github.event.inputs.commit }})"
50+
AUTHOR_NAME="$(git log -1 --pretty='%an' "$COMMIT")"
51+
AUTHOR_EMAIL="$(git log -1 --pretty='%ae' "$COMMIT")"
4352
4453
git config --global user.name "$AUTHOR_NAME"
4554
git config --global user.email "$AUTHOR_EMAIL"
4655
47-
git cherry-pick ${{ github.event.inputs.commit }}
56+
git cherry-pick "$COMMIT"
4857
4958
PR_TITLE="$(git log -1 --pretty=%s)"
5059
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV

0 commit comments

Comments
 (0)