@blamejs/exceptd-skills 0.12.9 → 0.12.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_meta": {
3
3
  "schema_version": "1.0.0",
4
- "last_updated": "2026-05-01",
4
+ "last_updated": "2026-05-13",
5
5
  "purpose": "Zero-day learning loop output. Each entry maps a CVE to: attack vector, defense chain analysis, framework coverage, new control requirements generated, and exposure scoring.",
6
6
  "note": "Never delete entries. Closed gaps are marked status: closed. History is data.",
7
7
  "tlp": "CLEAR",
@@ -466,5 +466,227 @@
466
466
  "basis": "SLSA L3 + provenance + signing all pass on the malicious package. Standard supply-chain audits (SBOM check, provenance verify, signature verify) all give green. The architectural pre-condition (pull_request_target + id-token:write + shared actions/cache) is not in any compliance framework's control catalog. Combined ~150M+ weekly downloads across 42 packages = extremely broad exposure.",
467
467
  "theater_pattern": "provenance_signed_therefore_safe"
468
468
  }
469
+ },
470
+ "MAL-2026-3083": {
471
+ "name": "Elementary-Data PyPI Worm (Forged Release via GitHub Actions Script Injection)",
472
+ "lesson_date": "2026-05-13",
473
+ "attack_vector": {
474
+ "description": "GitHub Actions script-injection sink in `.github/workflows/update_pylon_issue.yml`. The workflow interpolated `${{ github.event.comment.body }}` directly into a `run:` block — any commenter could execute attacker-controlled shell with the workflow's elevated GITHUB_TOKEN. The attacker forged an orphan commit (b1e4b1f3...) and tagged v0.23.3, causing the project's legitimate publishing pipeline to emit a properly-signed PyPI release of code the maintainers never saw. The wheel differed from 0.23.2 by exactly one file: an `elementary.pth` Python startup hook that auto-executed on every interpreter invocation and harvested cloud + dbt + git credentials, exfiltrating to a single subdomain on skyhanni.cloud during an 8-hour in-the-wild window (2026-04-24 22:20Z → 2026-04-25 ~06:30Z).",
475
+ "privileges_required": "Any GitHub account that can comment on a public PR or issue in the target repo.",
476
+ "complexity": "low — comment-driven; no maintainer access required",
477
+ "ai_factor": "None observed. Conventional GitHub Actions script-injection tradecraft. The compounding factor is workflow-shaped: `${{ github.event.* }}` interpolated directly into `run:` is a documented anti-pattern, but it remains widespread."
478
+ },
479
+ "defense_chain": {
480
+ "prevention": {
481
+ "what_would_have_worked": "Treat `${{ github.event.* }}` as untrusted; pass it via env: into the script body rather than interpolating directly. Forbid workflows triggered by issue_comment / pull_request_target from holding `contents: write` permissions. Block release tags whose target is not an ancestor of the default branch (orphan-commit-driven release detection).",
482
+ "was_this_required": false,
483
+ "framework_requiring_it": null,
484
+ "adequacy": "Architectural — eliminates the primitive entirely. Auditing every workflow file for the anti-pattern is the hard part; this is what the library-author playbook's `gha-workflow-script-injection-sink` indicator looks for."
485
+ },
486
+ "detection": {
487
+ "what_would_have_worked": "Consumer-side fresh-publish cooldown (PyPI's pip --require-hashes against a known-good lockfile, or registry-mirror cooldown windows). Comparison-by-content: any pip install of a major-version-pinned package returning a wheel whose extracted contents differ from the previous patch version by an added .pth file should fail loud.",
488
+ "was_this_required": false,
489
+ "framework_requiring_it": null,
490
+ "adequacy": "Defense in depth — the malicious 0.23.3 was caught within hours. A 24-72h cooldown would have shielded most consumers."
491
+ },
492
+ "response": {
493
+ "what_would_have_worked": "Rotate every credential under the credential_paths_scanned list for any host that pip-installed elementary-data during the 8h window — dbt warehouse creds especially. The package was yanked, but extracted .pth files persist on disk until the affected venv is wiped.",
494
+ "was_this_required": false,
495
+ "framework_requiring_it": null,
496
+ "adequacy": "Reduces blast radius post-exploitation. Upgrading to 0.23.4 does NOT remove the planted elementary.pth from the existing site-packages — a venv recreate is required."
497
+ }
498
+ },
499
+ "framework_coverage": {
500
+ "SLSA-L3": {
501
+ "covered": true,
502
+ "adequate": false,
503
+ "gap": "Provenance valid, payload malicious — same shape as CVE-2026-45321. SLSA-L3 attests WHICH pipeline built the artifact, not that the pipeline was driven by trusted inputs."
504
+ },
505
+ "NIST-800-53-SA-12": {
506
+ "covered": true,
507
+ "adequate": false,
508
+ "gap": "Supply chain protection treats signed release as the trust anchor. The signature was valid; the input to the signing pipeline was attacker-controlled."
509
+ },
510
+ "NIST-800-218-PO.4": {
511
+ "covered": true,
512
+ "adequate": false,
513
+ "gap": "Define and use secure development security checks. Direct interpolation of github.event.* into run: scripts is a documented anti-pattern but is not framework-enforced."
514
+ },
515
+ "EU-CRA-Art13": {
516
+ "covered": true,
517
+ "adequate": false,
518
+ "gap": "Vulnerability handling provisions don't address the case where the maintainer was an unwitting publisher."
519
+ },
520
+ "NIS2-Art21-2d": {
521
+ "covered": true,
522
+ "adequate": false,
523
+ "gap": "Supply chain risk management presumes detectable signal at consumption. Valid signature neutralizes consumer-side checks."
524
+ }
525
+ },
526
+ "new_control_requirements": [
527
+ {
528
+ "id": "NEW-CTRL-011",
529
+ "name": "GHA-WORKFLOW-SCRIPT-INJECTION-SINK-BAN",
530
+ "description": "Forbid direct interpolation of `${{ github.event.* }}` (comment.body, issue.body, review.body, pull_request.title, head_ref, etc.) into any `run:` block. Pass via `env:` so the shell sees a quoted variable, not an interpolated string. Enforced via repository linter / required CI check.",
531
+ "evidence": "MAL-2026-3083 — the entire compromise hinges on this single primitive; no other infrastructure was breached.",
532
+ "gap_closes": [
533
+ "NIST-800-218-PO.4",
534
+ "SLSA-L3"
535
+ ]
536
+ },
537
+ {
538
+ "id": "NEW-CTRL-012",
539
+ "name": "ORPHAN-COMMIT-RELEASE-DETECTION",
540
+ "description": "Reject release tags whose target commit is not reachable from the default branch (`git merge-base --is-ancestor`). Forged orphan-commit releases are a signature of the maintainer-impersonation supply chain pattern.",
541
+ "evidence": "MAL-2026-3083 — the malicious release pointed at orphan commit b1e4b1f3aad0d489ab0e9208031c67402bbb8480, never on main.",
542
+ "gap_closes": [
543
+ "NIST-800-53-SA-12",
544
+ "EU-CRA-Art13"
545
+ ]
546
+ }
547
+ ],
548
+ "compliance_exposure_score": {
549
+ "percent_audit_passing_orgs_still_exposed": 92,
550
+ "basis": "PyPI signature + maintainer trust + provenance all pass on the malicious package. Audit programs measure SBOM presence, package-signing posture, and dependency-pin discipline — none of which catch a maintainer's own pipeline being weaponized via a comment. ~1.1M monthly downloads broaden the consumer footprint.",
551
+ "theater_pattern": "signed_release_therefore_safe"
552
+ }
553
+ },
554
+ "CVE-2026-42208": {
555
+ "name": "BerriAI LiteLLM Proxy Auth SQL Injection",
556
+ "lesson_date": "2026-05-13",
557
+ "attack_vector": {
558
+ "description": "Authorization header value passed directly into a SQL query in the LiteLLM proxy's auth path. Crafted bearer-token-shape strings reach an error-logging pathway that executes SQL with the attacker-controlled value as a string-concatenated parameter — full pre-auth read/modify of the managed-credentials database. CISA KEV-listed 2026-05-08; in-wild exploitation evidence is the listing criterion.",
559
+ "privileges_required": "Network reachability to the LiteLLM proxy endpoint. No prior authentication.",
560
+ "complexity": "low — curl-able. POST /chat/completions with a SQLi payload in Authorization.",
561
+ "ai_factor": "Conventional human-security-research SQLi tradecraft. AI-stack relevance is downstream: LiteLLM IS the gateway in front of the model-provider keys that operators DO NOT want exfiltrated. The vulnerability is conventional; the impact class is AI-infrastructure."
562
+ },
563
+ "defense_chain": {
564
+ "prevention": {
565
+ "what_would_have_worked": "Parameterised queries throughout the auth path — no caller-supplied string ever string-concatenated into SQL. The 1.83.7 patch is exactly this: caller-supplied value becomes a SQL parameter, not part of the statement.",
566
+ "was_this_required": false,
567
+ "framework_requiring_it": "NIST-800-53-SI-10",
568
+ "adequacy": "Eliminates the class. SI-10's text requirement is satisfied by 'we validate inputs' regardless of whether the validation runs before the parameter binding — the framework gap is operational, not conceptual."
569
+ },
570
+ "detection": {
571
+ "what_would_have_worked": "WAF rule on Authorization headers containing SQL metacharacters or exceeding 100 bytes of non-base64-shape characters. LiteLLM error logs surface the injection string verbatim pre-1.83.7 — a log-pattern alert would have fired on the first probe.",
572
+ "was_this_required": false,
573
+ "framework_requiring_it": null,
574
+ "adequacy": "Detection layer. Operators running LiteLLM behind a default-deny WAF would not have been compromised."
575
+ },
576
+ "response": {
577
+ "what_would_have_worked": "Rotate every virtual key minted on the proxy since the patch ship date. Rotate every model-provider key the proxy held (openai, anthropic, etc.). Rotate LITELLM_MASTER_KEY and DATABASE_URL credentials. Audit LiteLLM_VerificationToken / LiteLLM_UserTable for admin-event-less inserts.",
578
+ "was_this_required": false,
579
+ "framework_requiring_it": null,
580
+ "adequacy": "Reduces blast radius post-exploitation. The DB primitive is read+write — assume tampering, not just disclosure."
581
+ }
582
+ },
583
+ "framework_coverage": {
584
+ "NIST-800-53-SI-10": {
585
+ "covered": true,
586
+ "adequate": false,
587
+ "gap": "Input validation control doesn't address argument-vs-statement distinction in SQL libraries."
588
+ },
589
+ "OWASP-LLM01": {
590
+ "covered": false,
591
+ "adequate": false,
592
+ "gap": "Prompt-injection control set doesn't address the AI-PROXY backend SQL surface — LiteLLM is the substrate that gates LLM API access, not the LLM itself."
593
+ },
594
+ "EU-AI-Act-Art-15": {
595
+ "covered": true,
596
+ "adequate": false,
597
+ "gap": "Robustness + cybersecurity requirement is undefined operationally for AI gateway infrastructure."
598
+ }
599
+ },
600
+ "new_control_requirements": [
601
+ {
602
+ "id": "NEW-CTRL-013",
603
+ "name": "AI-GATEWAY-CREDENTIAL-STORE-ISOLATION",
604
+ "description": "AI-API gateway substrates (LiteLLM, Portkey, Helicone, similar) must isolate the managed-credentials DB on a network segment unreachable from the API plane. The auth path may read but the API plane MUST NOT have raw-SQL connectivity to the credential store.",
605
+ "evidence": "CVE-2026-42208 — a single SQLi reaches the entire model-provider credential vault because the API plane and credential store share a process.",
606
+ "gap_closes": [
607
+ "OWASP-LLM01",
608
+ "EU-AI-Act-Art-15"
609
+ ]
610
+ }
611
+ ],
612
+ "compliance_exposure_score": {
613
+ "percent_audit_passing_orgs_still_exposed": 75,
614
+ "basis": "SI-10 audits accept 'we validate inputs' as compliance. Most operators run LiteLLM internet-reachable behind a thin proxy without a SQL-injection-aware WAF. KEV listing imposes a 21-day patch SLA on federal orgs; private-sector adoption lags.",
615
+ "theater_pattern": "input_validation_checkbox_without_parameterised_queries"
616
+ }
617
+ },
618
+ "CVE-2026-39884": {
619
+ "name": "Flux159 mcp-server-kubernetes Argument Injection via port_forward",
620
+ "lesson_date": "2026-05-13",
621
+ "attack_vector": {
622
+ "description": "AI assistant invokes the mcp-server-kubernetes `port_forward` MCP tool with a tainted resourceName (e.g. 'pod-name --address=0.0.0.0'). The server builds a string-form kubectl command and uses `.split(' ')` instead of an argv array, so the attacker-controlled flag lands as a distinct argv entry to kubectl. `--address=0.0.0.0` binds the port-forward to all interfaces; `-n kube-system` redirects to attacker-chosen namespaces. Exploitation is mediated by the AI assistant — adversarial input via prompt injection in retrieved docs / commit messages / upstream MCP tool responses is the upstream gate.",
623
+ "privileges_required": "AI assistant with mcp-server-kubernetes installed and port_forward enabled. Attacker needs only to influence the AI's input (PR comment, doc, retrieved RAG chunk).",
624
+ "complexity": "low — once the tainted string is in the AI's context, the tool call propagates it unchanged.",
625
+ "ai_factor": "AI-assistant-mediated argument injection. The vuln is conventional argv-injection; the AI is the channel that converts adversarial document content into infrastructure-tool flags."
626
+ },
627
+ "defense_chain": {
628
+ "prevention": {
629
+ "what_would_have_worked": "argv-array spawn — `execFile('kubectl', ['port-forward', resourceName, ...])` with no `.split(' ')` and no shell interpretation. The 3.5.0 patch does exactly this.",
630
+ "was_this_required": false,
631
+ "framework_requiring_it": "NIST-800-53-SI-10",
632
+ "adequacy": "Architectural fix — the class disappears."
633
+ },
634
+ "detection": {
635
+ "what_would_have_worked": "MCP audit log alerting on port_forward tool calls where resourceName contains whitespace or kubectl flag prefixes (`--`, `-n`). Process-level alerting on kubectl port-forward processes with --address=0.0.0.0 on hosts that should only port-forward to localhost.",
636
+ "was_this_required": false,
637
+ "framework_requiring_it": null,
638
+ "adequacy": "Detection layer — catches the exploit attempt before the listener binds externally."
639
+ },
640
+ "response": {
641
+ "what_would_have_worked": "Disable the port_forward tool in the MCP allowlist until upgraded to 3.5.0+. Most operator deployments don't rely on port_forward for routine work.",
642
+ "was_this_required": false,
643
+ "framework_requiring_it": null,
644
+ "adequacy": "Effective tool-disable mitigation; low operator cost."
645
+ }
646
+ },
647
+ "framework_coverage": {
648
+ "NIST-800-53-SI-10": {
649
+ "covered": true,
650
+ "adequate": false,
651
+ "gap": "Input validation control doesn't address the argv-vs-string boundary that argument injection exploits."
652
+ },
653
+ "OWASP-LLM01": {
654
+ "covered": false,
655
+ "adequate": false,
656
+ "gap": "Prompt-injection control set doesn't model the AI-assistant-as-channel pattern — the attacker doesn't compromise the MCP server, they feed adversarial input that the AI dutifully passes through."
657
+ },
658
+ "NIS2-Art21-2g": {
659
+ "covered": true,
660
+ "adequate": false,
661
+ "gap": "Patch management presumes traditional CVE timelines; MCP plugin ecosystem patch awareness lags."
662
+ }
663
+ },
664
+ "new_control_requirements": [
665
+ {
666
+ "id": "NEW-CTRL-014",
667
+ "name": "MCP-SERVER-ARGV-NOT-SHELLSTRING",
668
+ "description": "MCP servers spawning subprocesses MUST use argv-array spawn primitives (execFile / spawn with array args / posix_spawn) — never .split(' ') or shell concatenation of caller-supplied input. Treats every MCP tool argument as untrusted by default.",
669
+ "evidence": "CVE-2026-39884 — the entire vulnerability is .split(' ') on a caller-supplied string. The 3.5.0 patch is the argv-array refactor.",
670
+ "gap_closes": [
671
+ "NIST-800-53-SI-10",
672
+ "OWASP-LLM01"
673
+ ]
674
+ },
675
+ {
676
+ "id": "NEW-CTRL-015",
677
+ "name": "MCP-TOOL-ALLOWLIST-ENFORCEMENT",
678
+ "description": "AI agent stacks must enforce an explicit allowlist of MCP tools — tools default to denied. High-risk tools (port_forward, exec, write_file, shell, kubectl) require operator consent per session.",
679
+ "evidence": "CVE-2026-39884 — temporary mitigation is exactly 'disable port_forward in the allowlist'. The control closes the class across future MCP plugins.",
680
+ "gap_closes": [
681
+ "OWASP-LLM01",
682
+ "NIS2-Art21-2g"
683
+ ]
684
+ }
685
+ ],
686
+ "compliance_exposure_score": {
687
+ "percent_audit_passing_orgs_still_exposed": 88,
688
+ "basis": "MCP ecosystem patch hygiene lags traditional CVE timelines. Most AI-agent operators do not maintain an explicit MCP tool allowlist; SI-10 audits accept the MCP plugin as a vendored dependency without auditing its argv handling.",
689
+ "theater_pattern": "vendored_mcp_plugin_inherits_vendor_trust"
690
+ }
469
691
  }
470
692
  }
@@ -118,21 +118,29 @@ Modes:
118
118
  --from-cache [<p>] read from prefetch cache (default .cache/upstream).
119
119
  Combine with --apply to upsert against cached data
120
120
  entirely offline. Cache must be pre-populated via --prefetch.
121
- --source kev,epss scope to a comma-separated list (kev|epss|nvd|rfc|pins)
121
+ --source kev,epss scope to a comma-separated list (kev|epss|nvd|rfc|pins|ghsa|osv)
122
122
  --from-fixture <p> use frozen fixture payloads (tests use this path)
123
123
  --indexes-only rebuild data/_indexes/ only; no network. Equivalent to
124
124
  \`exceptd refresh --indexes-only\`.
125
125
  --swarm fan out sources across worker threads. Best with --from-cache.
126
- --advisory <id> (v0.12.0) seed a single catalog entry from a CVE or GHSA ID.
127
- Fetches from GitHub Advisory Database (covers npm + PyPI +
128
- Maven + Go + ...) and writes a DRAFT to data/cve-catalog.json
129
- marked with _auto_imported: true. Editorial fields
130
- (framework_control_gaps, iocs, atlas_refs, attack_refs)
131
- remain null pending review via:
126
+ --advisory <id> (v0.12.0) seed a single catalog entry from an advisory ID.
127
+ CVE-* and GHSA-* route through the GitHub Advisory
128
+ Database. When GHSA returns 404 for a CVE-* id
129
+ (CNAs / OSV mirrors operate on different cadences) the
130
+ dispatcher falls back to OSV.dev's /v1/vulns/{id}
131
+ before failing (v0.12.11). MAL-*, SNYK-*, RUSTSEC-*,
132
+ USN-*, UVI-*, GO-*, MGASA-*, PYSEC-*, and other
133
+ OSV-native namespaces route through OSV.dev (v0.12.10).
134
+ Writes a DRAFT to data/cve-catalog.json marked with
135
+ _auto_imported: true.
136
+ Editorial fields (framework_control_gaps, iocs,
137
+ atlas_refs, attack_refs) remain null pending review via:
132
138
  exceptd run cve-curation --advisory <id>
133
139
  Examples:
134
140
  exceptd refresh --advisory CVE-2026-45321
135
141
  exceptd refresh --advisory GHSA-xxxx-xxxx-xxxx --apply
142
+ exceptd refresh --advisory MAL-2026-3083
143
+ exceptd refresh --advisory RUSTSEC-2025-0001
136
144
 
137
145
  Sources (default = all):
138
146
  kev CISA Known Exploited Vulnerabilities
@@ -143,6 +151,10 @@ Sources (default = all):
143
151
  ghsa (v0.12.0) GitHub Advisory Database — npm/PyPI/Maven/etc. Lands new CVE
144
152
  IDs as DRAFTS (_auto_imported: true); catalog validator treats drafts
145
153
  as warnings, not errors. Editorial review still required.
154
+ osv (v0.12.10) OSV.dev aggregator — OSSF Malicious Packages (MAL-*) + Snyk
155
+ + GHSA + RustSec + Mageia + Go Vuln DB + Ubuntu USN. Unauthenticated.
156
+ Use --advisory MAL-* / RUSTSEC-* / SNYK-* / USN-* to seed a single
157
+ draft. Bulk import via package watchlist is a v0.13 follow-up.
146
158
 
147
159
  Air-gap workflow:
148
160
  1. On a connected host: \`exceptd refresh --prefetch\`
@@ -526,6 +538,48 @@ const GHSA_SOURCE = {
526
538
  },
527
539
  };
528
540
 
541
+ /**
542
+ * v0.12.10: OSV.dev source. Aggregates OSSF Malicious Packages (MAL-*) +
543
+ * Snyk (SNYK-*) + GitHub Advisory Database + RustSec (RUSTSEC-*) + Mageia
544
+ * + Go Vuln DB + Ubuntu USN into one unauthenticated API. Slot in for the
545
+ * package-compromise class that doesn't have a CVE yet — the MAL-*
546
+ * namespace is the canonical key for those (e.g. MAL-2026-3083, the
547
+ * elementary-data PyPI worm).
548
+ *
549
+ * Apply path mirrors GHSA: new entries land in data/cve-catalog.json as
550
+ * drafts (`_auto_imported: true` + `_draft: true`). Catalog key is either
551
+ * the CVE alias (when present) or the OSV id verbatim — preserving the
552
+ * existing CVE-keyed convention while accepting OSV's broader identifier
553
+ * shapes.
554
+ */
555
+ const OSV_SOURCE = {
556
+ name: "osv",
557
+ description: "OSV.dev — OSSF Malicious Packages (MAL-*) + Snyk + GHSA + RustSec + Mageia + Go Vuln DB + Ubuntu USN. Unauthenticated. Slot in for the broader supply-chain-class disclosure space — covers package compromises that don't have CVEs yet.",
558
+ applies_to: "data/cve-catalog.json",
559
+ async fetchDiff(ctx) {
560
+ if (ctx.fixtures?.osv) return synthesizeFromFixture(ctx, "osv");
561
+ const osv = require("./source-osv");
562
+ return osv.buildDiff(ctx);
563
+ },
564
+ async applyDiff(ctx, diffs) {
565
+ // Same shape as GHSA applyDiff — skip overwrites, surface conflicts.
566
+ let updated = 0;
567
+ const errors = [];
568
+ for (const d of diffs) {
569
+ if (d.field !== "_new_entry") continue;
570
+ if (!d.after || !d.id) continue;
571
+ if (ctx.cveCatalog[d.id]) continue; // never overwrite existing entries
572
+ try {
573
+ ctx.cveCatalog[d.id] = d.after;
574
+ updated++;
575
+ } catch (e) {
576
+ errors.push(`${d.id}: ${e.message}`);
577
+ }
578
+ }
579
+ return { updated, errors };
580
+ },
581
+ };
582
+
529
583
  const ALL_SOURCES = {
530
584
  kev: KEV_SOURCE,
531
585
  epss: EPSS_SOURCE,
@@ -533,6 +587,7 @@ const ALL_SOURCES = {
533
587
  rfc: RFC_SOURCE,
534
588
  pins: PINS_SOURCE,
535
589
  ghsa: GHSA_SOURCE,
590
+ osv: OSV_SOURCE,
536
591
  };
537
592
 
538
593
  // --- Cache-mode helpers ------------------------------------------------
@@ -746,7 +801,7 @@ function loadCtx(opts) {
746
801
  cacheDir: null,
747
802
  };
748
803
  if (opts.fromFixture) {
749
- ctx.fixtures = { dir: path.resolve(opts.fromFixture), kev: true, epss: true, nvd: true, rfc: true, pins: true, ghsa: true };
804
+ ctx.fixtures = { dir: path.resolve(opts.fromFixture), kev: true, epss: true, nvd: true, rfc: true, pins: true, ghsa: true, osv: true };
750
805
  } else if (opts.fromCache) {
751
806
  const abs = path.resolve(opts.fromCache);
752
807
  ctx.cacheDir = abs;
@@ -799,27 +854,60 @@ function chosenSources(opts) {
799
854
  * when a draft is produced, signaling that editorial review is needed.
800
855
  */
801
856
  async function seedSingleAdvisory(opts) {
802
- const ghsa = require("./source-ghsa");
803
857
  const id = opts.advisory;
804
- const result = await ghsa.fetchAdvisoryById(id, {});
858
+ // v0.12.10: route OSV-native ids (MAL-*, SNYK-*, RUSTSEC-*, USN-*, etc.)
859
+ // through source-osv. CVE-* and GHSA-* keep routing through GHSA because
860
+ // GHSA carries richer field coverage for those identifier shapes.
861
+ const osvMod = require("./source-osv");
862
+ const useOsv = osvMod.isOsvId(id) && !/^GHSA-/i.test(id);
863
+ const ghsa = require("./source-ghsa");
864
+ const sourceMod = useOsv ? osvMod : ghsa;
865
+ const sourceName = useOsv ? "osv" : "ghsa";
866
+ const fixtureEnv = useOsv ? "EXCEPTD_OSV_FIXTURE" : "EXCEPTD_GHSA_FIXTURE";
867
+
868
+ let result = await sourceMod.fetchAdvisoryById(id, {});
869
+ // F4 (v0.12.11): CVE-* identifiers may have an OSV record before GHSA
870
+ // publishes one (CNAs and OSV mirrors operate on different cadences).
871
+ // When GHSA returns 404 specifically, retry through OSV's /v1/vulns/{id}
872
+ // — OSV indexes CVE ids as primary keys. If both 404, surface a combined
873
+ // error message so operators know both sources were tried before failing.
874
+ let fallbackSourceUsed = null;
875
+ if (!result.ok && !useOsv && /^CVE-/i.test(id) && /HTTP 404/.test(result.error || "")) {
876
+ const fallback = await osvMod.fetchAdvisoryById(id, {});
877
+ if (fallback.ok) {
878
+ result = fallback;
879
+ fallbackSourceUsed = "osv";
880
+ } else if (/HTTP 404/.test(fallback.error || "") || /not in fixture/.test(fallback.error || "")) {
881
+ // Both sources tried, both 404 — combine the error message.
882
+ const combined = { ok: false, verb: "refresh", error: `--advisory ${id}: not found in GHSA or OSV (GHSA: ${result.error}; OSV: ${fallback.error})`, source: "offline", routed_to: "ghsa+osv", hint: `Both GHSA and OSV.dev returned 404 for ${id}. Verify the CVE id (CVE-YYYY-NNNN) and that an advisory record exists upstream.` };
883
+ if (opts.json) process.stdout.write(JSON.stringify(combined) + "\n");
884
+ else process.stderr.write(`[refresh --advisory] ${combined.error}\n hint: ${combined.hint}\n`);
885
+ process.exitCode = 2;
886
+ return;
887
+ }
888
+ }
805
889
  if (!result.ok) {
806
- const err = { ok: false, verb: "refresh", error: `--advisory ${id}: ${result.error}`, source: result.source, hint: "Verify the ID format (CVE-YYYY-NNNN or GHSA-*) and network reachability. Set EXCEPTD_GHSA_FIXTURE for offline testing." };
890
+ const err = { ok: false, verb: "refresh", error: `--advisory ${id}: ${result.error}`, source: result.source, routed_to: sourceName, hint: `Verify the ID format (CVE-YYYY-NNNN, GHSA-*, MAL-*, SNYK-*, RUSTSEC-*, USN-*, etc.) and network reachability. Set ${fixtureEnv} for offline testing.` };
807
891
  if (opts.json) process.stdout.write(JSON.stringify(err) + "\n");
808
892
  else process.stderr.write(`[refresh --advisory] ${err.error}\n hint: ${err.hint}\n`);
809
893
  process.exitCode = 2;
810
894
  return;
811
895
  }
896
+ // If the OSV fallback fired, normalize/route through the OSV module from
897
+ // here on — the advisory shape is OSV's, not GHSA's.
898
+ const effectiveMod = fallbackSourceUsed === "osv" ? osvMod : sourceMod;
899
+ const effectiveName = fallbackSourceUsed === "osv" ? "osv" : sourceName;
812
900
  const advisory = result.advisories[0];
813
901
  if (!advisory) {
814
- const err = { ok: false, verb: "refresh", error: `--advisory ${id}: no matching advisory found`, source: result.source };
902
+ const err = { ok: false, verb: "refresh", error: `--advisory ${id}: no matching advisory found`, source: result.source, routed_to: effectiveName };
815
903
  if (opts.json) process.stdout.write(JSON.stringify(err) + "\n");
816
904
  else process.stderr.write(`[refresh --advisory] ${err.error}\n`);
817
905
  process.exitCode = 2;
818
906
  return;
819
907
  }
820
- const normalized = ghsa.normalizeAdvisory(advisory);
908
+ const normalized = effectiveMod.normalizeAdvisory(advisory);
821
909
  if (!normalized) {
822
- const err = { ok: false, verb: "refresh", error: `--advisory ${id}: advisory has no CVE ID (GHSA-only entries are not imported into the CVE catalog in v0.12)`, ghsa_id: advisory.ghsa_id || null };
910
+ const err = { ok: false, verb: "refresh", error: `--advisory ${id}: advisory could not be normalized (missing required fields)`, routed_to: effectiveName, source_id: advisory.ghsa_id || advisory.id || null };
823
911
  if (opts.json) process.stdout.write(JSON.stringify(err) + "\n");
824
912
  else process.stderr.write(`[refresh --advisory] ${err.error}\n`);
825
913
  process.exitCode = 2;
@@ -1003,4 +1091,4 @@ if (require.main === module) {
1003
1091
  });
1004
1092
  }
1005
1093
 
1006
- module.exports = { ALL_SOURCES, loadCtx, parseArgs };
1094
+ module.exports = { ALL_SOURCES, loadCtx, parseArgs, seedSingleAdvisory };
@@ -119,7 +119,13 @@ async function fetchAdvisoryById(id, opts = {}) {
119
119
  if (/^CVE-\d{4}-\d+$/i.test(id)) {
120
120
  return fetchAdvisories({ ...opts, path: `/advisories?cve_id=${encodeURIComponent(id.toUpperCase())}` });
121
121
  }
122
- return { ok: false, error: `unrecognized id format (expected CVE-YYYY-NNNN or GHSA-*): ${id}`, source: "offline" };
122
+ // v0.12.11: widen the error to enumerate OSV-native prefixes operators
123
+ // running `exceptd refresh --advisory FOO-BAR` previously got an error
124
+ // mentioning only CVE / GHSA, even though MAL-*, SNYK-*, RUSTSEC-*,
125
+ // USN-*, PYSEC-*, GO-*, MGASA-*, UVI- are also valid id shapes routed
126
+ // through source-osv. The hint here mirrors lib/refresh-external.js
127
+ // seedSingleAdvisory's documented acceptance set.
128
+ return { ok: false, error: `unrecognized id format: ${id}. Expected one of: CVE-YYYY-NNNN, GHSA-* (routed through source-ghsa); MAL-* / SNYK-* / RUSTSEC-* / USN-* / PYSEC-* / GO-* / MGASA-* / UVI- (routed through source-osv).`, source: "offline" };
123
129
  }
124
130
 
125
131
  /**