Skip to content

Commit 5f22283

Browse files
stack72claude
andauthored
fix: align deno.json audit task with CI invocation (#1142)
## Summary The `deno run audit` task in `deno.json` has been silently broken since PR #484: it lacks `--allow-env=GITHUB_STEP_SUMMARY` and `--allow-write`, but `scripts/audit_deps.ts:245` calls `Deno.env.get("GITHUB_STEP_SUMMARY")` and `writeGitHubSummary()` later writes that file. The task crashes with `NotCapable` after every successful scan, returning a non-zero exit code locally. CI never noticed because `.github/workflows/ci.yml:96` invoked `scripts/audit_deps.ts` directly with the correct flags, bypassing the task entirely. This PR: - **Adds `--allow-env=GITHUB_STEP_SUMMARY` and `--allow-write` to the `audit` task** in `deno.json` so it matches CI's flag set byte-for-byte. The script's `writeGitHubSummary` early-returns when `GITHUB_STEP_SUMMARY` is unset, so the local dev experience is unchanged — the grant only matters in CI where the var is set. - **Drops `&& deno outdated` from the task.** CI's vuln-scan invocation never included it, and CI runs `deno outdated` as its own failure-tolerant step (`ci.yml:98-106`) with `|| true` warning semantics that would be lost if folded into the task's `&&` chain. That separate CI step is left intact. In practice no developer ever saw `deno outdated` run via `deno run audit` because the task always crashed first. - **Routes CI's "Scan for known vulnerabilities" step through `deno task audit`** so the `deno.json` task is the single source of truth. This eliminates the silent drift that hid this bug for ~30 PRs and matches the existing `deno task check`/`deno task test`/`deno task compile` pattern used elsewhere in `ci.yml`. ## Notes - Not a regression. Git history (`scripts/audit_deps.ts`, `deno.json:15`) shows the task body has been unchanged since `017139c4` (PR #484), introduced together with the script that requires the env access. The task never worked locally; the bug was masked by CI bypassing it. - The unbounded `--allow-write` grant on the local task is a deliberate trade-off for CI parity. Locally, `GITHUB_STEP_SUMMARY` is never set, so `writeGitHubSummary()` returns at `audit_deps.ts:246` before any write — the grant covers an unreachable code path. - Resolves swamp-club lab issue #27. ## Test plan - [x] `deno run audit` from the repo root — exits 0, "No known vulnerabilities found" - [x] `deno fmt --check` — clean - [x] `deno check` — clean (1117 files) - [x] `deno lint` — clean (1011 files) - [ ] CI deps-audit job passes (validates step 2 — `deno task audit` produces the same output as the previous inline command, since they're byte-for-byte the same command line) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8cf2552 commit 5f22283

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
deno-version: v2.x
9494

9595
- name: Scan for known vulnerabilities
96-
run: deno run --allow-read --allow-net=api.osv.dev --allow-env=GITHUB_STEP_SUMMARY --allow-write scripts/audit_deps.ts
96+
run: deno task audit
9797

9898
- name: Check for outdated dependencies
9999
run: |

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"fmt": "deno fmt",
1313
"compile": "deno run -A scripts/compile.ts",
1414
"license-headers": "deno run --allow-read --allow-write scripts/add_license_headers.ts",
15-
"audit": "deno run --allow-read --allow-net=api.osv.dev scripts/audit_deps.ts && deno outdated",
15+
"audit": "deno run --allow-read --allow-net=api.osv.dev --allow-env=GITHUB_STEP_SUMMARY --allow-write scripts/audit_deps.ts",
1616
"audit-actions": "deno run --allow-read --allow-net=api.github.com --allow-env=GITHUB_STEP_SUMMARY,GITHUB_TOKEN --allow-write scripts/audit_actions.ts",
1717
"review-skills": "deno run --allow-read --allow-run --allow-env=GITHUB_STEP_SUMMARY --allow-write scripts/review_skills.ts",
1818
"eval-skill-triggers": "deno run --allow-read --allow-run --allow-env --allow-write scripts/eval_skill_triggers_promptfoo.ts"

0 commit comments

Comments
 (0)