Skip to content

Commit d7f87d7

Browse files
committed
ci: fix zizmor findings in release workflow
Scope the GitHub App token to contents:write only, instead of inheriting all installation permissions (github-app finding). Set persist-credentials: false on checkout so the token is not left in .git/config for the rest of the job (artipacked finding). Re-inject the token via the remote URL right before git push, keeping push functional without persisting credentials on disk. Assisted-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 844be71 commit d7f87d7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎.github/workflows/release.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ jobs:
5454
with:
5555
client-id: ${{ secrets.APP_ID }}
5656
private-key: ${{ secrets.APP_PRIVATE_KEY }}
57+
permission-contents: write
5758

5859
- name: Checkout
5960
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6061
with:
6162
fetch-depth: 0
63+
persist-credentials: false
6264
token: ${{ steps.app-token.outputs.token }}
6365

6466
- name: Import GPG key
@@ -84,12 +86,14 @@ jobs:
8486
- name: Create and push tag
8587
env:
8688
TAG: ${{ steps.version.outputs.tag }}
89+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
8790
run: |
8891
if git rev-parse "${TAG}" >/dev/null 2>&1; then
8992
echo "::error::Tag ${TAG} already exists"
9093
exit 1
9194
fi
9295
git tag -s -m "Release ${TAG}" "${TAG}"
96+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
9397
git push origin "${TAG}"
9498
9599
- name: Create release branch

0 commit comments

Comments
 (0)