@clear-capabilities/agentic-security-scanner 0.80.0 → 0.84.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 (57) hide show
  1. package/dist/178.index.js +1 -1
  2. package/dist/384.index.js +1 -1
  3. package/dist/637.index.js +1 -1
  4. package/dist/838.index.js +1 -1
  5. package/dist/839.index.js +170 -0
  6. package/dist/985.index.js +51 -1
  7. package/dist/agentic-security.mjs +83 -83
  8. package/dist/agentic-security.mjs.sha256 +1 -1
  9. package/package.json +3 -3
  10. package/src/.agentic-security/findings.json +21283 -8189
  11. package/src/.agentic-security/last-scan.json +21283 -8189
  12. package/src/.agentic-security/last-scan.json.sig +1 -1
  13. package/src/.agentic-security/scan-history.json +512 -128
  14. package/src/.agentic-security/streak.json +3 -3
  15. package/src/engine.js +41 -0
  16. package/src/mcp/.agentic-security/findings.json +4 -4
  17. package/src/mcp/.agentic-security/last-scan.json +4 -4
  18. package/src/mcp/.agentic-security/last-scan.json.sig +1 -1
  19. package/src/mcp/.agentic-security/scan-history.json +188 -0
  20. package/src/mcp/.agentic-security/streak.json +5 -5
  21. package/src/mcp/tools.js +51 -1
  22. package/src/posture/.agentic-security/findings.json +17234 -4057
  23. package/src/posture/.agentic-security/last-scan.json +17234 -4057
  24. package/src/posture/.agentic-security/last-scan.json.sig +1 -1
  25. package/src/posture/.agentic-security/scan-history.json +1942 -200
  26. package/src/posture/.agentic-security/streak.json +3 -3
  27. package/src/posture/auditor-walkthrough.js +252 -0
  28. package/src/posture/claude-authorship.js +197 -0
  29. package/src/posture/compliance-frameworks/.agentic-security/findings.json +80 -0
  30. package/src/posture/compliance-frameworks/.agentic-security/last-scan.json +80 -0
  31. package/src/posture/compliance-frameworks/.agentic-security/last-scan.json.sig +1 -0
  32. package/src/posture/compliance-frameworks/.agentic-security/scan-history.json +90 -0
  33. package/src/posture/compliance-frameworks/.agentic-security/streak.json +22 -0
  34. package/src/posture/compliance-frameworks/ccpa.json +32 -0
  35. package/src/posture/compliance-frameworks/eu-ai-act.json +51 -0
  36. package/src/posture/compliance-frameworks/gdpr.json +45 -0
  37. package/src/posture/compliance-frameworks/hipaa-security-rule.json +56 -0
  38. package/src/posture/compliance-frameworks/nist-ai-600-1.json +51 -0
  39. package/src/posture/compliance-frameworks/nist-csf-2.json +73 -0
  40. package/src/posture/compliance-frameworks/owasp-asvs-5.json +79 -0
  41. package/src/posture/compliance-frameworks/owasp-llm-top-10.json +69 -0
  42. package/src/posture/cross-repo-memory.js +180 -0
  43. package/src/posture/dep-add-guard.js +197 -0
  44. package/src/posture/findings-memory.js +152 -0
  45. package/src/posture/fix-style-mirror.js +118 -0
  46. package/src/posture/git-history.js +141 -0
  47. package/src/posture/intent-context.js +175 -0
  48. package/src/posture/model-rescan.js +76 -0
  49. package/src/posture/pattern-propagation.js +39 -0
  50. package/src/posture/pr-augment.js +234 -0
  51. package/src/posture/risk-dollars.js +158 -0
  52. package/src/posture/threat-model-grounding.js +169 -0
  53. package/src/posture/time-to-fix.js +129 -0
  54. package/src/posture/triage-memory.js +151 -0
  55. package/src/posture/triage.js +15 -1
  56. package/src/posture/watch-mode.js +171 -0
  57. package/src/posture/workflow-installer.js +231 -0
package/dist/178.index.js CHANGED
@@ -13,7 +13,7 @@ export const modules = {
13
13
  /* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1421);
14
14
  /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3024);
15
15
  /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6760);
16
- /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9072);
16
+ /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2271);
17
17
  // Time-travel + counterfactual scanning (v0.68).
18
18
  //
19
19
  // Two new modes that exploit the pure-input shape of runFullScan:
package/dist/384.index.js CHANGED
@@ -8,7 +8,7 @@ export const modules = {
8
8
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
9
  /* harmony export */ scanCredentials: () => (/* reexport safe */ _engine_js__WEBPACK_IMPORTED_MODULE_0__.Sv)
10
10
  /* harmony export */ });
11
- /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9072);
11
+ /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2271);
12
12
  // Secrets submodule view of the engine — credential + entropy + TODO scanning.
13
13
 
14
14
 
package/dist/637.index.js CHANGED
@@ -10,7 +10,7 @@ export const modules = {
10
10
  /* harmony export */ renderPrDeltaText: () => (/* binding */ renderPrDeltaText)
11
11
  /* harmony export */ });
12
12
  /* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1421);
13
- /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9072);
13
+ /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2271);
14
14
  // Shadowscan / security-DELTA on PR (v0.72).
15
15
  //
16
16
  // Most SAST PR-comment integrations show absolute counts — "12 findings
package/dist/838.index.js CHANGED
@@ -14,7 +14,7 @@ __webpack_require__.r(__webpack_exports__);
14
14
  /* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1421);
15
15
  /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3024);
16
16
  /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6760);
17
- /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9072);
17
+ /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2271);
18
18
  // Closed-loop /fix verification (Sentinel-parity FR-L4-4, FR-L4-5).
19
19
  //
20
20
  // Given a candidate patch (the new file content + the finding stableId being
@@ -0,0 +1,170 @@
1
+ export const id = 839;
2
+ export const ids = [839];
3
+ export const modules = {
4
+
5
+ /***/ 3839:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ queryFindingsMemory: () => (/* binding */ queryFindingsMemory)
10
+ /* harmony export */ });
11
+ /* unused harmony export _internals */
12
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
13
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6760);
14
+ // Findings memory — natural-language Q&A over the institutional knowledge
15
+ // the scanner has accumulated. Backs the MCP query_findings_memory tool.
16
+ //
17
+ // Sources searched, in this order:
18
+ //
19
+ // 1. .agentic-security/last-scan.json current findings
20
+ // 2. .agentic-security/triage-memory.jsonl past wont-fix / FP decisions
21
+ // 3. .agentic-security/scan-history/*.json prior scans
22
+ // 4. .agentic-security/AGENTS.md continual-learning narrative
23
+ //
24
+ // Naive keyword matching for v1. Each match has a `score` (count of query
25
+ // terms matched) and a `source` ('finding' | 'triage' | 'history' |
26
+ // 'agents-md'). Returns top-10 by score.
27
+
28
+
29
+
30
+
31
+ const STATE = '.agentic-security';
32
+
33
+ function _read(scanRoot, name) {
34
+ try { return node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(node_path__WEBPACK_IMPORTED_MODULE_1__.join(scanRoot, STATE, name), 'utf8'); } catch { return null; }
35
+ }
36
+
37
+ function _readJson(scanRoot, name) {
38
+ const raw = _read(scanRoot, name);
39
+ if (!raw) return null;
40
+ try { return JSON.parse(raw); } catch { return null; }
41
+ }
42
+
43
+ function _terms(query) {
44
+ return String(query || '').toLowerCase().split(/\s+/).filter(t => t.length >= 2);
45
+ }
46
+
47
+ function _score(haystack, terms) {
48
+ const lower = String(haystack || '').toLowerCase();
49
+ let s = 0;
50
+ for (const t of terms) if (lower.includes(t)) s++;
51
+ return s;
52
+ }
53
+
54
+ function _findingHaystack(f) {
55
+ return [f.vuln, f.family, f.file, f.severity, f.description, f.cwe, f.id]
56
+ .filter(Boolean).join(' | ');
57
+ }
58
+
59
+ function _truncate(s, n = 160) {
60
+ return String(s || '').replace(/\s+/g, ' ').slice(0, n);
61
+ }
62
+
63
+ /**
64
+ * Run a natural-language query over the scanner's accumulated memory.
65
+ */
66
+ function queryFindingsMemory(scanRoot, query) {
67
+ const terms = _terms(query);
68
+ if (!terms.length) return { results: [], count: 0 };
69
+
70
+ const results = [];
71
+
72
+ // 1. Current findings.
73
+ const scan = _readJson(scanRoot, 'last-scan.json');
74
+ if (scan && Array.isArray(scan.findings)) {
75
+ for (const f of scan.findings) {
76
+ const hay = _findingHaystack(f);
77
+ const score = _score(hay, terms);
78
+ if (!score) continue;
79
+ results.push({
80
+ source: 'finding',
81
+ score,
82
+ finding_id: f.id || null,
83
+ severity: f.severity,
84
+ family: f.family,
85
+ file: f.file,
86
+ line: f.line,
87
+ snippet: _truncate(f.vuln || f.description || f.family),
88
+ });
89
+ }
90
+ }
91
+
92
+ // 2. Triage memory (past decisions).
93
+ const triageRaw = _read(scanRoot, 'triage-memory.jsonl');
94
+ if (triageRaw) {
95
+ const lines = triageRaw.split('\n').filter(Boolean);
96
+ for (const ln of lines) {
97
+ let entry; try { entry = JSON.parse(ln); } catch { continue; }
98
+ const hay = [entry.decision, entry.reason, entry.family, entry.vuln, entry.file].join(' ');
99
+ const score = _score(hay, terms);
100
+ if (!score) continue;
101
+ results.push({
102
+ source: 'triage',
103
+ score,
104
+ decision: entry.decision,
105
+ at: entry.at,
106
+ family: entry.family,
107
+ snippet: _truncate(entry.reason || entry.vuln),
108
+ bucket: entry.bucket,
109
+ });
110
+ }
111
+ }
112
+
113
+ // 3. Scan history.
114
+ try {
115
+ const histDir = node_path__WEBPACK_IMPORTED_MODULE_1__.join(scanRoot, STATE, 'scan-history');
116
+ if (node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(histDir)) {
117
+ const files = node_fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(histDir).filter(f => f.endsWith('.json')).slice(-10);
118
+ for (const f of files) {
119
+ try {
120
+ const hist = JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(node_path__WEBPACK_IMPORTED_MODULE_1__.join(histDir, f), 'utf8'));
121
+ if (!Array.isArray(hist.findings)) continue;
122
+ for (const x of hist.findings.slice(0, 50)) {
123
+ const hay = _findingHaystack(x);
124
+ const score = _score(hay, terms);
125
+ if (!score) continue;
126
+ results.push({
127
+ source: 'history',
128
+ score,
129
+ from: f.replace(/\.json$/, ''),
130
+ severity: x.severity,
131
+ family: x.family,
132
+ file: x.file,
133
+ snippet: _truncate(x.vuln || x.description),
134
+ });
135
+ }
136
+ } catch {}
137
+ }
138
+ }
139
+ } catch {}
140
+
141
+ // 4. AGENTS.md narrative.
142
+ const agents = _read(scanRoot, 'AGENTS.md');
143
+ if (agents) {
144
+ const sections = agents.split(/^##\s+/m);
145
+ for (const sec of sections) {
146
+ const score = _score(sec, terms);
147
+ if (!score) continue;
148
+ const title = sec.split('\n')[0] || '';
149
+ results.push({
150
+ source: 'agents-md',
151
+ score,
152
+ title: _truncate(title, 80),
153
+ snippet: _truncate(sec.replace(title, ''), 200),
154
+ });
155
+ }
156
+ }
157
+
158
+ // Top-10 by score, ties broken by source priority (finding > triage >
159
+ // history > agents-md so live data wins).
160
+ const PRI = { finding: 4, triage: 3, history: 2, 'agents-md': 1 };
161
+ results.sort((a, b) => (b.score - a.score) || (PRI[b.source] - PRI[a.source]));
162
+ return { results: results.slice(0, 10), count: results.length };
163
+ }
164
+
165
+ const _internals = { _terms, _score, _findingHaystack };
166
+
167
+
168
+ /***/ })
169
+
170
+ };
package/dist/985.index.js CHANGED
@@ -1321,6 +1321,56 @@ const read_agents_memory = {
1321
1321
  },
1322
1322
  };
1323
1323
 
1324
+ // ─── query_triage_memory ───────────────────────────────────────────────────
1325
+ // Natural-language Q&A over past triage decisions (wont-fix / false-positive
1326
+ // markings + reasons). Backed by .agentic-security/triage-memory.jsonl, which
1327
+ // is auto-populated by triage.transition(). Returns at most 10 most-relevant
1328
+ // past decisions.
1329
+
1330
+ const query_triage_memory = {
1331
+ name: 'query_triage_memory',
1332
+ description: 'Search past triage decisions (wont-fix / false-positive) by natural-language query. Returns up to 10 most-relevant past decisions with their reasons. Use when you see a new finding and want to know "did we already decide on something like this?" — answers in seconds without re-reading the full AGENTS.md narrative.',
1333
+ inputSchema: {
1334
+ type: 'object',
1335
+ additionalProperties: false,
1336
+ properties: {
1337
+ query: { type: 'string', description: 'Free-text terms to match against past reasons / vuln text / file paths / family names.' },
1338
+ },
1339
+ },
1340
+ async handler({ query }, ctx) {
1341
+ const { queryMemory } = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 1905));
1342
+ const results = queryMemory(ctx.sessionRoot, query || '');
1343
+ return {
1344
+ _meta: META,
1345
+ count: results.length,
1346
+ results,
1347
+ };
1348
+ },
1349
+ };
1350
+
1351
+ // ─── query_findings_memory ─────────────────────────────────────────────────
1352
+ // Natural-language Q&A across the scanner's accumulated institutional
1353
+ // memory: current findings + past triage decisions + scan history +
1354
+ // AGENTS.md narrative. Use to answer "have we seen something like this
1355
+ // before?" without reading multiple files.
1356
+
1357
+ const query_findings_memory = {
1358
+ name: 'query_findings_memory',
1359
+ description: 'Search the scanner accumulated memory (current scan findings + past wont-fix/false-positive decisions + scan history + AGENTS.md narrative) by natural-language terms. Returns top-10 results scored by term-match count and ranked finding > triage > history > AGENTS.md.',
1360
+ inputSchema: {
1361
+ type: 'object',
1362
+ additionalProperties: false,
1363
+ properties: {
1364
+ query: { type: 'string', description: 'Natural-language search terms (2+ chars each).' },
1365
+ },
1366
+ required: ['query'],
1367
+ },
1368
+ async handler({ query }, ctx) {
1369
+ const { queryFindingsMemory } = await __webpack_require__.e(/* import() */ 839).then(__webpack_require__.bind(__webpack_require__, 3839));
1370
+ return { _meta: META, ...queryFindingsMemory(ctx.sessionRoot, query || '') };
1371
+ },
1372
+ };
1373
+
1324
1374
  // ─── lookup_cve ────────────────────────────────────────────────────────────
1325
1375
  // LangChain harness-anatomy #8: bridge the knowledge-cutoff gap by exposing
1326
1376
  // the local OSV / KEV / EPSS cache as a structured tool. Read-only — never
@@ -1416,7 +1466,7 @@ const apply_sca_upgrade = {
1416
1466
  },
1417
1467
  };
1418
1468
 
1419
- const ALL_TOOLS = [scan_diff, query_taint, explain_finding, apply_fix, verify_fix, synthesize_fix, find_rule_module, append_scratchpad, read_scratchpad, append_agents_memory, read_agents_memory, lookup_cve, synthesize_sca_upgrade, apply_sca_upgrade];
1469
+ const ALL_TOOLS = [scan_diff, query_taint, explain_finding, apply_fix, verify_fix, synthesize_fix, find_rule_module, append_scratchpad, read_scratchpad, append_agents_memory, read_agents_memory, lookup_cve, synthesize_sca_upgrade, apply_sca_upgrade, query_triage_memory, query_findings_memory];
1420
1470
 
1421
1471
  ;// CONCATENATED MODULE: ./src/mcp/validate.js
1422
1472
  // Minimal JSON Schema validator — just the subset our tool schemas use.