Skip to content

fix(scorecard): scope budget-cadence permissions job-level (TokenPermissionsID)#679

Merged
AceHack merged 1 commit intomainfrom
fix/budget-cadence-scorecard-tokenpermissions-2026-04-28
Apr 28, 2026
Merged

fix(scorecard): scope budget-cadence permissions job-level (TokenPermissionsID)#679
AceHack merged 1 commit intomainfrom
fix/budget-cadence-scorecard-tokenpermissions-2026-04-28

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented Apr 28, 2026

Summary

Scorecard TokenPermissionsID alert (#26, high severity) flagged
top-level contents: write on .github/workflows/budget-snapshot-cadence.yml.
This is a Scorecard best-practice violation — top-level should be
read-only, with write scoped narrowly to jobs that need it.

What changes

  • Top-level permissions: block becomes contents: read only
  • Job-level jobs.snapshot.permissions: gets the original set
    (contents:write + pull-requests:write + actions:read)

Functional behavior: identical. Job-level permissions override
top-level (per GitHub Actions docs).
The snapshot job still gets all 3 scopes it needs.

Security posture: tightened. Blast-radius bounded to the snapshot
job rather than the whole workflow.

Why now

PR #661 (B-0073 CodeQL unblock) is gated by code_quality:severity=all
ruleset which requires zero open code-scanning alerts. This alert is
one of two blocking. After this PR + CodeQL/Scorecard re-scan, the
TokenPermissionsID alert should close, unblocking #661.

🤖 Generated with Claude Code

…issionsID)

Scorecard TokenPermissionsID alert (#26, high severity) flagged
top-level 'contents: write' on budget-snapshot-cadence.yml. This is
a Scorecard best-practice violation — top-level should be read-only,
with write scoped narrowly to jobs that need it.

Refactor:
- Top-level permissions block: 'contents: read' only
- Job-level (jobs.snapshot.permissions): contents:write +
  pull-requests:write + actions:read (the original set, just moved)

Functional behavior: identical. The snapshot job still gets all 3
write/read scopes it needs.
Security posture: tightened. If any step in this workflow runs
untrusted input, the blast radius is bounded to the snapshot job
rather than the whole workflow.

EVIDENCE-BASED:
- VERIFIED: Scorecard alert message specifies "topLevel 'contents'
  permission set to 'write'" — matches the diagnosis.
- VERIFIED: GitHub Actions job-level permissions override top-level
  per docs (https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token).

Side-effect: should close TokenPermissionsID alert on next CodeQL/
Scorecard scan, which unblocks PR #661 (B-0073 CodeQL unblock —
gated by 'code_quality:severity=all' ruleset that requires zero
open alerts).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 28, 2026 18:46
@AceHack AceHack enabled auto-merge (squash) April 28, 2026 18:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Tightens the GitHub Actions GITHUB_TOKEN permission scope in the budget snapshot cadence workflow to address Scorecard’s TokenPermissionsID finding, while preserving the snapshot job’s ability to push commits and open PRs.

Changes:

  • Reduce workflow top-level permissions to contents: read.
  • Move the previously-required write scopes to jobs.snapshot.permissions (contents/pull-requests write + actions read).

@AceHack AceHack merged commit 2ce1abb into main Apr 28, 2026
28 checks passed
@AceHack AceHack deleted the fix/budget-cadence-scorecard-tokenpermissions-2026-04-28 branch April 28, 2026 18:50
AceHack added a commit that referenced this pull request Apr 28, 2026
Captures the 11-PR landing arc since PR #674's 17:47Z row:

PRs MERGED this arc:
- #675 pull-queue scope-broadening + recurrence
- #676 Elisabeth→Elizabeth in-prose
- #677 5 pre-flight disciplines for destructive git ops
- #678 Elizabeth §33 carve-out + verbatim-quote meta-marker
- #679 Scorecard TokenPermissions job-level scoping
- #680 Atari B-0083 + CodeQL B-0084 + 3 trajectory memories
- #681 version-currency-inherits-pins (clean-extracted from #656)

Plus PR #656 closed-as-superseded by #681 with 5-disciplines audit.

Aaron substrate-input arc captured verbatim:
- Elizabeth canonical-spelling correction
- Atari ROM canonical-naming ask
- TOSEC/Good-Tools dependency-first framing
- 'build-our-own as last resort' end-goal sharpening
- 'did you fix what it was complaining about?' speculation-catch
- 'do the right long term thing' corrective
- self-healing metrics affirmation
- elisabeth-causes-confusion §33 carve-out

Multiple self-correction cascades caught + documented:
- Python-heredoc replace failing on backtick-rich content
- Block-quoted-verbatim guard missing multi-line quotes
- Single-category SARIF snippet vs live per-language matrix
- Self-referential rule containing the word it removes

Composes with: 5-disciplines memory, self-healing-metrics memory,
emit-empty-security-result memory, absorb-and-contribute end-goal
sharpening, Elizabeth §33 carve-out, version-currency-inherits-pins.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants