@clear-capabilities/agentic-security-scanner 0.118.2 → 0.119.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.
- package/CHANGELOG.md +256 -0
- package/bin/agentic-security.js +78 -1
- package/dist/178.index.js +1 -1
- package/dist/384.index.js +1 -1
- package/dist/415.index.js +90 -0
- package/dist/444.index.js +89 -0
- package/dist/503.index.js +288 -0
- package/dist/637.index.js +15 -1
- package/dist/838.index.js +1 -1
- package/dist/985.index.js +5 -1
- package/dist/agentic-security.mjs +18 -18
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/package.json +13 -8
- package/src/dataflow/CLAUDE.md +1 -1
- package/src/dataflow/catalog.js +50 -11
- package/src/dataflow/engine.js +76 -1
- package/src/dataflow/implicit-flow.js +4 -2
- package/src/dataflow/index.js +9 -4
- package/src/dataflow/proof-gate.js +5 -0
- package/src/dataflow/summaries.js +19 -1
- package/src/engine.js +95 -7
- package/src/ir/parser-go.js +8 -0
- package/src/mcp/tools.js +6 -2
- package/src/posture/fix-history.js +24 -0
- package/src/posture/provenance.js +39 -0
- package/src/posture/sca-verdict.js +130 -0
- package/src/posture/secret-history.js +72 -0
- package/src/pr-delta.js +13 -0
- package/src/report/index.js +50 -0
- package/src/sast/agent-untrusted-flow.js +107 -0
- package/src/sast/api-authz.js +71 -0
- package/src/sast/cross-service.js +98 -0
- package/src/sast/event-entrypoint.js +90 -0
- package/src/sast/iac-terraform.js +107 -0
- package/src/sast/rbac-consistency.js +113 -0
- package/src/sast/wrong-context-sanitizer.js +55 -0
- package/src/sca/image-packages.js +74 -0
- package/src/sca/import-reachability.js +271 -0
- package/src/sca/install-script-analysis.js +82 -0
- package/bin/.agentic-security/findings.json +0 -1907
- package/bin/.agentic-security/last-scan.json +0 -1907
- package/bin/.agentic-security/last-scan.json.sig +0 -1
- package/bin/.agentic-security/scan-history.json +0 -166
- package/bin/.agentic-security/streak.json +0 -20
- package/src/.agentic-security/dpia.md +0 -26
- package/src/.agentic-security/findings.json +0 -117732
- package/src/.agentic-security/last-scan.json +0 -117732
- package/src/.agentic-security/last-scan.json.sig +0 -1
- package/src/.agentic-security/pqc-migration-plan.json +0 -80
- package/src/.agentic-security/pqc-migration-plan.md +0 -32
- package/src/.agentic-security/sbom-history/0775d96ba4cf814520d02760cfb3010760c7684f.json +0 -6
- package/src/.agentic-security/sbom-history/29300441d3460832137a8e51a92b74068cad2f15.json +0 -6
- package/src/.agentic-security/sbom-history/3852ad2aa0e50951bed0c930c29d1861aa13d048.json +0 -6
- package/src/.agentic-security/sbom-history/3d96e2daec97e3226c9679bac6e64a89ca10bfe9.json +0 -6
- package/src/.agentic-security/sbom-history/5f0b136622fce09b469a1a6137c04d5b18652ea4.json +0 -6
- package/src/.agentic-security/sbom-history/64e30595d447b62344d0d9200760269df2095332.json +0 -6
- package/src/.agentic-security/sbom-history/71f3241902c9e7437764e3caa046ba8a3bcdd32a.json +0 -6
- package/src/.agentic-security/sbom-history/99c372cdc33ecc9dde92960b4ffadf7775860e61.json +0 -6
- package/src/.agentic-security/sbom-history/9c93b15e8cf3ff2ddb8cdae92371b82e178b463c.json +0 -6
- package/src/.agentic-security/sbom-history/a3544abf1863d71776b61302ca74d9ead2b26a9f.json +0 -6
- package/src/.agentic-security/sbom-history/dca15abdec43c508aa342db86dc5db8d7f01fbbe.json +0 -6
- package/src/.agentic-security/scan-history.json +0 -12946
- package/src/.agentic-security/streak.json +0 -21
- package/src/.agentic-security/threat-model.json +0 -3702
- package/src/.agentic-security/threat-model.md +0 -118
- package/src/dataflow/.agentic-security/dpia.md +0 -26
- package/src/dataflow/.agentic-security/findings.json +0 -6086
- package/src/dataflow/.agentic-security/last-scan.json +0 -6086
- package/src/dataflow/.agentic-security/last-scan.json.sig +0 -1
- package/src/dataflow/.agentic-security/sbom-history/15d7c4d20f9d968ebec29445c9e9b3fc6f74e6a1.json +0 -6
- package/src/dataflow/.agentic-security/sbom-history/3852ad2aa0e50951bed0c930c29d1861aa13d048.json +0 -6
- package/src/dataflow/.agentic-security/sbom-history/73166872888d9ddcbe98645af818ecc7d8917b07.json +0 -6
- package/src/dataflow/.agentic-security/sbom-history/8869fe64035bec0152d92ece961e9369d8637076.json +0 -6
- package/src/dataflow/.agentic-security/sbom-history/9c93b15e8cf3ff2ddb8cdae92371b82e178b463c.json +0 -6
- package/src/dataflow/.agentic-security/sbom-history/b7ac2dada4a9216ccfe8969fc57f988c83f46975.json +0 -6
- package/src/dataflow/.agentic-security/scan-history.json +0 -250
- package/src/dataflow/.agentic-security/streak.json +0 -21
- package/src/dataflow/.agentic-security/threat-model.json +0 -161
- package/src/dataflow/.agentic-security/threat-model.md +0 -43
- package/src/ir/.agentic-security/dpia.md +0 -26
- package/src/ir/.agentic-security/exploit-bundles.json +0 -77
- package/src/ir/.agentic-security/findings.json +0 -4011
- package/src/ir/.agentic-security/last-scan.json +0 -4011
- package/src/ir/.agentic-security/last-scan.json.sig +0 -1
- package/src/ir/.agentic-security/sbom-history/73166872888d9ddcbe98645af818ecc7d8917b07.json +0 -6
- package/src/ir/.agentic-security/sbom-history/b5f468a158f6a145aedd8680841c106b9809f16b.json +0 -6
- package/src/ir/.agentic-security/scan-history.json +0 -193
- package/src/ir/.agentic-security/streak.json +0 -20
- package/src/ir/.agentic-security/threat-model.json +0 -143
- package/src/ir/.agentic-security/threat-model.md +0 -39
- package/src/mcp/.agentic-security/findings.json +0 -8632
- package/src/mcp/.agentic-security/last-scan.json +0 -8632
- package/src/mcp/.agentic-security/last-scan.json.sig +0 -1
- package/src/mcp/.agentic-security/scan-history.json +0 -331
- package/src/mcp/.agentic-security/streak.json +0 -20
- package/src/posture/.agentic-security/dpia.md +0 -26
- package/src/posture/.agentic-security/findings.json +0 -77181
- package/src/posture/.agentic-security/last-scan.json +0 -77181
- package/src/posture/.agentic-security/last-scan.json.sig +0 -1
- package/src/posture/.agentic-security/pqc-migration-plan.json +0 -65
- package/src/posture/.agentic-security/pqc-migration-plan.md +0 -30
- package/src/posture/.agentic-security/sbom-history/0724c133d2943c87555695b5b2adcfcfc3373a2d.json +0 -6
- package/src/posture/.agentic-security/sbom-history/7d45b5e03804aac084b4a2b4dc8c6f10107d2005.json +0 -6
- package/src/posture/.agentic-security/sbom-history/99c372cdc33ecc9dde92960b4ffadf7775860e61.json +0 -6
- package/src/posture/.agentic-security/sbom-history/b7ac2dada4a9216ccfe8969fc57f988c83f46975.json +0 -6
- package/src/posture/.agentic-security/scan-history.json +0 -8904
- package/src/posture/.agentic-security/streak.json +0 -21
- package/src/posture/.agentic-security/threat-model.json +0 -2038
- package/src/posture/.agentic-security/threat-model.md +0 -73
- package/src/posture/compliance-frameworks/.agentic-security/findings.json +0 -80
- package/src/posture/compliance-frameworks/.agentic-security/last-scan.json +0 -80
- package/src/posture/compliance-frameworks/.agentic-security/last-scan.json.sig +0 -1
- package/src/posture/compliance-frameworks/.agentic-security/scan-history.json +0 -90
- package/src/posture/compliance-frameworks/.agentic-security/streak.json +0 -22
- package/src/report/.agentic-security/dpia.md +0 -26
- package/src/report/.agentic-security/sbom-history/7d45b5e03804aac084b4a2b4dc8c6f10107d2005.json +0 -6
- package/src/report/.agentic-security/sbom-history/f94be839aa6a1011f53da016416a561698b8f338.json +0 -6
- package/src/report/.agentic-security/threat-model.json +0 -7
- package/src/report/.agentic-security/threat-model.md +0 -22
- package/src/sast/.agentic-security/dpia.md +0 -26
- package/src/sast/.agentic-security/findings.json +0 -6154
- package/src/sast/.agentic-security/last-scan.json +0 -6154
- package/src/sast/.agentic-security/last-scan.json.sig +0 -1
- package/src/sast/.agentic-security/pqc-migration-plan.json +0 -65
- package/src/sast/.agentic-security/pqc-migration-plan.md +0 -30
- package/src/sast/.agentic-security/sbom-history/043a7b401c68f5a298c83d4c42e94f118ff2a89a.json +0 -6
- package/src/sast/.agentic-security/sbom-history/0775d96ba4cf814520d02760cfb3010760c7684f.json +0 -6
- package/src/sast/.agentic-security/sbom-history/20d77ad7363a82777d506dedbbb1ecfed52f094a.json +0 -6
- package/src/sast/.agentic-security/sbom-history/29300441d3460832137a8e51a92b74068cad2f15.json +0 -6
- package/src/sast/.agentic-security/sbom-history/3852ad2aa0e50951bed0c930c29d1861aa13d048.json +0 -6
- package/src/sast/.agentic-security/sbom-history/3c6b3205f04e26f7654943d465281d00e0fa395e.json +0 -6
- package/src/sast/.agentic-security/sbom-history/3d96e2daec97e3226c9679bac6e64a89ca10bfe9.json +0 -6
- package/src/sast/.agentic-security/sbom-history/5282502e090013219eb006f7e02d8c983bc29c8e.json +0 -6
- package/src/sast/.agentic-security/sbom-history/5f0b136622fce09b469a1a6137c04d5b18652ea4.json +0 -6
- package/src/sast/.agentic-security/sbom-history/64e30595d447b62344d0d9200760269df2095332.json +0 -6
- package/src/sast/.agentic-security/sbom-history/71f3241902c9e7437764e3caa046ba8a3bcdd32a.json +0 -6
- package/src/sast/.agentic-security/sbom-history/73514b485d4770f3c5ee57d87338bccd1c61d8b7.json +0 -6
- package/src/sast/.agentic-security/sbom-history/96fa584fc3134512237d58aac63d6f3778b0cbcb.json +0 -6
- package/src/sast/.agentic-security/sbom-history/99c372cdc33ecc9dde92960b4ffadf7775860e61.json +0 -6
- package/src/sast/.agentic-security/sbom-history/a3544abf1863d71776b61302ca74d9ead2b26a9f.json +0 -6
- package/src/sast/.agentic-security/sbom-history/a4a34ab8b3d758de2adc8c3dc3e42d4cb0db00a3.json +0 -6
- package/src/sast/.agentic-security/sbom-history/ac236ec3602cfc8fb133f389ec3687e409084673.json +0 -6
- package/src/sast/.agentic-security/sbom-history/b57b3e1292f1f9f0de6c5a34a436e330c78008a3.json +0 -6
- package/src/sast/.agentic-security/sbom-history/dca15abdec43c508aa342db86dc5db8d7f01fbbe.json +0 -6
- package/src/sast/.agentic-security/sbom-history/dcbfd4935922dd165093c08a1003c338eed937c5.json +0 -6
- package/src/sast/.agentic-security/sbom-history/fa017f725615b0293814344c8ef7dfeb06775ca0.json +0 -6
- package/src/sast/.agentic-security/scan-history.json +0 -941
- package/src/sast/.agentic-security/streak.json +0 -22
- package/src/sast/.agentic-security/threat-model.json +0 -816
- package/src/sast/.agentic-security/threat-model.md +0 -91
- package/src/sca/.agentic-security/findings.json +0 -7460
- package/src/sca/.agentic-security/last-scan.json +0 -7460
- package/src/sca/.agentic-security/last-scan.json.sig +0 -1
- package/src/sca/.agentic-security/scan-history.json +0 -113
- package/src/sca/.agentic-security/streak.json +0 -21
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
export const id = 503;
|
|
2
|
+
export const ids = [503];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 9503:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
+
/* harmony export */ augmentReachabilityViaImports: () => (/* binding */ augmentReachabilityViaImports)
|
|
10
|
+
/* harmony export */ });
|
|
11
|
+
/* unused harmony exports languageOfFile, pkgMatches, extractJsImports, extractPyImports, extractImports, findImportAwareCallSites */
|
|
12
|
+
/* harmony import */ var _sast_comment_strip_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8455);
|
|
13
|
+
// R7 — import-aware SCA function-reachability (JS/TS + Python).
|
|
14
|
+
//
|
|
15
|
+
// The default reachability pass (engine.js#markUsedVulnFunctions) is a regex
|
|
16
|
+
// over `pkg.fn` / bare function names. It has two documented failure modes:
|
|
17
|
+
// - FALSE NEGATIVE on aliased / namespace imports:
|
|
18
|
+
// import { merge as deepMerge } from 'lodash'; deepMerge(a, b) // missed
|
|
19
|
+
// import * as _ from 'lodash'; _.merge(a, b) // member ok
|
|
20
|
+
// - FALSE POSITIVE on coincidental names: a bare `parse(` in a file that never
|
|
21
|
+
// imports the vulnerable package is matched anyway.
|
|
22
|
+
//
|
|
23
|
+
// This module parses the import statements of each JS/TS and Python file into an
|
|
24
|
+
// alias map, then finds call sites of a package's vulnerable functions resolved
|
|
25
|
+
// THROUGH that map and GATED to files that actually import the package. It does
|
|
26
|
+
// not decide `functionReachable` itself — it augments `vulnerableFunctionCallSites`
|
|
27
|
+
// so the existing route-reachability classifier (which distinguishes
|
|
28
|
+
// reachable / unreachable / unknown) sees the calls the regex missed.
|
|
29
|
+
//
|
|
30
|
+
// Other ecosystems keep the regex pass (this module is a no-op for them).
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const JS_RE = /\.(?:m|c)?[jt]sx?$/i;
|
|
35
|
+
const PY_RE = /\.py$/i;
|
|
36
|
+
|
|
37
|
+
function languageOfFile(file) {
|
|
38
|
+
if (JS_RE.test(file)) return 'js';
|
|
39
|
+
if (PY_RE.test(file)) return 'py';
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Normalize an import source to a package base name.
|
|
44
|
+
// '@scope/pkg/sub' -> '@scope/pkg' 'pkg/sub' -> 'pkg' (npm)
|
|
45
|
+
// 'pkg.sub.mod' -> 'pkg' (python)
|
|
46
|
+
function pkgBase(source, lang) {
|
|
47
|
+
let s = String(source || '').trim();
|
|
48
|
+
if (lang === 'py') return s.split('.')[0];
|
|
49
|
+
if (s.startsWith('@')) {
|
|
50
|
+
const parts = s.split('/');
|
|
51
|
+
return parts.slice(0, 2).join('/');
|
|
52
|
+
}
|
|
53
|
+
return s.split('/')[0];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Loose package-name equivalence. npm is case-sensitive; PyPI dist names differ
|
|
57
|
+
// from import names by case and -/_ (PyYAML→yaml is NOT covered — that needs a
|
|
58
|
+
// dist→import table; documented limitation).
|
|
59
|
+
function pkgMatches(depName, importedPkg, lang) {
|
|
60
|
+
if (!depName || !importedPkg) return false;
|
|
61
|
+
if (depName === importedPkg) return true;
|
|
62
|
+
if (lang === 'py') {
|
|
63
|
+
const norm = (x) => x.toLowerCase().replace(/[-_.]/g, '');
|
|
64
|
+
return norm(depName) === norm(importedPkg);
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Split a named-imports clause body ("a, b as c, default as d") into pairs.
|
|
70
|
+
function parseNamedClause(body) {
|
|
71
|
+
const out = [];
|
|
72
|
+
for (const raw of body.split(',')) {
|
|
73
|
+
const t = raw.trim();
|
|
74
|
+
if (!t) continue;
|
|
75
|
+
const m = t.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
76
|
+
if (m) out.push({ imported: m[1], local: m[2] });
|
|
77
|
+
else if (/^[A-Za-z_$][\w$]*$/.test(t)) out.push({ imported: t, local: t });
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Parse JS/TS imports into:
|
|
84
|
+
* named: Map<localName, { pkg, imported }>
|
|
85
|
+
* ns: Map<localName, pkg> (namespace/default whole-module binding)
|
|
86
|
+
* packages: Set<pkg>
|
|
87
|
+
* Handles ESM (named / default / namespace) and CJS require (destructure / whole).
|
|
88
|
+
*/
|
|
89
|
+
function extractJsImports(content) {
|
|
90
|
+
const code = (0,_sast_comment_strip_js__WEBPACK_IMPORTED_MODULE_0__/* .blankComments */ .$)(content);
|
|
91
|
+
const named = new Map();
|
|
92
|
+
const ns = new Map();
|
|
93
|
+
const packages = new Set();
|
|
94
|
+
const add = (pkg) => { if (pkg) packages.add(pkg); };
|
|
95
|
+
|
|
96
|
+
// ESM: import ... from 'pkg'
|
|
97
|
+
const esm = /\bimport\s+([^;'"]+?)\s+from\s*['"]([^'"]+)['"]/g;
|
|
98
|
+
let m;
|
|
99
|
+
while ((m = esm.exec(code))) {
|
|
100
|
+
const clause = m[1].trim();
|
|
101
|
+
const pkg = pkgBase(m[2], 'js');
|
|
102
|
+
add(pkg);
|
|
103
|
+
// namespace: * as ns
|
|
104
|
+
const nsM = clause.match(/\*\s+as\s+([A-Za-z_$][\w$]*)/);
|
|
105
|
+
if (nsM) ns.set(nsM[1], pkg);
|
|
106
|
+
// named: { ... }
|
|
107
|
+
const braceM = clause.match(/\{([^}]*)\}/);
|
|
108
|
+
if (braceM) for (const p of parseNamedClause(braceM[1])) named.set(p.local, { pkg, imported: p.imported });
|
|
109
|
+
// default: leading bare identifier (before any { or *)
|
|
110
|
+
const defM = clause.match(/^([A-Za-z_$][\w$]*)\s*(?:,|$)/);
|
|
111
|
+
if (defM && !nsM) ns.set(defM[1], pkg);
|
|
112
|
+
}
|
|
113
|
+
// CJS: const X = require('pkg') / const { a, b: c } = require('pkg')
|
|
114
|
+
const cjs = /(?:const|let|var)\s+(\{[^}]*\}|[A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
115
|
+
while ((m = cjs.exec(code))) {
|
|
116
|
+
const bind = m[1].trim();
|
|
117
|
+
const pkg = pkgBase(m[2], 'js');
|
|
118
|
+
add(pkg);
|
|
119
|
+
if (bind.startsWith('{')) {
|
|
120
|
+
// require destructure uses `orig: local`
|
|
121
|
+
for (const raw of bind.slice(1, -1).split(',')) {
|
|
122
|
+
const t = raw.trim(); if (!t) continue;
|
|
123
|
+
const mm = t.match(/^([A-Za-z_$][\w$]*)\s*:\s*([A-Za-z_$][\w$]*)$/);
|
|
124
|
+
if (mm) named.set(mm[2], { pkg, imported: mm[1] });
|
|
125
|
+
else if (/^[A-Za-z_$][\w$]*$/.test(t)) named.set(t, { pkg, imported: t });
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
ns.set(bind, pkg);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return { named, ns, packages };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Parse Python imports. Same return shape as extractJsImports.
|
|
136
|
+
* from pkg import a, b as c -> named: a->{pkg,a}, c->{pkg,b}
|
|
137
|
+
* from pkg.sub import a -> named: a->{pkg,a} (pkg base)
|
|
138
|
+
* import pkg / import pkg as p -> ns: pkg->pkg / p->pkg
|
|
139
|
+
*/
|
|
140
|
+
function extractPyImports(content) {
|
|
141
|
+
const code = (0,_sast_comment_strip_js__WEBPACK_IMPORTED_MODULE_0__/* .blankComments */ .$)(content);
|
|
142
|
+
const named = new Map();
|
|
143
|
+
const ns = new Map();
|
|
144
|
+
const packages = new Set();
|
|
145
|
+
|
|
146
|
+
const from = /^[ \t]*from\s+([A-Za-z_][\w.]*)\s+import\s+(.+)$/gm;
|
|
147
|
+
let m;
|
|
148
|
+
while ((m = from.exec(code))) {
|
|
149
|
+
const pkg = pkgBase(m[1], 'py');
|
|
150
|
+
packages.add(pkg);
|
|
151
|
+
let names = m[2].trim();
|
|
152
|
+
if (names === '*') continue;
|
|
153
|
+
names = names.replace(/[()]/g, '');
|
|
154
|
+
for (const p of parseNamedClause(names)) named.set(p.local, { pkg, imported: p.imported });
|
|
155
|
+
}
|
|
156
|
+
const imp = /^[ \t]*import\s+(.+)$/gm;
|
|
157
|
+
while ((m = imp.exec(code))) {
|
|
158
|
+
if (/^\s*import\s+/.test(m[0]) && /\bfrom\b/.test(m[0])) continue;
|
|
159
|
+
for (const raw of m[1].split(',')) {
|
|
160
|
+
const t = raw.trim(); if (!t) continue;
|
|
161
|
+
const mm = t.match(/^([A-Za-z_][\w.]*)(?:\s+as\s+([A-Za-z_]\w*))?$/);
|
|
162
|
+
if (!mm) continue;
|
|
163
|
+
const pkg = pkgBase(mm[1], 'py');
|
|
164
|
+
packages.add(pkg);
|
|
165
|
+
ns.set(mm[2] || mm[1].split('.')[0], pkg);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return { named, ns, packages };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function extractImports(content, lang) {
|
|
172
|
+
return lang === 'py' ? extractPyImports(content) : extractJsImports(content);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Find call sites in `content` of `vulnFns` belonging to `pkg`, resolved through
|
|
177
|
+
* this file's import map. Returns [{ fn, line, via }]. Empty if the file does
|
|
178
|
+
* not import `pkg` (the precision gate).
|
|
179
|
+
*/
|
|
180
|
+
function findImportAwareCallSites(content, lang, imports, pkg, vulnFns) {
|
|
181
|
+
if (!imports || !vulnFns || !vulnFns.length) return [];
|
|
182
|
+
const importsPkg = [...imports.packages].some((p) => pkgMatches(pkg, p, lang));
|
|
183
|
+
if (!importsPkg) return [];
|
|
184
|
+
const want = new Set(vulnFns);
|
|
185
|
+
const code = (0,_sast_comment_strip_js__WEBPACK_IMPORTED_MODULE_0__/* .blankComments */ .$)(content);
|
|
186
|
+
const lines = code.split('\n');
|
|
187
|
+
const sites = [];
|
|
188
|
+
const lineOf = (idx) => code.slice(0, idx).split('\n').length;
|
|
189
|
+
|
|
190
|
+
// 1) named/aliased imports: localName bound to {pkg, imported} where imported ∈ want
|
|
191
|
+
for (const [local, info] of imports.named) {
|
|
192
|
+
if (!pkgMatches(pkg, info.pkg, lang)) continue;
|
|
193
|
+
if (!want.has(info.imported)) continue;
|
|
194
|
+
const re = new RegExp(`\\b${local.replace(/[$]/g, '\\$&')}\\s*\\(`, 'g');
|
|
195
|
+
let mm;
|
|
196
|
+
while ((mm = re.exec(code))) sites.push({ fn: info.imported, line: lineOf(mm.index), via: local === info.imported ? 'named' : 'alias' });
|
|
197
|
+
}
|
|
198
|
+
// 2) namespace/default member access: ns.fn( where ns→pkg and fn ∈ want
|
|
199
|
+
for (const [local, p] of imports.ns) {
|
|
200
|
+
if (!pkgMatches(pkg, p, lang)) continue;
|
|
201
|
+
for (const fn of want) {
|
|
202
|
+
const sep = lang === 'py' ? '\\.' : '\\.';
|
|
203
|
+
const re = new RegExp(`\\b${local.replace(/[$]/g, '\\$&')}\\s*${sep}\\s*${fn.replace(/[^\w]/g, '\\$&')}\\s*\\(`, 'g');
|
|
204
|
+
let mm;
|
|
205
|
+
while ((mm = re.exec(code))) sites.push({ fn, line: lineOf(mm.index), via: 'namespace' });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Dedup by fn+line.
|
|
209
|
+
const seen = new Set();
|
|
210
|
+
return sites.filter((s) => { const k = `${s.fn}:${s.line}`; if (seen.has(k)) return false; seen.add(k); return true; });
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Augment supplyChain findings (npm/pypi only) with import-aware call sites the
|
|
215
|
+
* regex pass missed, gated to files that import the package. Additive: it never
|
|
216
|
+
* removes existing sites, so it cannot regress the route-reachability classifier
|
|
217
|
+
* that runs next — it only gives it more (and more accurate) call sites.
|
|
218
|
+
*
|
|
219
|
+
* Mutates and returns `supplyChain`. Records `sc._importAwareCallSites` (count)
|
|
220
|
+
* for observability.
|
|
221
|
+
*/
|
|
222
|
+
function augmentReachabilityViaImports(supplyChain, fileContents, vulnFnHints = {}) {
|
|
223
|
+
if (!Array.isArray(supplyChain)) return supplyChain;
|
|
224
|
+
// Collect the hardcoded/generated hint function names for a package. The
|
|
225
|
+
// hint map is keyed by `pkg` and by versioned `pkg@range` (and packages may
|
|
226
|
+
// be scoped `@scope/pkg`). The vulnerability decision already happened
|
|
227
|
+
// upstream; here we only need candidate function NAMES to locate call sites,
|
|
228
|
+
// so we gather version-agnostically.
|
|
229
|
+
const hintFnsFor = (name) => {
|
|
230
|
+
const out = [];
|
|
231
|
+
for (const [k, v] of Object.entries(vulnFnHints || {})) {
|
|
232
|
+
if (!Array.isArray(v)) continue;
|
|
233
|
+
const atIdx = k.lastIndexOf('@');
|
|
234
|
+
const base = atIdx > 0 ? k.slice(0, atIdx) : k; // >0 keeps a leading-@ scope intact
|
|
235
|
+
if (base === name) out.push(...v);
|
|
236
|
+
}
|
|
237
|
+
return out;
|
|
238
|
+
};
|
|
239
|
+
// Pre-parse imports per JS/PY file once.
|
|
240
|
+
const importsByFile = new Map();
|
|
241
|
+
for (const [file, content] of Object.entries(fileContents || {})) {
|
|
242
|
+
const lang = languageOfFile(file);
|
|
243
|
+
if (!lang) continue;
|
|
244
|
+
try { importsByFile.set(file, { lang, imports: extractImports(content, lang) }); } catch { /* skip unparseable */ }
|
|
245
|
+
}
|
|
246
|
+
if (!importsByFile.size) return supplyChain;
|
|
247
|
+
|
|
248
|
+
for (const sc of supplyChain) {
|
|
249
|
+
if (!sc || sc.type !== 'vulnerable_dep') continue;
|
|
250
|
+
if (sc.ecosystem !== 'npm' && sc.ecosystem !== 'pypi') continue;
|
|
251
|
+
const lang = sc.ecosystem === 'npm' ? 'js' : 'py';
|
|
252
|
+
const vulnFns = (sc.osvVulnFunctions || []).map((f) => {
|
|
253
|
+
const d = String(f).lastIndexOf('.'); return d > 0 ? String(f).slice(d + 1) : String(f);
|
|
254
|
+
}).concat(sc.usedVulnerableFunctions || []).concat(hintFnsFor(sc.name));
|
|
255
|
+
const uniqFns = [...new Set(vulnFns.filter(Boolean))];
|
|
256
|
+
if (!uniqFns.length) continue;
|
|
257
|
+
|
|
258
|
+
const existing = Array.isArray(sc.vulnerableFunctionCallSites) ? sc.vulnerableFunctionCallSites : [];
|
|
259
|
+
const seen = new Set(existing.map((s) => `${s.file}:${s.line}:${s.fn}`));
|
|
260
|
+
let added = 0;
|
|
261
|
+
for (const [file, { lang: fl, imports }] of importsByFile) {
|
|
262
|
+
if (fl !== lang) continue;
|
|
263
|
+
const content = fileContents[file];
|
|
264
|
+
const sites = findImportAwareCallSites(content, lang, imports, sc.name, uniqFns);
|
|
265
|
+
for (const s of sites) {
|
|
266
|
+
const key = `${file}:${s.line}:${s.fn}`;
|
|
267
|
+
if (seen.has(key)) continue;
|
|
268
|
+
seen.add(key);
|
|
269
|
+
existing.push({ pkg: sc.name, fn: s.fn, file, line: s.line, via: s.via, _r7: true });
|
|
270
|
+
added++;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (added > 0) {
|
|
274
|
+
sc.vulnerableFunctionCallSites = existing;
|
|
275
|
+
const usedSet = new Set(sc.usedVulnerableFunctions || []);
|
|
276
|
+
for (const s of existing) usedSet.add(s.fn);
|
|
277
|
+
sc.usedVulnerableFunctions = [...usedSet];
|
|
278
|
+
sc.noKnownCallSite = false;
|
|
279
|
+
sc._importAwareCallSites = (sc._importAwareCallSites || 0) + added;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return supplyChain;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/***/ })
|
|
287
|
+
|
|
288
|
+
};
|
package/dist/637.index.js
CHANGED
|
@@ -7,10 +7,11 @@ export const modules = {
|
|
|
7
7
|
|
|
8
8
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
9
|
/* harmony export */ computePrDelta: () => (/* binding */ computePrDelta),
|
|
10
|
+
/* harmony export */ netNewGate: () => (/* binding */ netNewGate),
|
|
10
11
|
/* harmony export */ renderPrDeltaText: () => (/* binding */ renderPrDeltaText)
|
|
11
12
|
/* harmony export */ });
|
|
12
13
|
/* 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__(
|
|
14
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5099);
|
|
14
15
|
// Shadowscan / security-DELTA on PR (v0.72).
|
|
15
16
|
//
|
|
16
17
|
// Most SAST PR-comment integrations show absolute counts — "12 findings
|
|
@@ -183,6 +184,19 @@ async function computePrDelta(root, { baseRef, headRef = 'HEAD' } = {}) {
|
|
|
183
184
|
/**
|
|
184
185
|
* Lightweight text summary used as a CLI fallback when --json isn't set.
|
|
185
186
|
*/
|
|
187
|
+
// R24 (PRD §5) — net-new CI gate. Blocks the build ONLY on findings the PR
|
|
188
|
+
// INTRODUCED (delta.introduced), at or above `failOn` severity — never on the
|
|
189
|
+
// pre-existing backlog. This is the only SAST CI posture teams tolerate
|
|
190
|
+
// long-term. Pure + deterministic: takes a delta, returns the gate decision.
|
|
191
|
+
const _NETNEW_SEV_RANK = { critical: 3, high: 2, medium: 1, low: 0, info: -1 };
|
|
192
|
+
function netNewGate(delta, failOn = 'critical') {
|
|
193
|
+
const introduced = (delta && Array.isArray(delta.introduced)) ? delta.introduced : [];
|
|
194
|
+
if (failOn === 'none') return { fail: false, failOn, introducedCount: introduced.length, blocked: [] };
|
|
195
|
+
const threshold = _NETNEW_SEV_RANK[failOn] ?? 3;
|
|
196
|
+
const blocked = introduced.filter((f) => (_NETNEW_SEV_RANK[f.severity] ?? -1) >= threshold);
|
|
197
|
+
return { fail: blocked.length > 0, failOn, introducedCount: introduced.length, blocked };
|
|
198
|
+
}
|
|
199
|
+
|
|
186
200
|
function renderPrDeltaText(delta) {
|
|
187
201
|
const i = delta.summary.introduced;
|
|
188
202
|
const r = delta.summary.resolved;
|
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__(
|
|
17
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5099);
|
|
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
|
package/dist/985.index.js
CHANGED
|
@@ -953,7 +953,11 @@ const apply_fix = {
|
|
|
953
953
|
}
|
|
954
954
|
throw e;
|
|
955
955
|
}
|
|
956
|
-
|
|
956
|
+
// R25 (PRD §5): surface the running auto-fix acceptance rate after each
|
|
957
|
+
// applied fix, so the closed loop reports its own success metric.
|
|
958
|
+
let acceptance = null;
|
|
959
|
+
try { acceptance = (0,fix_history/* fixAcceptanceRate */.XR)(ctx.sessionRoot); } catch { /* metric is best-effort */ }
|
|
960
|
+
return { _meta: META, applied: true, historyId: entry.id, file: f.file, backupPath: entry.backupPath, integrity: status, attemptOrdinal: entry.attemptOrdinal, acceptance };
|
|
957
961
|
},
|
|
958
962
|
};
|
|
959
963
|
|