Skip to content

fix(ci): grant actions: read in the Scorecard reusable, and correct its contract comment - #788

Merged
hyperpolymath merged 3 commits into
mainfrom
fix/scorecard-reusable-actions-read
Sep 15, 2026
Merged

hyperpolymath merged 3 commits into
mainfrom
fix/scorecard-reusable-actions-read

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Two defects, one root cause

1. The reusable's own job block omitted actions: read

jobs.scorecard.permissions listed contents, security-events, id-token — not actions.

A called workflow's job-level permissions narrow the token exactly as a caller's do. So even
a caller that correctly granted actions: read ended up with actions: none inside this job.
Scorecard's Packaging check calls Actions.ListWorkflowRunsByFileName and errors without it.

This means the caller-side repairs alone would not have been sufficient.

2. The header comment stated an incomplete contract

Callers must grant contents: read, security-events: write and id-token: write.

actions: read was missing. That comment is the contract consumers copy from, so the omission
propagated outward. Audited 2026-09-14: 11 of 13 scorecard.yml callers in the estate lack
actions: read
— including the repo whose file was used as the canonical model for the repair
family, where it is already on main.

The comment now also records why the declarations in this file cannot rescue a caller: a
job-level permissions: block replaces the workflow-level one rather than merging with it.

Caller-side repairs

13 PRs in flight separately (ambientops#345, aerie#78, branch-newspaper#88, ffmpeg-ffi#46,
formatrix-docs#55, nesy-solver#66, palimpsest-license#151, panll#120, road-skate#32,
snifs#98, bofig#187, Cliometrics.jl#57; gv-clade-index#78 already correct).

Original catch: CodeRabbit, on palimpsest-license#151. Verified independently against per-job
permission semantics and audited across all 13 callers before acting.

Verification

  • yq: jobs.scorecard.permissions = actions, contents, security-events, id-token
  • actionlint clean
  • commit signed, %G? = G
  • no step, pin or trigger changed

🤖 Generated with Claude Code

https://claude.ai/code/session_0178nN4Nm3neFRy5K9StZKnB

…ts contract comment

Two related defects, one root cause.

1. THE REUSABLE'S OWN JOB BLOCK omitted `actions: read`. A called workflow's
   job-level permissions narrow the token just as a caller's do, so even a
   caller that grants `actions: read` ended up with `actions: none` here.
   Scorecard's Packaging check calls Actions.ListWorkflowRunsByFileName and
   errors without it.

2. THE HEADER COMMENT named only three permissions callers must grant, omitting
   `actions: read`. That comment is the contract consumers copy from, so the
   omission propagated: audited across the estate on 2026-09-14, 11 of 13
   scorecard.yml callers lack `actions: read` — including the repo whose file
   was used as the canonical model.

The comment now also states why the declarations here cannot rescue a caller:
a job-level `permissions:` block REPLACES the workflow-level one rather than
merging with it.

Caller-side repairs are in flight separately (13 PRs).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0178nN4Nm3neFRy5K9StZKnB
@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 231099f4-6771-4766-9d0a-c1daf6c15b14

📥 Commits

Reviewing files that changed from the base of the PR and between 2ef9772 and 87f7e1f.

📒 Files selected for processing (1)
  • .github/workflows/scorecard-reusable.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hyperpolymath
hyperpolymath merged commit a423e48 into main Sep 15, 2026
3 of 4 checks passed
@hyperpolymath
hyperpolymath deleted the fix/scorecard-reusable-actions-read branch September 15, 2026 17:47
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant