@clear-capabilities/agentic-security-scanner 0.172.1 → 0.173.0

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 (194) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/bin/agentic-security.js +37 -0
  3. package/dist/119.index.js +197 -0
  4. package/dist/128.index.js +129 -0
  5. package/dist/1293.index.js +5689 -0
  6. package/dist/1351.index.js +133 -0
  7. package/dist/1387.index.js +271 -0
  8. package/dist/1437.index.js +23 -0
  9. package/dist/1445.index.js +110 -0
  10. package/dist/1505.index.js +151 -0
  11. package/dist/1557.index.js +293 -0
  12. package/dist/1621.index.js +311 -0
  13. package/dist/1751.index.js +160 -0
  14. package/dist/1765.index.js +727 -0
  15. package/dist/1861.index.js +690 -0
  16. package/dist/1898.index.js +116 -0
  17. package/dist/1906.index.js +433 -0
  18. package/dist/1920.index.js +1 -291
  19. package/dist/208.index.js +1631 -0
  20. package/dist/2199.index.js +0 -239
  21. package/dist/2223.index.js +159 -0
  22. package/dist/2530.index.js +152 -0
  23. package/dist/2565.index.js +116 -0
  24. package/dist/2574.index.js +127 -0
  25. package/dist/2620.index.js +345 -0
  26. package/dist/2773.index.js +98 -0
  27. package/dist/2775.index.js +32 -0
  28. package/dist/2966.index.js +171 -0
  29. package/dist/2972.index.js +87 -0
  30. package/dist/2991.index.js +131 -0
  31. package/dist/3063.index.js +833 -0
  32. package/dist/3075.index.js +227 -0
  33. package/dist/3121.index.js +297 -0
  34. package/dist/3314.index.js +263 -0
  35. package/dist/3480.index.js +1822 -0
  36. package/dist/3481.index.js +24 -0
  37. package/dist/3506.index.js +268 -0
  38. package/dist/3533.index.js +591 -0
  39. package/dist/3653.index.js +450 -0
  40. package/dist/3822.index.js +131 -0
  41. package/dist/3868.index.js +292 -0
  42. package/dist/3917.index.js +152 -0
  43. package/dist/3918.index.js +192 -0
  44. package/dist/4090.index.js +288 -0
  45. package/dist/4121.index.js +1190 -0
  46. package/dist/4142.index.js +0 -239
  47. package/dist/4336.index.js +436 -0
  48. package/dist/4387.index.js +532 -0
  49. package/dist/4413.index.js +302 -0
  50. package/dist/4476.index.js +4510 -0
  51. package/dist/4491.index.js +133 -0
  52. package/dist/4538.index.js +185 -0
  53. package/dist/4684.index.js +319 -0
  54. package/dist/4740.index.js +165 -0
  55. package/dist/4780.index.js +209 -0
  56. package/dist/4802.index.js +225 -0
  57. package/dist/4812.index.js +379 -0
  58. package/dist/4835.index.js +126 -0
  59. package/dist/494.index.js +226 -0
  60. package/dist/4991.index.js +549 -0
  61. package/dist/5199.index.js +305 -0
  62. package/dist/5216.index.js +109 -0
  63. package/dist/5439.index.js +301 -0
  64. package/dist/5443.index.js +97 -0
  65. package/dist/5496.index.js +377 -0
  66. package/dist/550.index.js +2 -1
  67. package/dist/5801.index.js +588 -0
  68. package/dist/5858.index.js +223 -0
  69. package/dist/5933.index.js +143 -0
  70. package/dist/601.index.js +23 -0
  71. package/dist/6173.index.js +273 -0
  72. package/dist/6291.index.js +1871 -0
  73. package/dist/6312.index.js +666 -0
  74. package/dist/634.index.js +16182 -0
  75. package/dist/644.index.js +87 -0
  76. package/dist/6508.index.js +283 -0
  77. package/dist/6560.index.js +645 -0
  78. package/dist/6576.index.js +422 -0
  79. package/dist/6579.index.js +271 -0
  80. package/dist/6745.index.js +305 -0
  81. package/dist/6818.index.js +21642 -0
  82. package/dist/6972.index.js +167 -0
  83. package/dist/6995.index.js +163 -0
  84. package/dist/7249.index.js +191 -0
  85. package/dist/7372.index.js +1197 -0
  86. package/dist/7546.index.js +541 -0
  87. package/dist/76.index.js +448 -0
  88. package/dist/7879.index.js +163 -0
  89. package/dist/8025.index.js +130 -0
  90. package/dist/8054.index.js +248 -0
  91. package/dist/8097.index.js +201 -0
  92. package/dist/8126.index.js +191 -0
  93. package/dist/8178.index.js +78 -0
  94. package/dist/818.index.js +212 -0
  95. package/dist/8382.index.js +93 -0
  96. package/dist/8408.index.js +261 -0
  97. package/dist/8540.index.js +174 -0
  98. package/dist/8635.index.js +802 -0
  99. package/dist/8688.index.js +410 -0
  100. package/dist/8699.index.js +779 -0
  101. package/dist/8891.index.js +457 -0
  102. package/dist/8916.index.js +885 -0
  103. package/dist/9146.index.js +170 -0
  104. package/dist/9168.index.js +841 -0
  105. package/dist/9292.index.js +369 -0
  106. package/dist/9382.index.js +135 -11
  107. package/dist/9422.index.js +866 -0
  108. package/dist/9440.index.js +453 -0
  109. package/dist/9479.index.js +152 -0
  110. package/dist/9481.index.js +220 -0
  111. package/dist/9539.index.js +100 -0
  112. package/dist/9547.index.js +103 -0
  113. package/dist/9560.index.js +41 -61
  114. package/dist/9692.index.js +90 -0
  115. package/dist/9800.index.js +213 -1
  116. package/dist/9899.index.js +138 -0
  117. package/dist/9981.index.js +206 -0
  118. package/dist/999.index.js +117 -0
  119. package/dist/agentic-security.mjs +27 -27
  120. package/dist/agentic-security.mjs.sha256 +1 -1
  121. package/package.json +28 -3
  122. package/src/context-intelligence/candidates.js +2 -1
  123. package/src/context-intelligence/capabilities.js +2 -1
  124. package/src/context-intelligence/cli.js +2 -0
  125. package/src/context-intelligence/config.js +3 -1
  126. package/src/context-intelligence/controls.js +49 -1
  127. package/src/context-intelligence/counterexample.js +200 -0
  128. package/src/context-intelligence/cross-route.js +111 -0
  129. package/src/context-intelligence/findings.js +166 -0
  130. package/src/context-intelligence/invariants.js +197 -0
  131. package/src/context-intelligence/queue.js +6 -1
  132. package/src/context-intelligence/reachability.js +2 -2
  133. package/src/context-intelligence/review.js +68 -4
  134. package/src/dataflow/access-paths.js +11 -0
  135. package/src/dataflow/analysis-limits.js +66 -0
  136. package/src/dataflow/engine.js +272 -20
  137. package/src/dataflow/service-edges.js +174 -0
  138. package/src/dataflow/summaries.js +7 -1
  139. package/src/discovery/judge.js +2 -1
  140. package/src/engine.js +82 -14
  141. package/src/fix/apply-fix-service.js +55 -8
  142. package/src/fix/batch-journal.js +84 -0
  143. package/src/fix/exploit-replay.js +51 -0
  144. package/src/fix/footprint.js +65 -0
  145. package/src/fix/patch-policy.js +49 -0
  146. package/src/fix/secret-persistence.js +39 -0
  147. package/src/fix/test-commands.js +84 -0
  148. package/src/fix/verification-adapters.js +97 -0
  149. package/src/fix/verification-record.js +243 -0
  150. package/src/fix/verify-patch.js +89 -0
  151. package/src/ir/CLAUDE.md +5 -0
  152. package/src/ir/callgraph.js +23 -1
  153. package/src/ir/module-resolver.js +315 -0
  154. package/src/ir/parser-js.js +21 -2
  155. package/src/ir/semantic-graph.js +245 -0
  156. package/src/lineage/build-attested-correlation.js +63 -0
  157. package/src/lineage/deployment-identity.js +76 -0
  158. package/src/mcp/tools.js +13 -34
  159. package/src/pipeline/canonical-output.js +64 -0
  160. package/src/pipeline/detector-runner.js +7 -0
  161. package/src/pipeline/scan-health.js +14 -0
  162. package/src/pipeline/supervised-analyzers.js +125 -0
  163. package/src/pipeline/supervised-child.js +17 -0
  164. package/src/pipeline/telemetry.js +79 -0
  165. package/src/posture/accuracy-scorecard.js +98 -9
  166. package/src/posture/artifact-registry.js +5 -0
  167. package/src/posture/assurance/evidence-registry.js +215 -0
  168. package/src/posture/assurance/release-package-verify.js +135 -0
  169. package/src/posture/assurance/release-package.js +118 -0
  170. package/src/posture/assurance/release-verdict.js +94 -0
  171. package/src/posture/assurance/waiver.js +200 -0
  172. package/src/posture/compliance-truth.js +100 -0
  173. package/src/posture/evaluation/scan-child.js +3 -1
  174. package/src/posture/evaluation/why-missed.js +3 -1
  175. package/src/posture/exploitability-evidence.js +141 -0
  176. package/src/posture/fix-verify.js +4 -2
  177. package/src/posture/fleet/exposure-ranking.js +115 -0
  178. package/src/posture/fleet/service-chain-graph.js +150 -0
  179. package/src/posture/graph-reconciliation.js +154 -0
  180. package/src/posture/provenance/coverage.js +103 -0
  181. package/src/posture/provenance/git-evidence.js +84 -0
  182. package/src/posture/provenance/origin-resolver.js +7 -1
  183. package/src/posture/provenance/predicate-replay.js +14 -4
  184. package/src/posture/runtime-correlation.js +61 -15
  185. package/src/posture/runtime-explanation.js +116 -0
  186. package/src/posture/runtime-trace-ingest.js +194 -0
  187. package/src/posture/scan-checkpoint.js +38 -10
  188. package/src/posture/waf-ingest.js +7 -2
  189. package/src/report/index.js +4 -0
  190. package/src/report/oscal.js +38 -0
  191. package/src/report/perspectives.js +150 -0
  192. package/src/sast/_comment-strip.js +8 -1
  193. package/src/sast/ruby.js +26 -0
  194. package/src/util/string-memo.js +38 -0
@@ -0,0 +1,226 @@
1
+ export const id = 494;
2
+ export const ids = [494];
3
+ export const modules = {
4
+
5
+ /***/ 30494:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ computeRunAttestation: () => (/* binding */ computeRunAttestation),
10
+ /* harmony export */ verifyRunAttestation: () => (/* binding */ verifyRunAttestation)
11
+ /* harmony export */ });
12
+ /* unused harmony export ATTESTATION_CANONICALISATION */
13
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77598);
14
+ /* harmony import */ var _integrity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(37455);
15
+ // R4 — determinism as a contract.
16
+ //
17
+ // Determinism has been an implementation property of this engine (stable sorts,
18
+ // no Date.now() in ids, `--deterministic`) with no way for a third party to
19
+ // VERIFY it. This module turns it into something checkable: a stable digest
20
+ // over the finding set, bound to the engine version, ruleset version, and
21
+ // bundle hash that produced it.
22
+ //
23
+ // WHAT THE DIGEST IS INDEPENDENT OF (by construction):
24
+ // - the ORDER findings were emitted in (entries are canonicalised, then sorted)
25
+ // - run ids, timestamps, durations, and every other field not on the
26
+ // identity allowlist below — canonicalisation is an ALLOWLIST, not a
27
+ // denylist, so a new non-deterministic field cannot silently leak in
28
+ // - path separator style, and the absolute prefix when `root` is supplied
29
+ //
30
+ // WHAT IT IS NOT INDEPENDENT OF (all of these are real differences):
31
+ // - a changed severity, file, line, rule id, cwe, or vuln title
32
+ // - a finding appearing or disappearing (including a duplicate — multiplicity
33
+ // is preserved; two identical findings are not collapsed into one)
34
+ // - the engine version, ruleset version, or bundle sha
35
+ //
36
+ // WHAT THIS PROVES, AND WHAT IT DOES NOT (read before quoting it at anyone):
37
+ // PROVES — two finding sets carrying the same digest under the same
38
+ // canonicalisation are the same set of findings, modulo emission order and
39
+ // the excluded volatile fields; and (when signed) that the attestation was
40
+ // produced on an install holding this HMAC key.
41
+ // DOES NOT PROVE — cross-machine reproducibility. Nothing here demonstrates
42
+ // that a different host, OS, Node version, or toolchain produces the same
43
+ // finding set; several detectors are environment-sensitive (e.g. the Python
44
+ // AST path is used when python3 is available and falls back to regex when it
45
+ // is not, which can change what is found). Two runs on two machines agreeing
46
+ // would be evidence FOR reproducibility, but that experiment has not been
47
+ // run here and this module does not assert its outcome. The signature is a
48
+ // symmetric per-install HMAC, so it is tamper-evidence for the operator, not
49
+ // third-party non-repudiation.
50
+ //
51
+ // Identity fields deliberately EXCLUDE `parser` and `family`: `parser` records
52
+ // which analysis engine fired, which is environment-sensitive (see the python3
53
+ // case above), so including it would make the digest report an environment
54
+ // difference as a findings difference. The finding's identity — where it is
55
+ // and what it is — is fully captured without it.
56
+ //
57
+ // SIGNING: reuses `integrity.js`'s per-install HMAC key handling verbatim
58
+ // (`signLastScan`, keyed from $AGENTIC_SECURITY_HMAC_KEY or the 0600 key file
59
+ // at $XDG_CONFIG_HOME/agentic-security/scan-key). No second key mechanism is
60
+ // introduced. `integrity.verifyLastScan` is NOT reused because it verifies a
61
+ // body against a sibling `.sig` FILE; an attestation carries its signature
62
+ // inline, so verification re-signs and compares in constant time here.
63
+ //
64
+ // NO THROWING (posture/CLAUDE.md convention): malformed input yields an empty
65
+ // canonical set or an `{ok:false, reason}` refusal, never an exception.
66
+
67
+
68
+
69
+
70
+ const ATTESTATION_CANONICALISATION = 'agentic-security/run-attestation-canon-v1';
71
+
72
+ const PROVES =
73
+ 'Two finding sets with this digest, under this canonicalisation, are the same findings ' +
74
+ '(same rule id, severity, file, line, cwe, vuln, and multiplicity) produced by the same ' +
75
+ 'engine version, ruleset version, and bundle — regardless of emission order.';
76
+ const DOES_NOT_PROVE =
77
+ 'It does not prove cross-machine reproducibility: this attestation is one run on one machine, ' +
78
+ 'nothing here compares a second machine, OS, or Node version, and some detectors are ' +
79
+ 'environment-sensitive. That property is tested separately by the determinism-attest / ' +
80
+ 'determinism-compare CI jobs, which run the same commit on two operating systems and fail ' +
81
+ 'unless the digests match — evidence about the ENGINE, not about this attestation. ' +
82
+ 'A signature, when present, is a symmetric per-install HMAC — tamper-evidence for this ' +
83
+ 'install, not third-party non-repudiation.';
84
+
85
+ function _str(v) { return v === undefined || v === null ? '' : String(v); }
86
+
87
+ // Normalise a file path: separators to '/', drop a supplied absolute root,
88
+ // drop a leading './'. Everything else is left alone — guessing at a root we
89
+ // were not given would make two genuinely different files collide.
90
+ function _normPath(file, root) {
91
+ let p = _str(file).replace(/\\/g, '/');
92
+ if (root) {
93
+ let r = String(root).replace(/\\/g, '/').replace(/\/+$/, '');
94
+ if (r && p.startsWith(r + '/')) p = p.slice(r.length + 1);
95
+ else if (r && p === r) p = '';
96
+ }
97
+ return p.replace(/^\.\//, '');
98
+ }
99
+
100
+ /**
101
+ * The canonical, order-independent representation of a finding set: one
102
+ * tab-joined record per finding over the identity allowlist, sorted.
103
+ * Multiplicity is preserved (duplicates are NOT deduped).
104
+ */
105
+ function canonicaliseFindings(findings, { root } = {}) {
106
+ const list = Array.isArray(findings) ? findings : [];
107
+ const rows = [];
108
+ for (const f of list) {
109
+ if (!f || typeof f !== 'object') continue;
110
+ rows.push([
111
+ _str(f.id),
112
+ _str(f.severity),
113
+ _normPath(f.file, root),
114
+ _str(f.line),
115
+ _str(f.cwe),
116
+ _str(f.vuln),
117
+ ].join('\t'));
118
+ }
119
+ return rows.sort();
120
+ }
121
+
122
+ /**
123
+ * Compute the run attestation.
124
+ *
125
+ * @param {object[]} findings the finding set (any order)
126
+ * @param {string} engineVersion
127
+ * @param {string} rulesetVersion
128
+ * @param {string} bundleSha
129
+ * @param {string} [root] scan root, used to relativise absolute paths
130
+ * @param {boolean} [sign] attach a per-install HMAC over the digest
131
+ */
132
+ function computeRunAttestation({
133
+ findings, engineVersion, rulesetVersion, bundleSha, root, sign = false,
134
+ } = {}) {
135
+ const entries = canonicaliseFindings(findings, { root });
136
+ const payload = JSON.stringify({
137
+ canonicalisation: ATTESTATION_CANONICALISATION,
138
+ engineVersion: _str(engineVersion),
139
+ rulesetVersion: _str(rulesetVersion),
140
+ bundleSha: _str(bundleSha),
141
+ findingCount: entries.length,
142
+ entries,
143
+ });
144
+ const digest = node_crypto__WEBPACK_IMPORTED_MODULE_0__.createHash('sha256').update(payload).digest('hex');
145
+ const att = {
146
+ digest,
147
+ algorithm: 'sha256',
148
+ findingCount: entries.length,
149
+ engineVersion: _str(engineVersion),
150
+ rulesetVersion: _str(rulesetVersion),
151
+ bundleSha: _str(bundleSha),
152
+ canonicalisation: ATTESTATION_CANONICALISATION,
153
+ proves: PROVES,
154
+ doesNotProve: DOES_NOT_PROVE,
155
+ };
156
+ if (sign) {
157
+ try {
158
+ att.signature = (0,_integrity_js__WEBPACK_IMPORTED_MODULE_1__/* .signLastScan */ .lU)(digest);
159
+ att.signatureScope = 'per-install-hmac';
160
+ // CORE-003.AC03: say plainly who vouches. A symmetric install HMAC can be
161
+ // produced by anyone who can verify it, so it is self-issued by
162
+ // construction and can never be third-party certification.
163
+ att.trustBasis = 'self-issued-local-key';
164
+ att.independentlyCertified = false;
165
+ } catch { /* signing is best-effort; an unsigned attestation is still valid */ }
166
+ }
167
+ return att;
168
+ }
169
+
170
+ /**
171
+ * Re-derive the attestation from a finding set and compare.
172
+ * @returns {{ok: boolean, reason: string}}
173
+ */
174
+ function verifyRunAttestation(attestation, inputs = {}) {
175
+ if (!attestation || typeof attestation !== 'object') {
176
+ return { ok: false, reason: 'no attestation supplied' };
177
+ }
178
+ if (attestation.canonicalisation !== ATTESTATION_CANONICALISATION) {
179
+ return {
180
+ ok: false,
181
+ reason: `unknown canonicalisation "${_str(attestation.canonicalisation)}" — ` +
182
+ `this build verifies "${ATTESTATION_CANONICALISATION}" only`,
183
+ };
184
+ }
185
+ if (typeof attestation.digest !== 'string' || !/^[0-9a-f]{64}$/.test(attestation.digest)) {
186
+ return { ok: false, reason: 'attestation carries no sha256 digest' };
187
+ }
188
+ for (const k of ['engineVersion', 'rulesetVersion', 'bundleSha']) {
189
+ if (_str(inputs[k]) !== _str(attestation[k])) {
190
+ return { ok: false, reason: `${k} mismatch: attested "${_str(attestation[k])}", got "${_str(inputs[k])}"` };
191
+ }
192
+ }
193
+ const recomputed = computeRunAttestation({
194
+ findings: inputs.findings,
195
+ engineVersion: inputs.engineVersion,
196
+ rulesetVersion: inputs.rulesetVersion,
197
+ bundleSha: inputs.bundleSha,
198
+ root: inputs.root,
199
+ });
200
+ if (recomputed.findingCount !== attestation.findingCount) {
201
+ return {
202
+ ok: false,
203
+ reason: `finding count mismatch: attested ${attestation.findingCount}, got ${recomputed.findingCount}`,
204
+ };
205
+ }
206
+ if (recomputed.digest !== attestation.digest) {
207
+ return { ok: false, reason: 'digest mismatch — the finding set is not the one attested' };
208
+ }
209
+ if (attestation.signature) {
210
+ let expected;
211
+ try { expected = (0,_integrity_js__WEBPACK_IMPORTED_MODULE_1__/* .signLastScan */ .lU)(attestation.digest); }
212
+ catch { return { ok: false, reason: 'signature present but no key material available to check it' }; }
213
+ const a = Buffer.from(String(attestation.signature), 'hex');
214
+ const b = Buffer.from(expected, 'hex');
215
+ if (a.length !== b.length || !node_crypto__WEBPACK_IMPORTED_MODULE_0__.timingSafeEqual(a, b)) {
216
+ return { ok: false, reason: 'signature does not verify under this install key' };
217
+ }
218
+ return { ok: true, reason: 'digest and per-install signature verify' };
219
+ }
220
+ return { ok: true, reason: 'digest verifies (unsigned attestation)' };
221
+ }
222
+
223
+
224
+ /***/ })
225
+
226
+ };