@inerrata-corporation/errata 2.0.16-dev.3332 → 2.0.16-dev.3355

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.
@@ -802,6 +802,12 @@ function identityId(input) {
802
802
  }
803
803
  case "Claim":
804
804
  return canonicalClaimId(input.text, input.scope);
805
+ case "WitnessedVulnerability":
806
+ return genericCanonicalId("dvuln", {
807
+ workspaceId: input.workspaceId,
808
+ target: input.target.replace(/\\/g, "/").replace(/^\.\//, ""),
809
+ statement: canonicalClaimId(input.statement.trim())
810
+ });
805
811
  case "DesignProblem":
806
812
  return `${DESIGN_PROBLEM_PREFIX}${canonicalClaimId(input.statement.trim())}`.slice(
807
813
  0,
@@ -15258,7 +15264,7 @@ var init_edge_rules = __esm({
15258
15264
  // anchor anything at anything, e.g. at a public `Package`, quietly re-creating
15259
15265
  // the code↔collective bridge the membrane exists to prevent.
15260
15266
  ANCHORED_AT: {
15261
- from: ["Problem", "Solution", "RootCause", "Claim"],
15267
+ from: ["Problem", "Vulnerability", "Solution", "RootCause", "Claim"],
15262
15268
  to: ["Symbol"]
15263
15269
  },
15264
15270
  // ── Security spine (v1 taxonomy.ts SECURITY_FORWARD_ONLY commentary) ──
@@ -15303,7 +15309,7 @@ var init_edge_rules = __esm({
15303
15309
  // `Component` joined the target set with OM-agent-anchors: an agent-named
15304
15310
  // component ("React Router") is the same knowledge→named-unit anchor shape as
15305
15311
  // a Tool — the knowledge is ABOUT it, not dependent on it.
15306
- CONCERNS: { from: ["Problem", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool", "Component"] },
15312
+ CONCERNS: { from: ["Problem", "Vulnerability", "Solution", "RootCause", "Claim", "Pattern"], to: ["Tool", "Component"] },
15307
15313
  OPERATES_ON: { from: ["Algorithm"], to: ["DataStructure"] },
15308
15314
  INVOLVES: { from: ["Problem", "Solution"], to: ["DataStructure"] },
15309
15315
  // ── Taxonomy (Track 4 Stream C: MITRE CWE `ChildOf` → `Weakness —IS_A→ Weakness`) ──
@@ -16410,7 +16416,8 @@ CREATE INDEX IF NOT EXISTS nodes_live ON nodes(label, valid_to);
16410
16416
  -- its table row. Partial, so it maintains a few thousand rows instead of adding
16411
16417
  -- a write to every node write. Its label list is FINGERPRINT_INDEXED_LABELS.
16412
16418
  DROP INDEX IF EXISTS nodes_live_fingerprint;
16413
- CREATE INDEX IF NOT EXISTS nodes_instance_fingerprint ON nodes(label, last_updated_at, last_reinforced_at_seq, created_at_seq) WHERE valid_to IS NULL AND label IN ('Problem','Solution','RootCause');
16419
+ DROP INDEX IF EXISTS nodes_instance_fingerprint;
16420
+ CREATE INDEX IF NOT EXISTS nodes_instance_fingerprint_v2 ON nodes(label, last_updated_at, last_reinforced_at_seq, created_at_seq) WHERE valid_to IS NULL AND label IN ('Problem','Vulnerability','Solution','RootCause');
16414
16421
  CREATE INDEX IF NOT EXISTS nodes_logical ON nodes(logical_id, version);
16415
16422
  CREATE INDEX IF NOT EXISTS edges_live ON edges(valid_to);
16416
16423
  -- Expression index on the per-node relPath (stored in attrs_json) so the
@@ -16481,7 +16488,7 @@ function rowToEdge(r) {
16481
16488
  attrs: JSON.parse(r.attrs_json)
16482
16489
  };
16483
16490
  }
16484
- var FINGERPRINT_INDEXED_LABELS = ["Problem", "Solution", "RootCause"];
16491
+ var FINGERPRINT_INDEXED_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
16485
16492
  var SqliteGraphStore = class {
16486
16493
  db;
16487
16494
  // Typed edge lookups build their SQL from the number of types asked for, and
@@ -17159,8 +17166,8 @@ var SqliteGraphStore = class {
17159
17166
  const r2 = this.db.prepare(
17160
17167
  `SELECT COUNT(*) AS n, MAX(last_updated_at) AS t,
17161
17168
  MAX(COALESCE(last_reinforced_at_seq, created_at_seq, 0)) AS s
17162
- FROM nodes INDEXED BY nodes_instance_fingerprint
17163
- WHERE valid_to IS NULL AND label IN ('Problem','Solution','RootCause')`
17169
+ FROM nodes INDEXED BY nodes_instance_fingerprint_v2
17170
+ WHERE valid_to IS NULL AND label IN ('Problem','Vulnerability','Solution','RootCause')`
17164
17171
  ).get();
17165
17172
  return `${r2.n}:${r2.t ?? 0}:${r2.s ?? 0}`;
17166
17173
  }
@@ -19389,7 +19396,7 @@ function generalizeFileRefs(text, fileLexicon, level = 1) {
19389
19396
  }
19390
19397
 
19391
19398
  // src/instance-ingest.ts
19392
- var INSTANCE_LABELS = ["Problem", "Solution", "RootCause"];
19399
+ var INSTANCE_LABELS = ["Problem", "Vulnerability", "Solution", "RootCause"];
19393
19400
  var INSTANCE_EDGES = ["CAUSED_BY", "SOLVED_BY"];
19394
19401
  var ANCHOR_EDGES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
19395
19402
  var ANCHOR_TARGET_LABELS = ["Language", "Package", "Domain", "Component"];
@@ -19509,6 +19516,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19509
19516
  attrs: {
19510
19517
  scope: stripCodebaseScope(n.attrs["scope"]),
19511
19518
  ...n.attrs["kind"] ? { kind: n.attrs["kind"] } : {},
19519
+ ...n.attrs["privateFinding"] ? { privateFinding: true } : {},
19520
+ ...n.attrs["assessment"] ? { assessment: n.attrs["assessment"] } : {},
19521
+ ...n.attrs["sourceClass"] ? { sourceClass: n.attrs["sourceClass"] } : {},
19522
+ ...n.attrs["resolutionWitnessed"] ? { resolutionWitnessed: true, resolvedAt: n.attrs["resolvedAt"] } : {},
19512
19523
  ...n.attrs["resolvedAs"] ? { resolvedAs: n.attrs["resolvedAs"] } : {},
19513
19524
  ...preserved.length > 0 ? { preservedSymbols: preserved } : {},
19514
19525
  ...internal.length > 0 ? { internalSymbols: internal } : {}
@@ -19523,6 +19534,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19523
19534
  const semanticEndpoints = /* @__PURE__ */ new Map();
19524
19535
  const includedByLabel = /* @__PURE__ */ new Map();
19525
19536
  const composition = {
19537
+ privateTargetMissing: 0,
19526
19538
  candidates: 0,
19527
19539
  shipped: 0,
19528
19540
  cloudSourced: 0,
@@ -19568,11 +19580,15 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19568
19580
  if (walked.has(n.id)) continue;
19569
19581
  walked.add(n.id);
19570
19582
  composition.candidates++;
19583
+ if ((n.attrs["privateFinding"] || n.label === "Vulnerability") && !opts.project) {
19584
+ composition.privateTargetMissing++;
19585
+ continue;
19586
+ }
19571
19587
  if (n.attrs["source"] === "cloud") {
19572
19588
  composition.cloudSourced++;
19573
19589
  continue;
19574
19590
  }
19575
- if (label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) {
19591
+ if (n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) {
19576
19592
  composition.falsePositive++;
19577
19593
  continue;
19578
19594
  }
@@ -19595,7 +19611,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19595
19611
  composition.terminalRefused++;
19596
19612
  continue;
19597
19613
  }
19598
- if (!noveltyAgainst(n, ref, noveltyOpts).ready) {
19614
+ if (!n.attrs["privateFinding"] && !noveltyAgainst(n, ref, noveltyOpts).ready) {
19599
19615
  composition.notNovel++;
19600
19616
  continue;
19601
19617
  }
@@ -19638,7 +19654,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
19638
19654
  }
19639
19655
  if (targets.length === 0) continue;
19640
19656
  const shipped = shippedById.get(sourceId);
19641
- if (shipped) {
19657
+ if (shipped && !shipped.attrs["privateFinding"]) {
19642
19658
  const anchors = (label) => targets.filter((x) => x.t.label === label).map(
19643
19659
  (x) => label === "Language" ? langAnchor(x.t) : label === "Component" ? `component:${x.wireId}` : x.wireId
19644
19660
  ).filter((a) => a != null).sort();