Skip to content

Commit bddca07

Browse files
nedtwiggclaude
andcommitted
Let security-audit prefer AUDIT_PAT when present
Wires `${{ secrets.AUDIT_PAT || github.token }}` into the audit's `$GH_TOKEN`. When the repo has an AUDIT_PAT secret (fine-grained, read-only Administration + Secrets + Environments), the audit's `gh api` queries against /rulesets, /actions/secrets, and /environments succeed and those checks return PASS/FAIL instead of UNVERIFIABLE. Without the secret, the audit still runs against the default workflow token and degrades gracefully. Prompt updated to describe both modes so Claude's report stays accurate about why a check is UNVERIFIABLE when it is. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent be03273 commit bddca07

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/security-audit.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ jobs:
3939
- name: Audit against SECURITY.md
4040
uses: anthropics/claude-code-action@4481e6d3c7bbb88db2a928ca3444c536f589c7c1 # v1
4141
env:
42-
GH_TOKEN: ${{ github.token }}
42+
# Prefer AUDIT_PAT (fine-grained, read-only Administration +
43+
# Secrets + Environments) so checks against /rulesets,
44+
# /actions/secrets, and /environments succeed; fall back to
45+
# the default workflow token so the audit still runs (with
46+
# UNVERIFIABLE results on those endpoints) if AUDIT_PAT is
47+
# absent.
48+
GH_TOKEN: ${{ secrets.AUDIT_PAT || github.token }}
4349
with:
4450
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4551
# Without an explicit allowlist the action defaults to a
@@ -68,15 +74,17 @@ jobs:
6874
references secrets, for security holes the specs don't
6975
cover.
7076
71-
The workflow's `$GH_TOKEN` is a default `GITHUB_TOKEN` with
72-
limited scopes — it cannot read repository administration
73-
endpoints. If `gh api` returns 403 / "Resource not
74-
accessible by integration" on a check (typically `/rulesets`,
75-
`/environments/*`, or `/actions/secrets`), record the check
76-
as `UNVERIFIABLE` (not `FAIL`) with a note that the audit
77-
needs an `AUDIT_PAT` secret with `Administration: read` to
78-
cover it. `UNVERIFIABLE` checks do not flip the overall
79-
status to FAIL on their own.
77+
`$GH_TOKEN` is either an `AUDIT_PAT` (fine-grained, read-only
78+
Administration + Secrets + Environments) when the repo has
79+
that secret configured, or a default `GITHUB_TOKEN` otherwise.
80+
If `gh api` returns 403 / "Resource not accessible by
81+
integration" on a check (typically `/rulesets`,
82+
`/environments/*`, or `/actions/secrets`), the deployment is
83+
running without `AUDIT_PAT`; record the check as
84+
`UNVERIFIABLE` (not `FAIL`) with a note that minting
85+
`AUDIT_PAT` (Administration + Secrets + Environments, all
86+
read-only) would cover it. `UNVERIFIABLE` checks do not flip
87+
the overall status to FAIL on their own.
8088
8189
Produce a Markdown report with three sections:
8290
- `## FAIL IF results` — one line per check with PASS/FAIL

0 commit comments

Comments
 (0)