ci(audit): add dev-dependency audit step at critical severity#1479
ci(audit): add dev-dependency audit step at critical severity#1479carlos-alm wants to merge 10 commits into
Conversation
Removes the WhatsApp/tree-sitter-erlang devDependency flagged as malware (GHSA-rphw-c8qj-jv84, CWE-506). The committed WASM in grammars/ was validated clean (correct export name, no disallowed imports) — Erlang grammar support is unaffected. Also runs npm audit fix to bump hono (→4.12.25), protobufjs (→7.5.8), and qs (→6.15.2) to their patched versions. All three were transitive deps; no direct-dependency changes required. See scripts/build-wasm.ts for instructions on rebuilding the Erlang WASM from a safe source if needed.
…packages npm install on macOS strips the libc field from linux optional entries when regenerating the lockfile. Restore the glibc/musl discriminators that were lost during the npm audit fix run so CI libc-discriminator check passes.
The devDependency was dropped (GHSA-rphw-c8qj-jv84 malware advisory). Keeping it in the GRAMMAR_NPM_PACKAGES list causes the grammar version parity CI check to fail with 'listed in check but absent from devDependencies'.
With tree-sitter-erlang removed from devDependencies, the WASM is no longer built on npm install. The tests threw 'Erlang parser not available' causing 14 hard failures. Add an erlangAvailable guard to each test so they pass (no-op) instead of failing when the grammar is absent.
Removing tree-sitter-erlang causes erlang precision/recall to drop from 100% (3.12.0 baseline) to 0% since the WASM is no longer built. Add KNOWN_REGRESSIONS entries for the expected erlang precision and recall drops so the pre-publish benchmark gate passes.
The previous comment incorrectly claimed 'The grammar WASM is committed in grammars/'. grammars/*.wasm is gitignored; the WASM is not tracked in the repository. Rewrite the comment to accurately describe the situation and provide complete restoration steps.
The existing audit job uses --omit=dev, making it blind to critical advisories in devDependencies (e.g. GHSA-rphw-c8qj-jv84, the malicious tree-sitter-erlang package that prompted this). Adding a second step that audits all packages at critical-only so malware-level advisories in devDeps are caught at PR time without noisy high/moderate churn.
|
Claude finished @carlos-alm's task —— View job PR Review — ci(audit): add dev-dependency audit step at critical severity
Root Cause AnalysisProblem Being Solved: The existing Why This Approach: Additive — no existing step is modified or weakened. The new step uses Risk Assessment: Very low. The change is purely additive CI. It cannot introduce regressions, it cannot break builds, and it requires zero runtime dependency changes. The only failure mode is a false positive from a future critical advisory in a devDep, which is the desired behavior. Phase 1: Root Cause Analysis ✓The PR addresses a real, concrete gap demonstrated by an actual incident (#1478 / GHSA-rphw-c8qj-jv84). Not hiding symptoms — directly plugging the detection blind spot. Phase 2: Configuration Change Detection ✓No rules relaxed. No thresholds lowered. The existing Phase 3: Test Integrity ✓No test files modified. No assertions removed or weakened. No Phase 4: Code QualityThe implementation is correct. One minor observation: Line 183–187 — the inline comment is descriptive and accurate. No issues. One thing worth considering: There is no issue with the approach not needing an install step — Backlog Compliance
Final Recommendation
|
Greptile SummaryCloses a blind spot in the
Confidence Score: 5/5Safe to merge — the change is additive (one new CI step) with no effect on application code or existing gates. The diff touches only a CI workflow file, adding a read-only npm audit command against the lockfile. The new step correctly omits --omit=dev so devDependencies are included, and --package-lock-only ensures no installation side-effects. The comment clearly documents the intentional trade-off of ignoring high/moderate dev advisories. No logic, data, or runtime behaviour is changed. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant GHA as GitHub Actions
participant Lockfile as package-lock.json
participant Registry as npm Advisory DB
GHA->>Lockfile: checkout
GHA->>Registry: "npm audit --omit=dev --audit-level=high --package-lock-only"
Registry-->>GHA: "prod vulnerabilities >= high → fail / pass"
GHA->>Registry: "npm audit --audit-level=critical --package-lock-only (NEW)"
Registry-->>GHA: prod+dev critical vulnerabilities → fail / pass
Reviews (3): Last reviewed commit: "fix: resolve merge conflicts with main" | Re-trigger Greptile |
…lability
parsers.has('erlang') returns true even when WASM loading fails because
doLoadLanguage sets the key to null on error. Use !!parsers.get('erlang')
so the suite skips correctly when the grammar is absent.
…x/ci-audit-devdeps
Summary
Background
The `tree-sitter-erlang` malware advisory (GHSA-rphw-c8qj-jv84) would never have been caught by CI under the old configuration. The package was a direct devDependency with a critical severity advisory, yet `--omit=dev` made it invisible to the audit gate on every PR.
What changes
`ci.yml` audit job gains one additional step:
```yaml
run: npm audit --audit-level=critical --package-lock-only
```
No new jobs, no new runners, no install step needed — `--package-lock-only` reads the lockfile directly.
Also includes from #1478:
Test plan
Note: `Closes #1477` is NOT intended — that tracks pre-existing Erlang test failures unrelated to this removal.