Skip to content

fix(drift-audit): mint the publish-bot App token so the audit can read the org - #1194

Merged
dfattal merged 1 commit into
mainfrom
fix/drift-audit-app-token
Aug 24, 2026
Merged

dfattal merged 1 commit into
mainfrom
fix/drift-audit-app-token

Conversation

@dfattal

@dfattal dfattal commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1185. That PR made the audit's writes honest; this one fixes its reads.

The read gap

The audit ran on GITHUB_TOKEN, scoped to displayxr-runtime alone. Every cross-repo read against a private sibling silently degraded — displayxr-shell-pvt resolved to could not fetch … skipped notes instead of findings, so a whole repo was effectively unaudited in CI while auditing fine from a developer's own gh auth.

That is precisely why the 3-month-stale vendored spec there was visible when I ran the audit locally but had never appeared in a scheduled run.

Why the App token, not a PAT

The publish-bot App is installed org-wide (repository_selection=all) with contents:write, so an installation token scoped with owner: and no repositories: covers every repo the audit touches. No new secret, and nothing to expire — a PAT is the same rot-by-expiry shape as the bugs this audit exists to catch.

Precedence stays DRIFT_AUDIT_TOKEN > App token > GITHUB_TOKEN, so an explicit PAT still overrides. The mint step is continue-on-error, so a token hiccup degrades rather than failing the audit.

What this does NOT fix — and the one step that does

Issue emission still cannot work per-repo. The App has no issues scope at all:

displayxr-publish-bot  {"actions":"read","contents":"write","metadata":"read"}

which is also why wiring the App earlier would not have helped.

The remaining step is yours: grant displayxr-publish-bot the issues: write permission and approve it on the org installation. No further code change is needed — per-repo emission starts working the moment the permission exists. Until then findings land as one aggregate issue on this repo, loudly, per #1185.

Verified

YAML parses; step ordering correct. The token's effect on reads can only be confirmed by a real scheduled run — I can't mint an installation token locally.

…d the org

The audit ran on GITHUB_TOKEN, which is scoped to displayxr-runtime alone.
That silently degraded every cross-repo READ against a private sibling --
displayxr-shell-pvt resolved to "could not fetch ... skipped" notes rather
than findings, so a whole repo was effectively unaudited in CI while it
audited fine from a developer's own gh auth. (That is why the stale vendored
spec there was visible locally but never in a run.)

The publish-bot App is installed org-wide (repository_selection=all) with
contents:write, so an installation token scoped with `owner:` and no
`repositories:` covers every repo the audit touches. Strictly better reads,
no new secret, nothing to expire -- unlike a PAT, which is the same
rot-by-expiry shape as the bugs this audit exists to catch.

This does NOT by itself restore per-repo issue emission. The App's
permissions are {actions:read, contents:write, metadata:read} -- it has no
`issues` scope at all, which is why wiring it earlier would not have helped.
Granting the App `issues: write` and approving it on the org installation is
the one remaining step, and needs no further change here: emission starts
working the moment the permission exists. Until then it falls back to the
aggregate issue on this repo and says so loudly.

Precedence is PAT > App token > GITHUB_TOKEN, so setting DRIFT_AUDIT_TOKEN
still overrides. The mint step is continue-on-error: a token hiccup degrades
to GITHUB_TOKEN rather than failing the audit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ua8CevgSHNqoyiy7ziZjHk
@dfattal
dfattal requested a review from a team as a code owner August 24, 2026 18:26
@dfattal
dfattal merged commit da091da into main Aug 24, 2026
21 checks passed
@dfattal
dfattal deleted the fix/drift-audit-app-token branch August 24, 2026 18:37
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