Skip to content

ci: let Scorecard read branch protection via SCORECARD_TOKEN - #94

Merged
arminazimi merged 2 commits into
mainfrom
chore/45-scorecard-branch-protection
Nov 14, 2026
Merged

arminazimi merged 2 commits into
mainfrom
chore/45-scorecard-branch-protection

Conversation

@arminazimi

@arminazimi arminazimi commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #45

What changed

  • Pass repo_token: ${{ secrets.SCORECARD_TOKEN || github.token }} to both ossf/scorecard-action steps so classic Branch-Protection rules are readable once a maintainer stores a fine-grained PAT (Administration: Read-only).
  • Document the secret, least-privilege scopes, and current main protection facts in SECURITY.md.
  • Assert both Scorecard steps wire repo_token in tests/scorecard-floor.test.ts.

Workflow changes

  • Reason: Scorecard’s default GITHUB_TOKEN cannot read classic branch-protection rules; the official action needs an optional repo_token with Administration: Read-only. The || github.token fallback keeps weekly runs working before the secret exists. scorecard.yml is schedule / workflow_dispatch / branch_protection_rule only, so pull-request runner minutes stay unchanged.
  • Budget effect: none

Quality bar

Read docs/QUALITY.md before you change code, data, or docs. CI enforces its nine criteria: add no new debt, and allowlist existing debt only with an expiry.

Checks CI cannot make

  • Tests added or updated for changed behavior
  • Changelog fragment added in changes/ for user-visible changes (not for docs, test, ci, chore, build, refactor, or style)

Verification

  • Confirmed gap still present on current published Scorecard API result (2026-11-14T11:39:28Z, commit 012e230): Branch-Protection = -1 — reason: some github tokens can't read classic branch protection rules.
  • Branch protection on main (read via API): required status check ci-ok; force pushes off; deletions off; required approving review count 0 (intentional); conversation resolution currently off (SECURITY.md no longer claims it is on).
  • Repository secrets today: SCORECARD_TOKEN is not set yet (only ALERTS_READ_TOKEN). Creating the fine-grained PAT and storing it as SCORECARD_TOKEN remains a maintainer step; this PR only wires the workflow.
  • npm ci and npm run check passed locally.

Scorecard Branch-Protection (before / after)

Score Source
Before -1 (error) Scorecard API run dated 2026-11-14T11:39:28Z
After pending Needs SCORECARD_TOKEN set, then a Scorecard workflow run on main; target ≥ 8 per #45

Notes for reviewers

  1. Create a fine-grained PAT (docs): Repository Access = this repo; Administration: Read-only (Metadata Read-only auto-set). Optional Webhooks Read-only not required for this issue.
  2. Store it as repository secret SCORECARD_TOKEN.
  3. After merge, run Scorecard via workflow_dispatch, then confirm Branch-Protection ≥ 8 on the API and raise the floor in tools/scorecard-floor.mjs in a follow-up if desired.

arminazimi and others added 2 commits November 14, 2026 20:54
Wire the optional Administration: Read-only PAT into both Scorecard
action steps so Branch-Protection can leave the -1 auth error once a
maintainer stores the secret.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@arminazimi
arminazimi merged commit c79ce82 into main Nov 14, 2026
17 checks passed
@arminazimi
arminazimi deleted the chore/45-scorecard-branch-protection branch November 15, 2026 18:15
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.

scorecard: let Scorecard read branch protection (token)

1 participant