@clear-capabilities/agentic-security-scanner 0.185.0 → 0.186.1

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.
Files changed (167) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/bin/agentic-security.js +24 -1
  3. package/dist/1128.index.js +25 -21
  4. package/dist/2584.index.js +1 -1
  5. package/dist/4171.index.js +2 -2
  6. package/dist/5752.index.js +466 -0
  7. package/dist/7405.index.js +1 -1
  8. package/dist/8158.index.js +1713 -0
  9. package/dist/8798.index.js +1 -1
  10. package/dist/9382.index.js +2 -2
  11. package/dist/9579.index.js +1 -1
  12. package/dist/agentic-security.mjs +29 -29
  13. package/dist/agentic-security.mjs.sha256 +1 -1
  14. package/dist/{0b301d45b231f144a1b4.json → ca62ee93079be4c24eee.json} +7 -7
  15. package/package.json +7 -7
  16. package/src/dataflow/CLAUDE.md +6 -3
  17. package/src/dataflow/access-paths.js +12 -2
  18. package/src/dataflow/demand-query.js +279 -40
  19. package/src/dataflow/dep-fingerprint.js +1 -1
  20. package/src/dataflow/exploit-prover.js +6 -2
  21. package/src/dataflow/ir-cache.js +268 -0
  22. package/src/dataflow/privacy-taint.js +7 -0
  23. package/src/engine.js +62 -5
  24. package/src/ir/CLAUDE.md +4 -0
  25. package/src/ir/callgraph.js +36 -8
  26. package/src/ir/index.js +18 -4
  27. package/src/ir/parser-js.js +10 -0
  28. package/src/language/CLAUDE.md +13 -0
  29. package/src/language/nix-option-types.js +170 -0
  30. package/src/language/nix-script-taint.js +46 -3
  31. package/src/language/nix-secrets.js +20 -2
  32. package/src/lineage/CLAUDE.md +2 -1
  33. package/src/lineage/smt-orchestrator.js +47 -11
  34. package/src/lineage/smt-z3-backend.js +294 -0
  35. package/src/posture/CLAUDE.md +5 -1
  36. package/src/posture/business-logic.js +16 -7
  37. package/src/posture/dag-commands.js +442 -0
  38. package/src/posture/finding-defaults.js +19 -0
  39. package/src/posture/git-history.js +91 -1
  40. package/src/sast/CLAUDE.md +2 -0
  41. package/src/sast/_call-args.js +70 -0
  42. package/src/sast/init-scope.js +87 -0
  43. package/src/sast/listen-bind-address.js +49 -0
  44. package/src/sast/redirect-target.js +106 -0
  45. package/src/sast/reflected-input.js +76 -0
  46. package/src/sast/send-file-root.js +27 -0
  47. package/src/sast/sensitive-data-logging.js +38 -1
  48. package/dist/119.index.js +0 -197
  49. package/dist/128.index.js +0 -129
  50. package/dist/1293.index.js +0 -5689
  51. package/dist/1336.index.js +0 -16331
  52. package/dist/1351.index.js +0 -133
  53. package/dist/1387.index.js +0 -271
  54. package/dist/1437.index.js +0 -23
  55. package/dist/1445.index.js +0 -110
  56. package/dist/1505.index.js +0 -151
  57. package/dist/1557.index.js +0 -293
  58. package/dist/1621.index.js +0 -311
  59. package/dist/1751.index.js +0 -160
  60. package/dist/1765.index.js +0 -727
  61. package/dist/1861.index.js +0 -690
  62. package/dist/1906.index.js +0 -433
  63. package/dist/208.index.js +0 -1631
  64. package/dist/2223.index.js +0 -159
  65. package/dist/2238.index.js +0 -295
  66. package/dist/2530.index.js +0 -152
  67. package/dist/2565.index.js +0 -116
  68. package/dist/2574.index.js +0 -127
  69. package/dist/2620.index.js +0 -345
  70. package/dist/2773.index.js +0 -98
  71. package/dist/2775.index.js +0 -32
  72. package/dist/2966.index.js +0 -171
  73. package/dist/2972.index.js +0 -87
  74. package/dist/2991.index.js +0 -131
  75. package/dist/3063.index.js +0 -833
  76. package/dist/3075.index.js +0 -227
  77. package/dist/3121.index.js +0 -297
  78. package/dist/3314.index.js +0 -263
  79. package/dist/3480.index.js +0 -1822
  80. package/dist/3481.index.js +0 -24
  81. package/dist/3506.index.js +0 -268
  82. package/dist/3533.index.js +0 -591
  83. package/dist/3653.index.js +0 -450
  84. package/dist/3740.index.js +0 -722
  85. package/dist/3822.index.js +0 -131
  86. package/dist/3868.index.js +0 -292
  87. package/dist/3918.index.js +0 -192
  88. package/dist/4090.index.js +0 -288
  89. package/dist/4113.index.js +0 -1286
  90. package/dist/4121.index.js +0 -1190
  91. package/dist/4142.index.js +0 -690
  92. package/dist/4168.index.js +0 -509
  93. package/dist/4281.index.js +0 -993
  94. package/dist/4336.index.js +0 -436
  95. package/dist/4387.index.js +0 -532
  96. package/dist/4413.index.js +0 -302
  97. package/dist/4476.index.js +0 -4510
  98. package/dist/4491.index.js +0 -133
  99. package/dist/4538.index.js +0 -185
  100. package/dist/4684.index.js +0 -319
  101. package/dist/4740.index.js +0 -165
  102. package/dist/4780.index.js +0 -209
  103. package/dist/4802.index.js +0 -225
  104. package/dist/4812.index.js +0 -379
  105. package/dist/4835.index.js +0 -126
  106. package/dist/494.index.js +0 -226
  107. package/dist/4991.index.js +0 -549
  108. package/dist/5199.index.js +0 -305
  109. package/dist/5216.index.js +0 -109
  110. package/dist/5439.index.js +0 -301
  111. package/dist/5443.index.js +0 -97
  112. package/dist/5496.index.js +0 -377
  113. package/dist/5738.index.js +0 -240
  114. package/dist/5801.index.js +0 -588
  115. package/dist/5817.index.js +0 -714
  116. package/dist/5858.index.js +0 -223
  117. package/dist/5933.index.js +0 -143
  118. package/dist/601.index.js +0 -23
  119. package/dist/6173.index.js +0 -273
  120. package/dist/6291.index.js +0 -1871
  121. package/dist/6312.index.js +0 -666
  122. package/dist/634.index.js +0 -16182
  123. package/dist/644.index.js +0 -87
  124. package/dist/6508.index.js +0 -283
  125. package/dist/6560.index.js +0 -645
  126. package/dist/6576.index.js +0 -422
  127. package/dist/6579.index.js +0 -271
  128. package/dist/6655.index.js +0 -3221
  129. package/dist/6745.index.js +0 -305
  130. package/dist/6818.index.js +0 -21642
  131. package/dist/6932.index.js +0 -1190
  132. package/dist/6972.index.js +0 -167
  133. package/dist/6995.index.js +0 -163
  134. package/dist/7249.index.js +0 -191
  135. package/dist/7372.index.js +0 -1197
  136. package/dist/7546.index.js +0 -541
  137. package/dist/76.index.js +0 -448
  138. package/dist/7879.index.js +0 -163
  139. package/dist/8025.index.js +0 -130
  140. package/dist/8054.index.js +0 -248
  141. package/dist/808.index.js +0 -1330
  142. package/dist/8097.index.js +0 -201
  143. package/dist/8126.index.js +0 -191
  144. package/dist/8178.index.js +0 -78
  145. package/dist/8382.index.js +0 -93
  146. package/dist/8408.index.js +0 -261
  147. package/dist/8540.index.js +0 -174
  148. package/dist/8635.index.js +0 -802
  149. package/dist/8688.index.js +0 -410
  150. package/dist/8699.index.js +0 -779
  151. package/dist/8891.index.js +0 -457
  152. package/dist/8916.index.js +0 -885
  153. package/dist/9146.index.js +0 -170
  154. package/dist/9168.index.js +0 -841
  155. package/dist/9292.index.js +0 -369
  156. package/dist/9422.index.js +0 -866
  157. package/dist/9440.index.js +0 -453
  158. package/dist/9479.index.js +0 -152
  159. package/dist/9481.index.js +0 -220
  160. package/dist/9539.index.js +0 -100
  161. package/dist/9547.index.js +0 -103
  162. package/dist/9692.index.js +0 -90
  163. package/dist/9800.index.js +0 -462
  164. package/dist/9899.index.js +0 -138
  165. package/dist/9981.index.js +0 -206
  166. package/dist/999.index.js +0 -117
  167. package/dist/9999.index.js +0 -1698
@@ -1,133 +0,0 @@
1
- export const id = 1351;
2
- export const ids = [1351];
3
- export const modules = {
4
-
5
- /***/ 41351:
6
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
-
8
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
- /* harmony export */ discoverHarnessConfigs: () => (/* binding */ discoverHarnessConfigs),
10
- /* harmony export */ summarizeHarnessPresence: () => (/* binding */ summarizeHarnessPresence)
11
- /* harmony export */ });
12
- /* unused harmony export HARNESS_DIRS */
13
- /* harmony import */ var node_fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51455);
14
- /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76760);
15
- /* harmony import */ var node_os__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(48161);
16
- // Multi-harness configuration discovery.
17
- //
18
- // Finds every agent-harness configuration directory the user has, both at
19
- // the project root AND under ~/. The discovered files feed the
20
- // claude-settings / claude-md-prompt-injection / claude-hook-injection
21
- // detectors so we audit Claude / Cursor / Codex / Gemini / Kiro / OpenCode /
22
- // Trae / Qwen / Zed / Continue / Aider with one sweep.
23
- //
24
- // Used by the `/scan --harness` mode.
25
-
26
-
27
-
28
-
29
-
30
- const HARNESS_DIRS = [
31
- '.claude', '.cursor', '.codex', '.gemini', '.kiro',
32
- '.opencode', '.trae', '.qwen', '.zed', '.continue', '.aider',
33
- '.codebuddy', '.copilot',
34
- ];
35
-
36
- const HARNESS_FILES = [
37
- // settings + permissions
38
- 'settings.json', 'settings.local.json', 'config.json',
39
- // instruction files (lifted into context every session)
40
- 'CLAUDE.md', 'AGENTS.md', 'GEMINI.md', 'CURSOR.md', 'CODEX.md',
41
- 'KIRO.md', 'QWEN.md', 'TRAE.md', 'OPENCODE.md', 'SYSTEM_PROMPT.md',
42
- // mcp
43
- 'mcp.json', '.mcp.json', 'mcp_servers.json', 'claude_desktop_config.json',
44
- // hooks
45
- 'hooks.json', 'hooks.yml', 'hooks.yaml',
46
- ];
47
-
48
- const HARNESS_SUBDIRS = ['agents', 'skills', 'commands', 'hooks', 'rules'];
49
-
50
- const MAX_FILE_SIZE = 1_000_000;
51
-
52
- async function _readSafe(fp) {
53
- try {
54
- const stat = await node_fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(fp);
55
- if (stat.size > MAX_FILE_SIZE) return null;
56
- return await node_fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(fp, 'utf8');
57
- } catch { return null; }
58
- }
59
-
60
- async function _walkHarnessDir(harnessRoot, harnessName, out) {
61
- // Top-level config files.
62
- for (const fn of HARNESS_FILES) {
63
- const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(harnessRoot, fn);
64
- const content = await _readSafe(fp);
65
- if (content !== null) out[fp] = content;
66
- }
67
- // Subdirs holding instruction-style files.
68
- for (const sub of HARNESS_SUBDIRS) {
69
- const dp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(harnessRoot, sub);
70
- try {
71
- const entries = await node_fs_promises__WEBPACK_IMPORTED_MODULE_0__.readdir(dp, { withFileTypes: true });
72
- for (const e of entries) {
73
- if (!e.isFile()) continue;
74
- if (!/\.(?:md|json|yaml|yml)$/i.test(e.name)) continue;
75
- const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(dp, e.name);
76
- const content = await _readSafe(fp);
77
- if (content !== null) out[fp] = content;
78
- }
79
- } catch { /* dir does not exist — fine */ }
80
- }
81
- // Project-root CLAUDE.md / AGENTS.md (some users put them outside .claude/).
82
- // Only walked when the harness is .claude.
83
- void harnessName;
84
- }
85
-
86
- // Discover harness configs at one of:
87
- // 1. The project root (e.g. /path/to/repo/.claude, /path/to/repo/.cursor)
88
- // 2. Home directory (e.g. ~/.claude, ~/.cursor) — opt-in via includeHome=true
89
- async function discoverHarnessConfigs(projectRoot, opts = {}) {
90
- const includeHome = !!opts.includeHome;
91
- const out = {};
92
-
93
- // Project-rooted instruction files commonly placed at repo root.
94
- for (const fn of ['CLAUDE.md', 'AGENTS.md', 'GEMINI.md', 'CURSOR.md', 'CODEX.md', 'KIRO.md', 'QWEN.md', 'TRAE.md', 'OPENCODE.md']) {
95
- const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(projectRoot, fn);
96
- const content = await _readSafe(fp);
97
- if (content !== null) out[fp] = content;
98
- }
99
-
100
- for (const dir of HARNESS_DIRS) {
101
- const harnessRoot = node_path__WEBPACK_IMPORTED_MODULE_1__.join(projectRoot, dir);
102
- try { await node_fs_promises__WEBPACK_IMPORTED_MODULE_0__.access(harnessRoot); } catch { continue; }
103
- await _walkHarnessDir(harnessRoot, dir, out);
104
- }
105
-
106
- if (includeHome) {
107
- const home = node_os__WEBPACK_IMPORTED_MODULE_2__.homedir();
108
- if (home) {
109
- for (const dir of HARNESS_DIRS) {
110
- const harnessRoot = node_path__WEBPACK_IMPORTED_MODULE_1__.join(home, dir);
111
- try { await node_fs_promises__WEBPACK_IMPORTED_MODULE_0__.access(harnessRoot); } catch { continue; }
112
- await _walkHarnessDir(harnessRoot, dir, out);
113
- }
114
- }
115
- }
116
-
117
- return out;
118
- }
119
-
120
- // Inventory of which harnesses are present (for grade / summary).
121
- function summarizeHarnessPresence(fileContents) {
122
- const present = new Set();
123
- for (const fp of Object.keys(fileContents || {})) {
124
- const m = /\.(claude|cursor|codex|gemini|kiro|opencode|trae|qwen|zed|continue|aider|codebuddy|copilot)[\\/]/.exec(fp);
125
- if (m) present.add(m[1]);
126
- }
127
- return [...present].sort();
128
- }
129
-
130
-
131
- /***/ })
132
-
133
- };
@@ -1,271 +0,0 @@
1
- export const id = 1387;
2
- export const ids = [1387];
3
- export const modules = {
4
-
5
- /***/ 91387:
6
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
-
8
-
9
- // EXPORTS
10
- __webpack_require__.d(__webpack_exports__, {
11
- buildViews: () => (/* binding */ buildViews),
12
- renderHtml: () => (/* binding */ renderHtml),
13
- renderText: () => (/* binding */ renderText)
14
- });
15
-
16
- // UNUSED EXPORTS: buildCanonicalFindings
17
-
18
- // EXTERNAL MODULE: external "node:crypto"
19
- var external_node_crypto_ = __webpack_require__(77598);
20
- ;// CONCATENATED MODULE: ./src/posture/assurance/release-verdict.js
21
- // The release verdict (E7-08): a deterministic function from a release package to one of three answers, with every reason in plain words.
22
- //
23
- // not_deployable a condition the policy treats as blocking is present: an unfinished scan, files that were not scanned, an analyzer that timed out or failed,
24
- // a fix that was claimed and not verified, an open finding that is proven exploitable, an open high or critical finding
25
- // needs_review nothing blocks, but something is unknown and a person has to decide: a signal the context analysis could not settle, runtime evidence that
26
- // came from a different build, a finding of unproven exploitability that is high or critical
27
- // deployable none of the above. This is NOT a statement that the release is safe; it says no blocking or unknown condition was found in the evidence the package holds
28
- //
29
- // The word "safe" is never produced. The verdict is a function of the package alone (no clock, no environment), so the same package gives the same verdict and the same
30
- // reasons in the same order, and a stated verdict that differs from the one recomputed here is refused (`verifyStatedVerdict`).
31
- //
32
- // WHAT COUNTS AS A BLOCKER is the policy below, not a judgement made per release. Waived findings (a waiver the package lists as honoured) do not block but are listed.
33
- const SEV_BLOCK = new Set(['critical', 'high']);
34
-
35
- const asArray = (v) => (Array.isArray(v) ? v : []);
36
- const by = (pkg, kind) => asArray(pkg && pkg.evidence).filter((e) => e && e.ref && e.ref.kind === kind);
37
-
38
- /**
39
- * @param {object} pkg a release package
40
- * @param {{waivedIds?:string[]}} [opts] finding ids covered by an honoured waiver
41
- * @returns {{verdict:'not_deployable'|'needs_review'|'deployable', blockers:{code:string, message:string, evidence:string[]}[], unknowns:{code:string, message:string, evidence:string[]}[], waived:string[], statement:string}}
42
- */
43
- function releaseVerdict(pkg, { waivedIds = [] } = {}) {
44
- const blockers = []; const unknowns = [];
45
- const block = (code, message, evidence = []) => blockers.push({ code, message, evidence });
46
- const unk = (code, message, evidence = []) => unknowns.push({ code, message, evidence });
47
- const waived = new Set(waivedIds);
48
-
49
- // ---- the scan itself
50
- const health = by(pkg, 'scan-health')[0];
51
- if (!health) block('NO_SCAN_HEALTH', 'the package holds no scan health, so nothing says the scan finished');
52
- else {
53
- const h = health.payload || {}; const ev = [health.ref.digest];
54
- if (h.status !== 'complete') block('SCAN_INCOMPLETE', `the scan did not finish cleanly (status ${JSON.stringify(h.status ?? 'unknown')}): ${asArray(h.conditions).join('; ') || 'no reason was recorded'}`, ev);
55
- const f = h.files || {};
56
- if (Number.isFinite(f.expected) && Number.isFinite(f.scanned) && f.scanned < f.expected) block('FILES_NOT_SCANNED', `${f.expected - f.scanned} of ${f.expected} files were not scanned`, ev);
57
- else if (Number.isFinite(f.unanalysed) ? f.unanalysed > 0 : (Number.isFinite(f.skipped) && f.skipped > 0)) block('FILES_SKIPPED', `${Number.isFinite(f.unanalysed) ? f.unanalysed : f.skipped} file(s) were skipped (too large or too dense to analyse)`, ev);
58
- if (Number.isFinite(f.timedOut) && f.timedOut > 0) block('FILES_TIMED_OUT', `${f.timedOut} file(s) exceeded the per-file analysis time`, ev);
59
- const a = h.analyzers || {};
60
- if (Number.isFinite(a.timedOut) && a.timedOut > 0) block('ANALYZER_TIMED_OUT', `${a.timedOut} analyzer(s) timed out, so what they would have found is not in this result`, ev);
61
- if (Number.isFinite(a.failed) && a.failed > 0 && !(Number.isFinite(a.timedOut) && a.failed === a.timedOut)) block('ANALYZER_FAILED', `${a.failed} analyzer(s) failed, so what they would have found is not in this result`, ev);
62
- if (h.deepAnalysis && Array.isArray(h.deepAnalysis.incomplete) && h.deepAnalysis.incomplete.length) unk('DEEP_ANALYSIS_INCOMPLETE', `deep analysis stopped short: ${h.deepAnalysis.incomplete.map((x) => `${x.reason} x${x.count}`).join(', ')}`, ev);
63
- }
64
-
65
- // ---- findings and fixes
66
- const fixes = by(pkg, 'fix-verification');
67
- const fixFor = (id) => fixes.filter((x) => x.payload && (x.payload.findingStableId === id || x.payload.findingId === id));
68
- for (const e of by(pkg, 'finding')) {
69
- const f = e.payload || {}; const id = e.ref.payloadId || f.stableId || f.id; const ev = [e.ref.digest];
70
- const triage = f.triage && f.triage.state;
71
- const falsePositive = triage === 'false_positive' || f.falsePositive === true;
72
- const myFixes = fixFor(id); const fixed = myFixes.find((x) => x.payload.verifiedFull === true);
73
- if (waived.has(id)) continue;
74
- if (falsePositive) {
75
- if (!(f.triage && f.triage.by && f.triage.reason)) unk('FALSE_POSITIVE_UNJUSTIFIED', `finding ${id} is marked a false positive without a named person and a reason`, ev);
76
- continue;
77
- }
78
- for (const x of myFixes) if (x.payload.verifiedFull !== true) block('FIX_NOT_VERIFIED', `a fix for ${id} is claimed but was not fully verified (${asArray(x.payload.degradedLegs).map((d) => (typeof d === 'string' ? d : d && d.leg)).filter(Boolean).join(', ') || 'checks did not all pass'})`, [...ev, x.ref.digest]);
79
- if (fixed) continue;
80
- const sev = String(f.severity || 'info'); const tier = typeof f.proofTier === 'string' ? f.proofTier : 'unproven';
81
- const ci = f.contextIntelligence && (f.contextIntelligence.counterexample && f.contextIntelligence.counterexample.state || f.contextIntelligence.state);
82
- if (tier === 'execution-proven') block('PROVEN_OPEN_FINDING', `finding ${id} (${sev}) is proven exploitable and is open`, ev);
83
- else if (SEV_BLOCK.has(sev)) {
84
- if (ci === 'unresolved' || ci === 'plausible') unk('CONTEXT_SIGNAL_UNSETTLED', `finding ${id} (${sev}) rests on a context signal the analysis could not settle (${ci}); a person has to decide whether it is real`, ev);
85
- else block('OPEN_HIGH_FINDING', `finding ${id} is open at severity ${sev}`, ev);
86
- } else if (ci === 'unresolved' || ci === 'plausible') unk('CONTEXT_SIGNAL_UNSETTLED', `finding ${id} rests on a context signal the analysis could not settle (${ci})`, ev);
87
- }
88
-
89
- // ---- runtime evidence from another build
90
- for (const e of by(pkg, 'runtime-explanation')) {
91
- const edges = asArray(e.payload && e.payload.runtime && e.payload.runtime.edges); const bad = edges.filter((x) => Number(x.mismatchedRecords) > 0);
92
- if (bad.length) unk('RUNTIME_BUILD_MISMATCH', `runtime records for ${bad.length} edge(s) of ${e.ref.payloadId || 'a finding'} came from a different build than the one released, so they say nothing about this release and are not counted as corroboration`, [e.ref.digest]);
93
- const miss = asArray(e.payload && e.payload.runtime && e.payload.runtime.missingObservations);
94
- if (!bad.length && miss.length && e.payload.compare && e.payload.compare.state !== 'corroborated') unk('RUNTIME_NOT_CORROBORATED', `runtime evidence for ${e.ref.payloadId || 'a finding'} does not corroborate the path: ${miss[0]}`, [e.ref.digest]);
95
- }
96
-
97
- blockers.sort((a, b) => (a.code + a.message < b.code + b.message ? -1 : 1)); unknowns.sort((a, b) => (a.code + a.message < b.code + b.message ? -1 : 1));
98
- const verdict = blockers.length ? 'not_deployable' : unknowns.length ? 'needs_review' : 'deployable';
99
- const statement = verdict === 'deployable'
100
- ? 'No blocking or unknown condition was found in the evidence this package holds. That is not a statement that the release is safe.'
101
- : verdict === 'needs_review' ? `Nothing blocks the release, but ${unknowns.length} thing(s) are unknown and a person has to decide.` : `${blockers.length} condition(s) block the release.`;
102
- return { verdict, blockers, unknowns, waived: [...waived].sort(), statement };
103
- }
104
-
105
- /** Is the verdict a package states the one its own contents give? @returns {{ok:boolean, stated:string|null, computed:string, message:string|null}} */
106
- function verifyStatedVerdict(pkg, opts) {
107
- const computed = releaseVerdict(pkg, opts).verdict;
108
- const decisions = asArray(pkg && pkg.policy && pkg.policy.decisions);
109
- const d = decisions.find((x) => x && x.id === 'release-verdict');
110
- const stated = d ? d.outcome : null;
111
- if (stated === null) return { ok: false, stated, computed, message: 'the package states no release verdict' };
112
- if (stated !== computed) return { ok: false, stated, computed, message: `the package states "${stated}" but its own contents give "${computed}"` };
113
- return { ok: true, stated, computed, message: null };
114
- }
115
-
116
- ;// CONCATENATED MODULE: ./src/report/perspectives.js
117
- // Three views of one release (E7-07): what a developer needs, what a CISO needs, what an auditor needs, all built from the SAME canonical list of findings so they
118
- // cannot disagree.
119
- //
120
- // developer where the problem is, why it is one, how to fix it, and whether a fix was verified
121
- // CISO what is proven and what is not, what changed since the previous release, how risky and how complete
122
- // auditor for each assertion and each unknown, the evidence it rests on (by digest) and why anything is unknown; the issuer and what the signature does not prove
123
- //
124
- // One list, three projections. `canonicalFindings` is computed once from the release package; every view only selects and arranges its fields, and each entry
125
- // carries the same finding id, status, evidence hash and confidence wherever it appears. Nothing is recomputed per view.
126
- //
127
- // The package is DATA from a repository we do not control: every string is escaped before it reaches HTML, the page loads nothing from anywhere and runs no script, and a
128
- // content security policy says so.
129
-
130
-
131
-
132
- const esc = (v) => String(v ?? '').replace(/[&<>"'`]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '`': '&#96;' }[c]));
133
- const sevRank = { critical: 4, high: 3, medium: 2, low: 1, info: 0 };
134
-
135
- function confidenceOf(f) {
136
- if (typeof f.confidence === 'number') return f.confidence >= 0.8 ? 'high' : f.confidence >= 0.5 ? 'medium' : 'low';
137
- return typeof f.confidenceTier === 'string' ? f.confidenceTier : 'unknown';
138
- }
139
-
140
- /**
141
- * @param {object} pkg a release package (E7-03). It is assumed to have been verified by the caller; the views carry `verification` as the caller states it.
142
- * @param {{previous?:object, ranking?:object, verification?:{ok:boolean, errors?:object[]}}} opts `previous` is the previous release's package; `ranking` is a result of rankFleetExposure
143
- */
144
- function buildCanonicalFindings(pkg) {
145
- const entries = Array.isArray(pkg && pkg.evidence) ? pkg.evidence : [];
146
- const byKind = (k) => entries.filter((e) => e.ref && e.ref.kind === k);
147
- const fixes = byKind('fix-verification');
148
- const out = [];
149
- for (const e of byKind('finding')) {
150
- const f = e.payload || {};
151
- const id = e.ref.payloadId || f.stableId || f.id;
152
- const fixesFor = fixes.filter((x) => x.payload && (x.payload.findingStableId === id || x.payload.findingId === id || x.payload.findingId === f.id) );
153
- const fix = fixesFor.find((x) => x.payload.verifiedFull === true) || fixesFor[0] || null;
154
- const status = !fix ? 'open' : fix.payload.verifiedFull === true ? 'fix-verified' : 'fix-unverified';
155
- out.push({
156
- id, evidenceHash: e.ref.digest, status, confidence: confidenceOf(f), severity: f.severity || 'info', proofTier: typeof f.proofTier === 'string' ? f.proofTier : 'unproven',
157
- where: { file: f.file ?? null, line: Number.isInteger(f.line) ? f.line : null }, title: f.vuln || f.title || 'finding', cwe: f.cwe || null,
158
- why: f.description || f.reason || null, how: f.remediation || null,
159
- fix: fix ? { evidenceHash: fix.ref.digest, verifiedFull: fix.payload.verifiedFull === true, completeness: fix.payload.fixCompleteness || null, degradedLegs: Array.isArray(fix.payload.degradedLegs) ? fix.payload.degradedLegs.map((d) => (typeof d === 'string' ? d : d && d.leg) ).filter(Boolean) : [] } : null,
160
- });
161
- }
162
- return out.sort((a, b) => (sevRank[b.severity] - sevRank[a.severity]) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
163
- }
164
-
165
- function buildViews(pkg, { previous = null, ranking = null, verification = null } = {}) {
166
- const findings = buildCanonicalFindings(pkg);
167
- const packageDigest = `sha256:${(0,external_node_crypto_.createHash)('sha256').update(JSON.stringify(pkg && pkg.lineageOrder || [])).digest('hex')}`;
168
- const prev = previous ? buildCanonicalFindings(previous) : null;
169
- const prevById = prev ? new Map(prev.map((f) => [f.id, f])) : null;
170
- const ids = new Set(findings.map((f) => f.id));
171
- const change = prev ? {
172
- new: findings.filter((f) => !prevById.has(f.id)).map((f) => f.id),
173
- resolved: prev.filter((f) => !ids.has(f.id)).map((f) => f.id),
174
- statusChanged: findings.filter((f) => prevById.has(f.id) && prevById.get(f.id).status !== f.status).map((f) => ({ id: f.id, from: prevById.get(f.id).status, to: f.status })),
175
- unchanged: findings.filter((f) => prevById.has(f.id) && prevById.get(f.id).status === f.status).length,
176
- } : null;
177
- const rankById = ranking ? new Map(ranking.ranked.map((r) => [r.id, r])) : null;
178
- const tier = (t) => findings.filter((f) => f.proofTier === t).length;
179
- const completeness = pkg && pkg.completeness ? { verdict: pkg.completeness.verdict, scanStatus: pkg.completeness.scanStatus, conditions: pkg.completeness.conditions || [] } : { verdict: 'unknown', scanStatus: 'unknown', conditions: [] };
180
- const unknowns = [];
181
- if (completeness.verdict !== 'complete') for (const c of completeness.conditions.length ? completeness.conditions : ['the scan did not report that it finished']) unknowns.push({ about: 'scan completeness', reason: c, evidence: pkg.completeness && pkg.completeness.source ? [pkg.completeness.source] : [] });
182
- for (const a of (pkg && pkg.assertions) || []) if (a.status !== 'supported') unknowns.push({ about: a.text, reason: a.reason || `the assertion is ${a.status}`, evidence: a.evidence || [] });
183
- for (const f of findings) if (f.proofTier !== 'execution-proven') unknowns.push({ about: `exploitability of ${f.id}`, reason: `proof tier is ${f.proofTier}: it has not been shown to be exploitable`, evidence: [f.evidenceHash] });
184
-
185
- const developer = findings.map((f) => ({ id: f.id, evidenceHash: f.evidenceHash, status: f.status, confidence: f.confidence, severity: f.severity, where: f.where, why: f.why, how: f.how, title: f.title, cwe: f.cwe, fix: f.fix }));
186
- const verdict = releaseVerdict(pkg);
187
- const ciso = {
188
- verdict: { verdict: verdict.verdict, statement: verdict.statement, blockers: verdict.blockers.map((b) => b.message), unknowns: verdict.unknowns.map((u) => u.message) },
189
- verified: verification ? verification.ok === true : null,
190
- scan: completeness,
191
- proven: { executionProven: tier('execution-proven'), taintProven: tier('taint-proven'), unproven: findings.length - tier('execution-proven') - tier('taint-proven'), total: findings.length },
192
- bySeverity: Object.fromEntries(['critical', 'high', 'medium', 'low', 'info'].map((s) => [s, findings.filter((f) => f.severity === s).length])),
193
- fixes: { verified: findings.filter((f) => f.status === 'fix-verified').length, unverified: findings.filter((f) => f.status === 'fix-unverified').length, open: findings.filter((f) => f.status === 'open').length },
194
- changeSinceLast: change,
195
- risk: ranking ? { byPriority: ranking.summary.byPriority, incompleteCoverage: ranking.summary.incompleteCoverage, top: ranking.ranked.slice(0, 5).map((r) => ({ id: r.id, priority: r.priority, rule: r.rule })) } : null,
196
- findings: findings.map((f) => ({ id: f.id, evidenceHash: f.evidenceHash, status: f.status, confidence: f.confidence, severity: f.severity, proofTier: f.proofTier, priority: rankById && rankById.get(f.id) ? rankById.get(f.id).priority : null })),
197
- };
198
- const auditor = {
199
- package: { lineageDigest: packageDigest, snapshot: pkg && pkg.snapshot ? { commit: pkg.snapshot.commit, immutable: pkg.snapshot.immutable, digest: pkg.snapshot.digest } : null },
200
- issuer: pkg && pkg.issuance ? { trustBasis: pkg.issuance.trustBasis, independentlyCertified: pkg.issuance.independentlyCertified, keyFingerprint: pkg.issuance.issuer && pkg.issuance.issuer.keyFingerprint } : null,
201
- verification: verification ? { ok: verification.ok === true, errors: (verification.errors || []).map((e) => `${e.code}: ${e.message}`) } : { ok: null, errors: ['no verification was performed by this view'] },
202
- proves: pkg && pkg.proves || null, doesNotProve: pkg && pkg.doesNotProve || null,
203
- assertions: ((pkg && pkg.assertions) || []).map((a) => ({ id: a.id, text: a.text, status: a.status, evidence: a.evidence || [], reason: a.reason || null })),
204
- unknowns,
205
- findings: findings.map((f) => ({ id: f.id, evidenceHash: f.evidenceHash, status: f.status, confidence: f.confidence, proofTier: f.proofTier, fixEvidence: f.fix ? f.fix.evidenceHash : null })),
206
- policyDecisions: (pkg && pkg.policy && pkg.policy.decisions) || [],
207
- };
208
- return { canonical: findings, developer, ciso, auditor };
209
- }
210
-
211
- // ---- text ------------------------------------------------------------------------------------------------------------------------
212
-
213
- function renderText(views, view = 'all') {
214
- const L = [];
215
- const dev = () => { L.push('DEVELOPER VIEW'); for (const f of views.developer) { L.push(` [${f.severity}] ${f.title} ${f.where.file ?? '?'}:${f.where.line ?? '?'} id=${f.id} status=${f.status} confidence=${f.confidence} evidence=${f.evidenceHash.slice(0, 19)}`); if (f.why) L.push(` why: ${String(f.why).slice(0, 300)}`); if (f.how) L.push(` fix: ${String(f.how).slice(0, 300)}`); if (f.fix) L.push(` fix check: ${f.fix.verifiedFull ? 'verified' : 'not fully verified'}${f.fix.degradedLegs.length ? ` (not passed: ${f.fix.degradedLegs.join(', ')})` : ''}`); } if (!views.developer.length) L.push(' no findings'); };
216
- const ciso = () => { const c = views.ciso; L.push('CISO VIEW'); L.push(` release verdict: ${c.verdict.verdict}. ${c.verdict.statement}`); for (const b of c.verdict.blockers) L.push(` blocks: ${b}`); for (const u of c.verdict.unknowns) L.push(` unknown: ${u}`); L.push(` scan: ${c.scan.verdict} (${c.scan.scanStatus})${c.scan.conditions.length ? ' - ' + c.scan.conditions.join('; ') : ''}`); L.push(` proven: ${c.proven.executionProven} executed, ${c.proven.taintProven} taint path, ${c.proven.unproven} unproven, of ${c.proven.total}`); L.push(` fixes: ${c.fixes.verified} verified, ${c.fixes.unverified} unverified, ${c.fixes.open} open`); if (c.changeSinceLast) L.push(` since last release: ${c.changeSinceLast.new.length} new, ${c.changeSinceLast.resolved.length} resolved, ${c.changeSinceLast.statusChanged.length} changed status`); else L.push(' since last release: no previous release was supplied'); if (c.risk) L.push(` risk: ${JSON.stringify(c.risk.byPriority)}; ${c.risk.incompleteCoverage} with incomplete coverage`); L.push(` verification: ${c.verified === null ? 'not performed here' : c.verified ? 'signature and contents verified' : 'FAILED'}`); };
217
- const aud = () => { const a = views.auditor; L.push('AUDITOR VIEW'); L.push(` snapshot: ${a.package.snapshot ? `${a.package.snapshot.commit ?? 'no commit'} (${a.package.snapshot.immutable ? 'immutable' : 'NOT immutable'})` : 'none'}`); L.push(` issuer: ${a.issuer ? `${a.issuer.trustBasis}, independently certified: ${a.issuer.independentlyCertified}` : 'none'}`); L.push(` verification: ${a.verification.ok === null ? 'not performed here' : a.verification.ok ? 'ok' : 'FAILED: ' + a.verification.errors.join('; ')}`); for (const x of a.assertions) L.push(` assertion ${x.id} [${x.status}]: ${x.text} evidence=${x.evidence.map((d) => d.slice(0, 19)).join(',') || 'none'}`); for (const u of a.unknowns) L.push(` unknown: ${u.about} - ${u.reason}`); L.push(` does not prove: ${a.doesNotProve}`); };
218
- if (view === 'developer' || view === 'all') dev();
219
- if (view === 'ciso' || view === 'all') ciso();
220
- if (view === 'auditor' || view === 'all') aud();
221
- return L.join('\n') + '\n';
222
- }
223
-
224
- // ---- html ------------------------------------------------------------------------------------------------------------------------
225
-
226
- /** One self-contained page, no script, nothing loaded from elsewhere. Every value is escaped. */
227
- function renderHtml(views, { title = 'Release assurance report' } = {}) {
228
- const c = views.ciso; const a = views.auditor;
229
- const row = (f, cols) => `<tr data-finding="${esc(f.id)}" data-evidence="${esc(f.evidenceHash)}" data-status="${esc(f.status)}" data-confidence="${esc(f.confidence)}">${cols.map((x) => `<td>${x}</td>`).join('')}</tr>`;
230
- return `<!doctype html>
231
- <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
232
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:">
233
- <title>${esc(title)}</title>
234
- <style>
235
- :root{--bg:#fff;--fg:#1a1a1a;--muted:#555;--line:#d0d0d0;--bad:#a40000;--ok:#0a6b2b}
236
- @media (prefers-color-scheme: dark){:root{--bg:#14161a;--fg:#e8e8e8;--muted:#a0a0a0;--line:#3a3d44;--bad:#ff8080;--ok:#6fd48e}}
237
- body{background:var(--bg);color:var(--fg);font:15px/1.5 system-ui,sans-serif;margin:0 auto;max-width:72rem;padding:1rem 16px}
238
- h1,h2{line-height:1.2}table{border-collapse:collapse;width:100%;overflow-wrap:anywhere}th,td{border:1px solid var(--line);padding:.35rem .5rem;text-align:left;vertical-align:top}
239
- code{font-family:ui-monospace,monospace;font-size:.9em}.muted{color:var(--muted)}.bad{color:var(--bad)}.ok{color:var(--ok)}details{margin:1rem 0}summary{cursor:pointer;font-weight:600}
240
- </style></head><body>
241
- <h1>${esc(title)}</h1>
242
- <p class="muted">Snapshot ${esc(a.package.snapshot ? a.package.snapshot.commit : 'none')} (${a.package.snapshot && a.package.snapshot.immutable ? 'immutable' : 'not immutable'}). Verification: <span class="${a.verification.ok === true ? 'ok' : 'bad'}">${esc(a.verification.ok === null ? 'not performed by this page' : a.verification.ok ? 'passed' : 'FAILED')}</span>.</p>
243
- <details open><summary>Developer: where, why, how to fix</summary>
244
- <table><thead><tr><th>Finding</th><th>Where</th><th>Why</th><th>How to fix</th><th>Status</th><th>Confidence</th></tr></thead><tbody>
245
- ${views.developer.map((f) => row(f, [`<code>${esc(f.id)}</code> ${esc(f.title)}<br><span class="muted">${esc(f.severity)}${f.cwe ? ' ' + esc(f.cwe) : ''}</span>`, `<code>${esc(f.where.file ?? '?')}:${esc(f.where.line ?? '?')}</code>`, esc(f.why ?? ''), esc(f.how ?? ''), esc(f.status), esc(f.confidence)])).join('\n') || '<tr><td colspan="6">No findings.</td></tr>'}
246
- </tbody></table></details>
247
- <details open><summary>CISO: what is proven, what changed, risk and coverage</summary>
248
- <p><strong>Release verdict: ${esc(c.verdict.verdict)}.</strong> ${esc(c.verdict.statement)}</p>
249
- <ul>${c.verdict.blockers.map((b) => `<li class="bad">Blocks: ${esc(b)}</li>`).join('')}${c.verdict.unknowns.map((u) => `<li>Unknown: ${esc(u)}</li>`).join('')}</ul>
250
- <p>Scan: <strong>${esc(c.scan.verdict)}</strong> (${esc(c.scan.scanStatus)}). ${c.scan.conditions.map((x) => esc(x)).join('; ')}</p>
251
- <p>Proven: ${esc(c.proven.executionProven)} by execution, ${esc(c.proven.taintProven)} by a taint path, ${esc(c.proven.unproven)} unproven, of ${esc(c.proven.total)}. Fixes: ${esc(c.fixes.verified)} verified, ${esc(c.fixes.unverified)} unverified, ${esc(c.fixes.open)} open.</p>
252
- <p>${c.changeSinceLast ? `Since the previous release: ${esc(c.changeSinceLast.new.length)} new, ${esc(c.changeSinceLast.resolved.length)} resolved, ${esc(c.changeSinceLast.statusChanged.length)} changed status.` : 'No previous release was supplied, so no change is reported.'}</p>
253
- <table><thead><tr><th>Finding</th><th>Severity</th><th>Proof</th><th>Priority</th><th>Status</th><th>Confidence</th></tr></thead><tbody>
254
- ${c.findings.map((f) => row(f, [`<code>${esc(f.id)}</code>`, esc(f.severity), esc(f.proofTier), esc(f.priority ?? 'not ranked'), esc(f.status), esc(f.confidence)])).join('\n') || '<tr><td colspan="6">No findings.</td></tr>'}
255
- </tbody></table></details>
256
- <details open><summary>Auditor: evidence behind each statement, and what is unknown</summary>
257
- <p>Issuer: ${esc(a.issuer ? a.issuer.trustBasis : 'none')}; independently certified: ${esc(a.issuer ? a.issuer.independentlyCertified : 'n/a')}.</p>
258
- <p class="muted">Proves: ${esc(a.proves)}<br>Does not prove: ${esc(a.doesNotProve)}</p>
259
- <table><thead><tr><th>Finding</th><th>Evidence hash</th><th>Fix evidence</th><th>Status</th><th>Confidence</th></tr></thead><tbody>
260
- ${a.findings.map((f) => row(f, [`<code>${esc(f.id)}</code>`, `<code>${esc(f.evidenceHash)}</code>`, `<code>${esc(f.fixEvidence ?? 'none')}</code>`, esc(f.status), esc(f.confidence)])).join('\n') || '<tr><td colspan="5">No findings.</td></tr>'}
261
- </tbody></table>
262
- <h2>Assertions</h2><ul>${a.assertions.map((x) => `<li><strong>${esc(x.status)}</strong>: ${esc(x.text)} <span class="muted">(${x.evidence.length ? x.evidence.map((d) => `<code>${esc(d)}</code>`).join(', ') : 'no evidence cited'}${x.reason ? '; ' + esc(x.reason) : ''})</span></li>`).join('') || '<li>None.</li>'}</ul>
263
- <h2>Unknowns</h2><ul>${a.unknowns.map((u) => `<li>${esc(u.about)}: ${esc(u.reason)}</li>`).join('') || '<li>None.</li>'}</ul>
264
- </details></body></html>
265
- `;
266
- }
267
-
268
-
269
- /***/ })
270
-
271
- };
@@ -1,23 +0,0 @@
1
- export const id = 1437;
2
- export const ids = [1437];
3
- export const modules = {
4
-
5
- /***/ 1437:
6
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
-
8
- __webpack_require__.r(__webpack_exports__);
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ BaseJavaCstVisitor: () => (/* reexport safe */ _node_modules_java_parser_src_index_js__WEBPACK_IMPORTED_MODULE_0__.ak),
11
- /* harmony export */ BaseJavaCstVisitorWithDefaults: () => (/* reexport safe */ _node_modules_java_parser_src_index_js__WEBPACK_IMPORTED_MODULE_0__.C5),
12
- /* harmony export */ "default": () => (/* reexport safe */ _node_modules_java_parser_src_index_js__WEBPACK_IMPORTED_MODULE_0__.Ay),
13
- /* harmony export */ lexAndParse: () => (/* reexport safe */ _node_modules_java_parser_src_index_js__WEBPACK_IMPORTED_MODULE_0__.Ch),
14
- /* harmony export */ parse: () => (/* reexport safe */ _node_modules_java_parser_src_index_js__WEBPACK_IMPORTED_MODULE_0__.qg)
15
- /* harmony export */ });
16
- /* harmony import */ var _node_modules_java_parser_src_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6818);
17
-
18
-
19
-
20
-
21
- /***/ })
22
-
23
- };
@@ -1,110 +0,0 @@
1
- export const id = 1445;
2
- export const ids = [1445];
3
- export const modules = {
4
-
5
- /***/ 41445:
6
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
-
8
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
- /* harmony export */ deriveVexStatus: () => (/* binding */ deriveVexStatus)
10
- /* harmony export */ });
11
- /* unused harmony export VEX_STATUSES */
12
- // PRD 5 P0 §8 — VEX (Vulnerability Exploitability eXchange). Statuses are the
13
- // PRD's own four. The PRD's one explicit rule — "`not affected` requires
14
- // positive evidence" — is enforced structurally: `not_affected` is only ever
15
- // returned from one of two named, checked evidence paths below; there is no
16
- // code path that reaches it by default or by absence of information.
17
- // Justification strings follow the CISA VEX vocabulary this repo's other VEX
18
- // output (`toVex` in `src/posture/sbom.js`'s neighborhood) already uses,
19
- // where applicable.
20
- //
21
- // `affected` likewise requires positive evidence (confirmed reachability),
22
- // not just "OSV lists this version as vulnerable" — a scanner result alone
23
- // only tells you the CVE/version pair matches; it doesn't tell you the
24
- // vulnerable code path is reachable in THIS artifact. Absent that
25
- // confirmation, the honest status is `under_investigation`, never a
26
- // confident `affected` the evidence doesn't support.
27
- const VEX_STATUSES = Object.freeze(['affected', 'not_affected', 'fixed', 'under_investigation']);
28
-
29
- // Loose dotted-numeric version comparison. Returns -1/0/1, or null when
30
- // either side isn't a clean dotted-numeric form — a "fixed" verdict is only
31
- // ever returned when this does NOT return null; an unparseable version
32
- // means that evidence path is skipped, never guessed through.
33
- function compareVersions(a, b) {
34
- const pa = String(a).split(/[.-]/).map((s) => (/^\d+$/.test(s) ? parseInt(s, 10) : null));
35
- const pb = String(b).split(/[.-]/).map((s) => (/^\d+$/.test(s) ? parseInt(s, 10) : null));
36
- if (pa.some((n) => n === null) || pb.some((n) => n === null)) return null;
37
- const len = Math.max(pa.length, pb.length);
38
- for (let i = 0; i < len; i++) {
39
- const x = pa[i] ?? 0;
40
- const y = pb[i] ?? 0;
41
- if (x !== y) return x < y ? -1 : 1;
42
- }
43
- return 0;
44
- }
45
-
46
- function componentKeyOf(c) {
47
- return c.purl || (c.ecosystem && c.name && c.version ? `${c.ecosystem}:${c.name}@${c.version}` : null);
48
- }
49
-
50
- /**
51
- * `vulnerability` is one `vulnerable_dep`-shaped entry already confirmed
52
- * present via `vuln-correlate.js` against THIS artifact. `artifactComponents`
53
- * is the artifact's own inventory (`osPackages`/`appPackages` concatenated).
54
- * `reachability`, if supplied, is `{ reachable: true|false, reason }` from
55
- * this codebase's existing dataflow/reachability evidence (never computed
56
- * here — this module does no new analysis, only statuses the evidence it's
57
- * handed).
58
- */
59
- function deriveVexStatus({ vulnerability, artifactComponents, reachability = null }) {
60
- if (!vulnerability || typeof vulnerability !== 'object') {
61
- throw new TypeError('deriveVexStatus requires a vulnerability object');
62
- }
63
- if (!Array.isArray(artifactComponents)) {
64
- throw new TypeError('deriveVexStatus requires an artifactComponents array');
65
- }
66
-
67
- const vulnKey = vulnerability.purl
68
- || (vulnerability.ecosystem && vulnerability.name && vulnerability.version ? `${vulnerability.ecosystem}:${vulnerability.name}@${vulnerability.version}` : null);
69
- const present = vulnKey != null && artifactComponents.some((c) => componentKeyOf(c) === vulnKey);
70
-
71
- if (!present) {
72
- return {
73
- status: 'not_affected',
74
- justification: 'component_not_present',
75
- evidence: 'the affected component (by purl/ecosystem+name+version) is not present in this artifact\'s inventory',
76
- };
77
- }
78
-
79
- if (reachability && reachability.reachable === false) {
80
- return {
81
- status: 'not_affected',
82
- justification: 'vulnerable_code_not_in_execute_path',
83
- evidence: reachability.reason || 'static reachability analysis found no path to the vulnerable function in this artifact',
84
- };
85
- }
86
-
87
- if (Array.isArray(vulnerability.fixedVersions) && vulnerability.fixedVersions.length && vulnerability.version) {
88
- for (const fv of vulnerability.fixedVersions) {
89
- const cmp = compareVersions(vulnerability.version, fv);
90
- if (cmp !== null && cmp >= 0) {
91
- return { status: 'fixed', justification: null, evidence: `installed version ${vulnerability.version} is >= the fixed version ${fv}` };
92
- }
93
- }
94
- }
95
-
96
- if (reachability && reachability.reachable === true) {
97
- return { status: 'affected', justification: null, evidence: reachability.reason || 'static reachability analysis confirmed a path to the vulnerable function in this artifact' };
98
- }
99
-
100
- return {
101
- status: 'under_investigation',
102
- justification: null,
103
- evidence: 'the affected component is present and not confirmed fixed, but reachability has not been established — not a confident "affected" claim',
104
- };
105
- }
106
-
107
-
108
- /***/ })
109
-
110
- };