Skip to content

feat(vuln): add npm-audit known-vuln gate (config-driven)#7

Merged
bdelanghe merged 1 commit into
mainfrom
conformance/vuln-gate
Jun 29, 2026
Merged

feat(vuln): add npm-audit known-vuln gate (config-driven)#7
bdelanghe merged 1 commit into
mainfrom
conformance/vuln-gate

Conversation

@bdelanghe

Copy link
Copy Markdown
Contributor

First of the gate-promotions (epic prx-em8h) — make the conformance re-proving gates reusable across bounded-systems + external consumers. Promotes bd-site's bespoke vuln gate into the kit as a config-driven gate, matching the axe-gate (#6) pattern.

What

gates/vuln-gate.mjs (+ ck-vuln-gate bin): runs npm audit over a project's lockfile and fails closed when known critical/high exceeds a threshold.

  • Pure core (parseAudit, evaluateVulns) — unit-tested over synthetic npm-audit payloads, no network.
  • Config-driven: $VULN_ROOT, $VULN_OMIT_DEV (production-scope default — a static site ships no runtime deps), $VULN_THRESHOLD, $VULN_REPORT. Nothing site-specific hard-coded (drops bd-site's data/conformance-evidence.json coupling).
  • Emits the vulns: { knownCriticalOrHighVulns } envelope lone's conformance() consumes for security.no-critical-vulns.

Verification

node test/run.mjs14 passed, 0 failed. Tests: pure parse/threshold logic + a best-effort real npm audit e2e (tolerated skip offline).

Heads-up

The e2e surfaced 1 high advisory in the kit's own production deps — a real supply-chain finding for the kit itself, separate from this gate. Worth a follow-up npm audit fix / dep bump.

Next in the epic (prx-em8h)

vnu→htmlValidator and baseline gates (same pattern), then bd-site consumes them vendored, then publish the kit to npm + JSR.

🤖 Generated with Claude Code

… evidence)

Promotes bd-site's bespoke vuln gate into the kit as a reusable, config-driven gate
(the axe-gate #6 pattern): pure parse/evaluate core (unit-tested over synthetic
npm-audit payloads) + a config-driven CLI + the ck-vuln-gate bin.

Runs `npm audit` over a project's lockfile and FAILS CLOSED when the known
critical/high count exceeds a threshold (default 0). Production-scoped by default
($VULN_OMIT_DEV, since a static site ships no runtime deps); $VULN_THRESHOLD,
$VULN_ROOT, $VULN_REPORT configurable. The report's `vulns: {knownCriticalOrHighVulns}`
envelope is exactly what lone's conformance() consumes for `security.no-critical-vulns`.

Tests: pure parse/threshold logic + a best-effort real `npm audit` e2e (tolerated
skip when offline). node test/run.mjs → 14 passed, 0 failed.

NOTE: the e2e surfaced 1 high advisory in the kit's OWN production deps — a real
supply-chain finding for the kit, tracked separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bdelanghe bdelanghe merged commit 0235c32 into main Jun 29, 2026
1 check passed
@bdelanghe bdelanghe deleted the conformance/vuln-gate branch June 29, 2026 00:55
bdelanghe added a commit that referenced this pull request Jun 29, 2026
… the vuln gate) (#8)

The kit's own vuln gate (#7) flagged 1 high advisory in production deps: undici's
unbounded-decompression-chain (pulled transitively via jsonld@8). The fix is
jsonld@9 (semver-major). Verified the SHACL gate — the kit's only jsonld consumer —
still conforms (test/run.mjs: 14 passed, 0 failed), and the vuln gate over the kit
now reports 0 known critical/high in production deps.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bdelanghe added a commit that referenced this pull request Jun 29, 2026
…mance evidence) (#10)

Third and final gate-promotion (epic prx-em8h). Promotes bd-site's bespoke baseline
gate into the kit, same pattern as vuln (#7), vnu (#9), axe (#6).

Maps the SHIPPED CSS to web-features Baseline data via stylelint-plugin-use-baseline
(headless, no browser) and FAILS CLOSED when the site-wide status is below target.
HONEST: reports the MEASURED status (widely/newly/limited = the worst feature used);
a feature guarded behind an @supports query is a tested fallback and doesn't count.
Config-driven ($BASELINE_CSS/$BASELINE_TARGET/$BASELINE_REPORT); no site coupling.
Emits the `baseline: {status, fallbackTested}` envelope lone's conformance() consumes
for compatibility.baseline.

Unlike vnu/axe, the engine (stylelint) is pure npm, so the fixture e2e is
DETERMINISTIC and runs in CI (no skip). Tests: pure classify/threshold logic + e2e
over good (widely) / bad (:has + ::selection → limited) fixtures. node test/run.mjs → 16/0.

With this, all three bd-site gates are reusable in the kit; bd-site can now consume
them vendored (prx-v5ry), and the kit is ready to publish (prx-47qm).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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