Skip to content

Commit abab4bf

Browse files
committed
ci: tighten Token-Permissions + add SLSA build provenance to releases
Targets three Scorecard checks: Token-Permissions (was 0/10) build.yml gains an explicit 'permissions: contents: read' top-level block. release.yml moves write permissions out of the workflow scope into the only job that needs them, and adds id-token + attestations for the new provenance step. dev-build.yml, codeql.yml, and scorecard.yml were already minimal. Signed-Releases (was 0/10) Adds actions/attest-build-provenance to release.yml. After every Release, a SLSA Build Provenance attestation is generated for the installer, the portable EXE, and SHA256SUMS.txt; signed via Sigstore OIDC and stored in GitHub's public attestation log. Anyone can verify a downloaded binary was built from this exact source commit by this exact workflow with: gh attestation verify GamerGuardian-Setup-x.y.z.exe --owner carterscode Branch-Protection (was -1, internal error) scorecard.yml's analysis step now consumes an optional SCORECARD_TOKEN secret (a fine-grained PAT with metadata:read + administration:read). When set, Scorecard can read branch-protection rules and score them. Falls back to GITHUB_TOKEN when SCORECARD_TOKEN is absent so existing runs don't break before the secret is added.
1 parent 5706d08 commit abab4bf

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
branches: [main]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
build:
912
runs-on: windows-latest

.github/workflows/release.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
default: ''
1717

1818
permissions:
19-
contents: write
19+
contents: read
2020

2121
concurrency:
2222
group: release
@@ -25,6 +25,10 @@ concurrency:
2525
jobs:
2626
release:
2727
runs-on: windows-latest
28+
permissions:
29+
contents: write # create release + tag
30+
id-token: write # mint Sigstore OIDC token for provenance signing
31+
attestations: write # attach SLSA build-provenance attestation
2832
steps:
2933
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3034
with:
@@ -163,6 +167,19 @@ jobs:
163167
name: GamerGuardian-${{ steps.ver.outputs.version }}-portable
164168
path: publish/GamerGuardian.exe
165169

170+
# Generate SLSA Build Provenance attestations for the release artifacts.
171+
# GitHub records these in its public attestation log; Sigstore co-signs
172+
# them via OIDC. Anyone can verify a downloaded binary was built from
173+
# this exact source commit by this exact workflow with:
174+
# gh attestation verify GamerGuardian-Setup-x.y.z.exe --owner carterscode
175+
- name: Attest build provenance
176+
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
177+
with:
178+
subject-path: |
179+
installer/Output/GamerGuardian-Setup-${{ steps.ver.outputs.version }}.exe
180+
publish/GamerGuardian.exe
181+
installer/Output/SHA256SUMS.txt
182+
166183
- name: Create GitHub Release
167184
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
168185
with:

.github/workflows/scorecard.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ jobs:
2929
results_file: results.sarif
3030
results_format: sarif
3131
publish_results: true
32+
# SCORECARD_TOKEN is an optional fine-grained PAT with
33+
# 'metadata: read' + 'administration: read' on this repo. When set,
34+
# the Branch-Protection check can read protection rules and score
35+
# them. Without it, that check returns -1 (internal error) because
36+
# the default GITHUB_TOKEN can't read admin settings.
37+
repo_token: ${{ secrets.SCORECARD_TOKEN || secrets.GITHUB_TOKEN }}
3238

3339
- name: Upload artifact
3440
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

0 commit comments

Comments
 (0)