Uh oh!
There was an error while loading. Please reload this page.
fix(pii-gate): run under restrictive default token perms (contents-scoped Compare API) - #63
Conversation
LukasWodka
commented
Jun 18, 2026
👋 Heads-up — Code review queue is at 32 / 30 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
saadqbal
commented
Jun 18, 2026
Verified green on a test PR in tracebloc/cli with an unmodified minimal caller (run 27748465192) — jobs run, no startup failure; before the fix the same minimal caller @main gave 0-job startup failures. Needs one approving review from a non-author (org ruleset on |
Uh oh!
There was an error while loading. Please reload this page.
Problem
After publishing `public-pii-gate.yml` to main (#60), the Public PII gate still failed at startup with 0 jobs on every PR in adopting repos (cli, data-ingestors).
Root cause: the reusable workflow declared `permissions: { contents: read, pull-requests: read }`, but those repos' default workflow token permission is "read" (grants `contents`/`packages` read; `pull-requests: none`). A minimal caller (`uses:` + `secrets: inherit`, no `permissions:` block) therefore cannot grant `pull-requests`, so the called workflow's request exceeds the caller's ceiling → startup failure, no jobs.
Fix
Make the reusable workflow self-sufficient under the restrictive default so callers stay trivial (no per-repo `permissions:` block, no recurring footgun):
Title/body/labels already come from the event payload (no API). Full scan coverage (title + body + commit messages) is preserved.
Verification
On a test PR in tracebloc/cli with an unmodified minimal caller pointed at this branch, the gate ran green (jobs executed, no startup failure) — run 27748465192. Before the fix, identical minimal callers @main produced 0-job startup failures.
Tracking: #62
Note
Low Risk
CI-only permission and API change for PR text scanning; same haystack sources with a documented 250-commit Compare API cap.
Overview
Fixes reusable Public PII gate workflows that failed at startup with 0 jobs when called from repos whose default
GITHUB_TOKENonly grantscontents: read(nopull-requests).The workflow now requests
permissions: contents: readonly (dropspull-requests: read) and loads commit messages via the Compare API (repos/.../compare/{base}...{head}) usingPR_BASE_SHA/PR_HEAD_SHAfrom the event, instead ofgh pr view --json commits. PR title, body, and labels still come from the payload; scan coverage is unchanged.Header comments document why
pull-requestsmust not be requested and the 250-commit Compare API limit.Reviewed by Cursor Bugbot for commit 5fad0d9. Bugbot is set up for automated code reviews on this repo. Configure here.