@clear-capabilities/agentic-security-scanner 0.172.1 → 0.174.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.
- package/CHANGELOG.md +26 -0
- package/bin/agentic-security.js +37 -0
- package/dist/119.index.js +197 -0
- package/dist/128.index.js +129 -0
- package/dist/1293.index.js +5689 -0
- package/dist/1351.index.js +133 -0
- package/dist/1387.index.js +271 -0
- package/dist/1437.index.js +23 -0
- package/dist/1445.index.js +110 -0
- package/dist/1505.index.js +151 -0
- package/dist/1557.index.js +293 -0
- package/dist/1621.index.js +311 -0
- package/dist/1751.index.js +160 -0
- package/dist/1765.index.js +727 -0
- package/dist/1861.index.js +690 -0
- package/dist/1898.index.js +116 -0
- package/dist/1906.index.js +433 -0
- package/dist/1920.index.js +1 -291
- package/dist/208.index.js +1631 -0
- package/dist/2199.index.js +0 -239
- package/dist/2223.index.js +159 -0
- package/dist/2530.index.js +152 -0
- package/dist/2565.index.js +116 -0
- package/dist/2574.index.js +127 -0
- package/dist/2620.index.js +345 -0
- package/dist/2773.index.js +98 -0
- package/dist/2775.index.js +32 -0
- package/dist/2966.index.js +171 -0
- package/dist/2972.index.js +87 -0
- package/dist/2991.index.js +131 -0
- package/dist/3063.index.js +833 -0
- package/dist/3075.index.js +227 -0
- package/dist/3121.index.js +297 -0
- package/dist/3314.index.js +263 -0
- package/dist/3480.index.js +1822 -0
- package/dist/3481.index.js +24 -0
- package/dist/3506.index.js +268 -0
- package/dist/3533.index.js +591 -0
- package/dist/3653.index.js +450 -0
- package/dist/3822.index.js +131 -0
- package/dist/3868.index.js +292 -0
- package/dist/3917.index.js +152 -0
- package/dist/3918.index.js +192 -0
- package/dist/4090.index.js +288 -0
- package/dist/4121.index.js +1190 -0
- package/dist/4142.index.js +0 -239
- package/dist/4336.index.js +436 -0
- package/dist/4387.index.js +532 -0
- package/dist/4413.index.js +302 -0
- package/dist/4476.index.js +4510 -0
- package/dist/4491.index.js +133 -0
- package/dist/4538.index.js +185 -0
- package/dist/4684.index.js +319 -0
- package/dist/4740.index.js +165 -0
- package/dist/4780.index.js +209 -0
- package/dist/4802.index.js +225 -0
- package/dist/4812.index.js +379 -0
- package/dist/4835.index.js +126 -0
- package/dist/494.index.js +226 -0
- package/dist/4991.index.js +549 -0
- package/dist/5199.index.js +305 -0
- package/dist/5216.index.js +109 -0
- package/dist/5439.index.js +301 -0
- package/dist/5443.index.js +97 -0
- package/dist/5496.index.js +377 -0
- package/dist/550.index.js +2 -1
- package/dist/5801.index.js +588 -0
- package/dist/5858.index.js +223 -0
- package/dist/5933.index.js +143 -0
- package/dist/601.index.js +23 -0
- package/dist/6173.index.js +273 -0
- package/dist/6291.index.js +1871 -0
- package/dist/6312.index.js +666 -0
- package/dist/634.index.js +16182 -0
- package/dist/644.index.js +87 -0
- package/dist/6508.index.js +283 -0
- package/dist/6560.index.js +645 -0
- package/dist/6576.index.js +422 -0
- package/dist/6579.index.js +271 -0
- package/dist/6745.index.js +305 -0
- package/dist/6818.index.js +21642 -0
- package/dist/6972.index.js +167 -0
- package/dist/6995.index.js +163 -0
- package/dist/7249.index.js +191 -0
- package/dist/7372.index.js +1197 -0
- package/dist/7546.index.js +541 -0
- package/dist/76.index.js +448 -0
- package/dist/7879.index.js +163 -0
- package/dist/8025.index.js +130 -0
- package/dist/8054.index.js +248 -0
- package/dist/8097.index.js +201 -0
- package/dist/8126.index.js +191 -0
- package/dist/8178.index.js +78 -0
- package/dist/818.index.js +212 -0
- package/dist/8382.index.js +93 -0
- package/dist/8408.index.js +261 -0
- package/dist/8540.index.js +174 -0
- package/dist/8635.index.js +802 -0
- package/dist/8688.index.js +410 -0
- package/dist/8699.index.js +779 -0
- package/dist/8891.index.js +457 -0
- package/dist/8916.index.js +885 -0
- package/dist/9146.index.js +170 -0
- package/dist/9168.index.js +841 -0
- package/dist/9292.index.js +369 -0
- package/dist/9382.index.js +135 -11
- package/dist/9422.index.js +866 -0
- package/dist/9440.index.js +453 -0
- package/dist/9479.index.js +152 -0
- package/dist/9481.index.js +220 -0
- package/dist/9539.index.js +100 -0
- package/dist/9547.index.js +103 -0
- package/dist/9560.index.js +41 -61
- package/dist/9692.index.js +90 -0
- package/dist/9800.index.js +213 -1
- package/dist/9899.index.js +138 -0
- package/dist/9981.index.js +206 -0
- package/dist/999.index.js +117 -0
- package/dist/agentic-security.mjs +27 -27
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/package.json +31 -6
- package/src/context-intelligence/candidates.js +2 -1
- package/src/context-intelligence/capabilities.js +2 -1
- package/src/context-intelligence/cli.js +2 -0
- package/src/context-intelligence/config.js +3 -1
- package/src/context-intelligence/controls.js +49 -1
- package/src/context-intelligence/counterexample.js +200 -0
- package/src/context-intelligence/cross-route.js +111 -0
- package/src/context-intelligence/findings.js +166 -0
- package/src/context-intelligence/invariants.js +197 -0
- package/src/context-intelligence/queue.js +6 -1
- package/src/context-intelligence/reachability.js +2 -2
- package/src/context-intelligence/review.js +68 -4
- package/src/dataflow/access-paths.js +11 -0
- package/src/dataflow/analysis-limits.js +66 -0
- package/src/dataflow/engine.js +282 -24
- package/src/dataflow/service-edges.js +174 -0
- package/src/dataflow/summaries.js +7 -1
- package/src/discovery/judge.js +2 -1
- package/src/engine.js +82 -14
- package/src/fix/apply-fix-service.js +55 -8
- package/src/fix/batch-journal.js +84 -0
- package/src/fix/exploit-replay.js +51 -0
- package/src/fix/footprint.js +65 -0
- package/src/fix/patch-policy.js +49 -0
- package/src/fix/secret-persistence.js +39 -0
- package/src/fix/test-commands.js +84 -0
- package/src/fix/verification-adapters.js +97 -0
- package/src/fix/verification-record.js +243 -0
- package/src/fix/verify-patch.js +89 -0
- package/src/ir/CLAUDE.md +5 -0
- package/src/ir/callgraph.js +23 -1
- package/src/ir/module-resolver.js +315 -0
- package/src/ir/parser-js.js +21 -2
- package/src/ir/semantic-graph.js +245 -0
- package/src/language/haskell-findings.js +2 -0
- package/src/language/haskell-guards.js +1 -1
- package/src/language/haskell-ir.js +3 -1
- package/src/language/haskell-models.js +94 -0
- package/src/language/haskell-security-rules.js +20 -0
- package/src/language/nixos-hardening.js +72 -0
- package/src/lineage/build-attested-correlation.js +63 -0
- package/src/lineage/deployment-identity.js +76 -0
- package/src/mcp/tools.js +13 -34
- package/src/pipeline/canonical-output.js +64 -0
- package/src/pipeline/detector-runner.js +7 -0
- package/src/pipeline/scan-health.js +14 -0
- package/src/pipeline/supervised-analyzers.js +125 -0
- package/src/pipeline/supervised-child.js +17 -0
- package/src/pipeline/telemetry.js +79 -0
- package/src/posture/accuracy-scorecard.js +98 -9
- package/src/posture/artifact-registry.js +5 -0
- package/src/posture/assurance/evidence-registry.js +215 -0
- package/src/posture/assurance/release-package-verify.js +135 -0
- package/src/posture/assurance/release-package.js +118 -0
- package/src/posture/assurance/release-verdict.js +94 -0
- package/src/posture/assurance/waiver.js +200 -0
- package/src/posture/compliance-truth.js +100 -0
- package/src/posture/evaluation/scan-child.js +3 -1
- package/src/posture/evaluation/why-missed.js +3 -1
- package/src/posture/exploitability-evidence.js +141 -0
- package/src/posture/fix-verify.js +4 -2
- package/src/posture/fleet/exposure-ranking.js +115 -0
- package/src/posture/fleet/service-chain-graph.js +150 -0
- package/src/posture/graph-reconciliation.js +154 -0
- package/src/posture/provenance/coverage.js +103 -0
- package/src/posture/provenance/git-evidence.js +84 -0
- package/src/posture/provenance/origin-resolver.js +7 -1
- package/src/posture/provenance/predicate-replay.js +14 -4
- package/src/posture/runtime-correlation.js +61 -15
- package/src/posture/runtime-explanation.js +116 -0
- package/src/posture/runtime-trace-ingest.js +194 -0
- package/src/posture/scan-checkpoint.js +38 -10
- package/src/posture/waf-ingest.js +7 -2
- package/src/report/index.js +4 -0
- package/src/report/oscal.js +38 -0
- package/src/report/perspectives.js +150 -0
- package/src/sast/_comment-strip.js +8 -1
- package/src/sast/ruby.js +26 -0
- package/src/sast/zip-slip.js +79 -0
- package/src/util/string-memo.js +38 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
export const id = 9440;
|
|
2
|
+
export const ids = [9440];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 29440:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
+
/* harmony export */ runOnce: () => (/* binding */ runOnce)
|
|
10
|
+
/* harmony export */ });
|
|
11
|
+
/* unused harmony exports readDeps, _queryOsvForDep, loadState, persistState, loadConfig, formatPayload, _internals */
|
|
12
|
+
/* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73024);
|
|
13
|
+
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76760);
|
|
14
|
+
/* harmony import */ var _state_dir_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69259);
|
|
15
|
+
// Continuous CVE-watch daemon.
|
|
16
|
+
//
|
|
17
|
+
// Polls OSV for the project's dependency tree on a schedule (or one-shot),
|
|
18
|
+
// diffs new advisories against state, fires the configured webhook on each
|
|
19
|
+
// new ID. Multi-ecosystem: reads npm / pip / cargo / gem / pub / composer /
|
|
20
|
+
// go.mod / maven manifests via the same DEP_FILE_NAMES list runScan uses.
|
|
21
|
+
//
|
|
22
|
+
// Why this exists separately from `/scan --sca`:
|
|
23
|
+
// - `/scan` is interactive; this runs unattended, daily, in a cron / GitHub Action.
|
|
24
|
+
// - `/scan` reports the FULL set of advisories for the tree; this reports
|
|
25
|
+
// only the DELTA since the last run.
|
|
26
|
+
// - This produces a webhook fire, not a console report.
|
|
27
|
+
//
|
|
28
|
+
// Configuration is read from `.agentic-security/cve-alerts.json`:
|
|
29
|
+
// {
|
|
30
|
+
// "alertUrl": "https://hooks.slack.com/services/...",
|
|
31
|
+
// "alertType": "slack" | "discord" | "generic",
|
|
32
|
+
// "minSeverity": "low" | "medium" | "high" | "critical" (optional)
|
|
33
|
+
// }
|
|
34
|
+
//
|
|
35
|
+
// State is persisted to `.agentic-security/cve-alerts-state.json`:
|
|
36
|
+
// { "known": ["CVE-2024-1234", "GHSA-...", ...], "lastRun": "2026-…" }
|
|
37
|
+
//
|
|
38
|
+
// The daemon NEVER fires a webhook for an advisory ID it has already seen;
|
|
39
|
+
// the state file is the deduplication primitive.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const OSV_API = 'https://api.osv.dev/v1/query';
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Multi-ecosystem dep extraction. Each entry: { manifest filename → ecosystem }
|
|
49
|
+
const ECOSYSTEM_BY_MANIFEST = {
|
|
50
|
+
'package.json': 'npm',
|
|
51
|
+
'requirements.txt':'PyPI',
|
|
52
|
+
'pyproject.toml': 'PyPI',
|
|
53
|
+
'Pipfile': 'PyPI',
|
|
54
|
+
'Pipfile.lock': 'PyPI',
|
|
55
|
+
'poetry.lock': 'PyPI',
|
|
56
|
+
'Gemfile': 'RubyGems',
|
|
57
|
+
'Gemfile.lock': 'RubyGems',
|
|
58
|
+
'go.mod': 'Go',
|
|
59
|
+
'go.sum': 'Go',
|
|
60
|
+
'Cargo.toml': 'crates.io',
|
|
61
|
+
'Cargo.lock': 'crates.io',
|
|
62
|
+
'composer.json': 'Packagist',
|
|
63
|
+
'composer.lock': 'Packagist',
|
|
64
|
+
'pom.xml': 'Maven',
|
|
65
|
+
'build.gradle': 'Maven',
|
|
66
|
+
'build.gradle.kts':'Maven',
|
|
67
|
+
'pubspec.yaml': 'Pub',
|
|
68
|
+
'pubspec.lock': 'Pub',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// ─── Manifest readers ─────────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
function _readPackageJson(content) {
|
|
74
|
+
try {
|
|
75
|
+
const j = JSON.parse(content);
|
|
76
|
+
return [
|
|
77
|
+
...Object.keys(j.dependencies || {}),
|
|
78
|
+
...Object.keys(j.devDependencies || {}),
|
|
79
|
+
...Object.keys(j.peerDependencies || {}),
|
|
80
|
+
...Object.keys(j.optionalDependencies || {}),
|
|
81
|
+
];
|
|
82
|
+
} catch { return []; }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function _readRequirementsTxt(content) {
|
|
86
|
+
// Each non-blank, non-comment line is "pkg" or "pkg==1.2.3" or "pkg>=1.2".
|
|
87
|
+
const out = [];
|
|
88
|
+
for (const raw of content.split('\n')) {
|
|
89
|
+
const line = raw.trim();
|
|
90
|
+
if (!line || line.startsWith('#') || line.startsWith('-')) continue;
|
|
91
|
+
const m = /^([A-Za-z0-9_.\-]+)/.exec(line);
|
|
92
|
+
if (m) out.push(m[1]);
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function _readPyprojectToml(content) {
|
|
98
|
+
// We don't ship a TOML parser; do a best-effort line scan for the common
|
|
99
|
+
// dep-table shapes. Caller is OK if this misses some — the full SCA scan
|
|
100
|
+
// does the heavy lifting.
|
|
101
|
+
const out = new Set();
|
|
102
|
+
// PEP 621 [project] dependencies = ["foo", "bar>=1.0"]
|
|
103
|
+
// Poetry [tool.poetry.dependencies] foo = "^1.0"
|
|
104
|
+
let inDeps = false;
|
|
105
|
+
for (const raw of content.split('\n')) {
|
|
106
|
+
const line = raw.trim();
|
|
107
|
+
if (!line || line.startsWith('#')) continue;
|
|
108
|
+
if (/^\[(?:tool\.poetry\.)?(?:dev-)?dependencies\]/i.test(line) || /^\[project\.optional-dependencies\.[^\]]+\]/.test(line)) {
|
|
109
|
+
inDeps = true; continue;
|
|
110
|
+
}
|
|
111
|
+
if (/^\[[^\]]+\]/.test(line)) { inDeps = false; continue; }
|
|
112
|
+
// Inline "dependencies = [...]" form within [project]
|
|
113
|
+
const inline = /dependencies\s*=\s*\[([^\]]+)\]/i.exec(line);
|
|
114
|
+
if (inline) {
|
|
115
|
+
for (const item of inline[1].split(',')) {
|
|
116
|
+
const m = /^[\s"']*([A-Za-z0-9_.\-]+)/.exec(item);
|
|
117
|
+
if (m) out.add(m[1]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (inDeps) {
|
|
121
|
+
const m = /^([A-Za-z0-9_.\-]+)\s*=/.exec(line);
|
|
122
|
+
if (m && m[1] !== 'python') out.add(m[1]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return [...out];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function _readGemfile(content) {
|
|
129
|
+
const out = [];
|
|
130
|
+
for (const raw of content.split('\n')) {
|
|
131
|
+
const m = /^\s*gem\s+['"]([^'"]+)['"]/.exec(raw);
|
|
132
|
+
if (m) out.push(m[1]);
|
|
133
|
+
}
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function _readGoMod(content) {
|
|
138
|
+
const out = [];
|
|
139
|
+
let inRequire = false;
|
|
140
|
+
for (const raw of content.split('\n')) {
|
|
141
|
+
const line = raw.trim();
|
|
142
|
+
if (line.startsWith('require (')) { inRequire = true; continue; }
|
|
143
|
+
if (inRequire && line === ')') { inRequire = false; continue; }
|
|
144
|
+
if (inRequire || line.startsWith('require ')) {
|
|
145
|
+
// "require module/path v1.2.3" or just "module/path v1.2.3" inside block
|
|
146
|
+
const m = /(?:require\s+)?([A-Za-z0-9_./\-]+)\s+v/.exec(line);
|
|
147
|
+
if (m) out.push(m[1]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function _readCargoToml(content) {
|
|
154
|
+
// Lines under [dependencies] / [dev-dependencies] / [build-dependencies]
|
|
155
|
+
// shaped as `pkg = "1.0"` or `pkg = { … }`.
|
|
156
|
+
const out = new Set();
|
|
157
|
+
let inDeps = false;
|
|
158
|
+
for (const raw of content.split('\n')) {
|
|
159
|
+
const line = raw.trim();
|
|
160
|
+
if (/^\[(?:dev-|build-)?dependencies\]/.test(line)) { inDeps = true; continue; }
|
|
161
|
+
if (/^\[[^\]]+\]/.test(line)) { inDeps = false; continue; }
|
|
162
|
+
if (inDeps) {
|
|
163
|
+
const m = /^([A-Za-z0-9_\-]+)\s*=/.exec(line);
|
|
164
|
+
if (m) out.add(m[1]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return [...out];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function _readComposerJson(content) {
|
|
171
|
+
try {
|
|
172
|
+
const j = JSON.parse(content);
|
|
173
|
+
return [
|
|
174
|
+
...Object.keys(j.require || {}).filter(k => k !== 'php'),
|
|
175
|
+
...Object.keys(j['require-dev'] || {}).filter(k => k !== 'php'),
|
|
176
|
+
];
|
|
177
|
+
} catch { return []; }
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function _readMavenLikeXml(content) {
|
|
181
|
+
// crude <artifactId>x</artifactId> extraction. Misses parent POM inheritance;
|
|
182
|
+
// for full coverage the /scan --sca path is the right tool.
|
|
183
|
+
const out = [];
|
|
184
|
+
const re = /<artifactId>\s*([^<\s]+)\s*<\/artifactId>/g;
|
|
185
|
+
let m;
|
|
186
|
+
while ((m = re.exec(content)) !== null) out.push(m[1]);
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function _readPubspecYaml(content) {
|
|
191
|
+
const out = new Set();
|
|
192
|
+
let inDeps = false;
|
|
193
|
+
for (const raw of content.split('\n')) {
|
|
194
|
+
const line = raw.trimEnd();
|
|
195
|
+
if (/^(dev_|)dependencies\s*:/i.test(line)) { inDeps = true; continue; }
|
|
196
|
+
if (line && !line.startsWith(' ') && !line.startsWith('\t')) {
|
|
197
|
+
// top-level key other than dependencies / dev_dependencies
|
|
198
|
+
if (!/^(dev_|)dependencies\s*:/i.test(line)) inDeps = false;
|
|
199
|
+
}
|
|
200
|
+
if (inDeps) {
|
|
201
|
+
const m = /^\s+([A-Za-z0-9_]+)\s*:/.exec(line);
|
|
202
|
+
if (m && m[1] !== 'sdk' && m[1] !== 'flutter') out.add(m[1]);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return [...out];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const MANIFEST_READERS = {
|
|
209
|
+
'package.json': _readPackageJson,
|
|
210
|
+
'requirements.txt': _readRequirementsTxt,
|
|
211
|
+
'pyproject.toml': _readPyprojectToml,
|
|
212
|
+
'Pipfile': _readPyprojectToml, // close-enough shape
|
|
213
|
+
'Gemfile': _readGemfile,
|
|
214
|
+
'go.mod': _readGoMod,
|
|
215
|
+
'Cargo.toml': _readCargoToml,
|
|
216
|
+
'composer.json': _readComposerJson,
|
|
217
|
+
'pom.xml': _readMavenLikeXml,
|
|
218
|
+
'build.gradle': _readMavenLikeXml,
|
|
219
|
+
'build.gradle.kts': _readMavenLikeXml,
|
|
220
|
+
'pubspec.yaml': _readPubspecYaml,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
function readDeps(scanRoot) {
|
|
224
|
+
// Walks the scan root looking for known manifest files. Returns a flat
|
|
225
|
+
// [{name, ecosystem}, ...] list; deduplicated across manifests so a
|
|
226
|
+
// package in both package.json and yarn.lock isn't queried twice.
|
|
227
|
+
const seen = new Set();
|
|
228
|
+
const out = [];
|
|
229
|
+
function walk(dir, depth) {
|
|
230
|
+
if (depth > 4) return; // shallow walk; manifests live near the root
|
|
231
|
+
let entries;
|
|
232
|
+
try { entries = node_fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
233
|
+
for (const e of entries) {
|
|
234
|
+
if (e.name.startsWith('.') && e.name !== '.gradle') continue;
|
|
235
|
+
if (e.name === 'node_modules' || e.name === 'venv' || e.name === '__pycache__'
|
|
236
|
+
|| e.name === 'vendor' || e.name === 'dist' || e.name === 'build'
|
|
237
|
+
|| e.name === 'target') continue;
|
|
238
|
+
const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(dir, e.name);
|
|
239
|
+
if (e.isDirectory()) { walk(fp, depth + 1); continue; }
|
|
240
|
+
if (!ECOSYSTEM_BY_MANIFEST[e.name]) continue;
|
|
241
|
+
let content;
|
|
242
|
+
try { content = node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(fp, 'utf8'); } catch { continue; }
|
|
243
|
+
const reader = MANIFEST_READERS[e.name];
|
|
244
|
+
if (!reader) continue;
|
|
245
|
+
const ecosystem = ECOSYSTEM_BY_MANIFEST[e.name];
|
|
246
|
+
for (const name of reader(content)) {
|
|
247
|
+
const key = `${ecosystem}::${name}`;
|
|
248
|
+
if (seen.has(key)) continue;
|
|
249
|
+
seen.add(key);
|
|
250
|
+
out.push({ name, ecosystem });
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
walk(scanRoot, 0);
|
|
255
|
+
return out;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ─── OSV query ────────────────────────────────────────────────────────────
|
|
259
|
+
|
|
260
|
+
async function _queryOsvForDep({ name, ecosystem }, { fetchImpl = globalThis.fetch, timeoutMs = 4000 } = {}) {
|
|
261
|
+
// POST { package: { name, ecosystem } } — returns the full vulnerability
|
|
262
|
+
// list for the package (any version). The daemon doesn't filter by version
|
|
263
|
+
// because we treat "new advisory ID" as the signal, not "your installed
|
|
264
|
+
// version is affected" — that's what /scan --sca produces.
|
|
265
|
+
try {
|
|
266
|
+
const controller = new AbortController();
|
|
267
|
+
const t = setTimeout(() => controller.abort(), timeoutMs);
|
|
268
|
+
const res = await fetchImpl(OSV_API, {
|
|
269
|
+
method: 'POST',
|
|
270
|
+
headers: { 'Content-Type': 'application/json' },
|
|
271
|
+
body: JSON.stringify({ package: { name, ecosystem } }),
|
|
272
|
+
signal: controller.signal,
|
|
273
|
+
});
|
|
274
|
+
clearTimeout(t);
|
|
275
|
+
if (!res.ok) return [];
|
|
276
|
+
const j = await res.json();
|
|
277
|
+
return Array.isArray(j.vulns) ? j.vulns : [];
|
|
278
|
+
} catch { return []; }
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// ─── State persistence ───────────────────────────────────────────────────
|
|
282
|
+
|
|
283
|
+
function loadState(scanRoot) {
|
|
284
|
+
const fp = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.statePath)(scanRoot, 'cve-alerts-state.json');
|
|
285
|
+
if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(fp)) return { known: new Set(), lastRun: null };
|
|
286
|
+
try {
|
|
287
|
+
const j = JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(fp, 'utf8'));
|
|
288
|
+
return { known: new Set(j.known || []), lastRun: j.lastRun || null };
|
|
289
|
+
} catch { return { known: new Set(), lastRun: null }; }
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function persistState(scanRoot, state) {
|
|
293
|
+
const fp = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.statePath)(scanRoot, 'cve-alerts-state.json');
|
|
294
|
+
if (!(0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.stateWritesEnabled)()) return;
|
|
295
|
+
node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(node_path__WEBPACK_IMPORTED_MODULE_1__.dirname(fp), { recursive: true });
|
|
296
|
+
node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(fp, JSON.stringify({
|
|
297
|
+
known: [...state.known].sort(),
|
|
298
|
+
lastRun: state.lastRun,
|
|
299
|
+
}, null, 2));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function loadConfig(scanRoot) {
|
|
303
|
+
const fp = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.statePath)(scanRoot, 'cve-alerts.json');
|
|
304
|
+
if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(fp)) return null;
|
|
305
|
+
try { return JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(fp, 'utf8')); } catch { return null; }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ─── Webhook formatting ──────────────────────────────────────────────────
|
|
309
|
+
|
|
310
|
+
function _truncate(s, n) { s = String(s || ''); return s.length > n ? s.slice(0, n) + '…' : s; }
|
|
311
|
+
|
|
312
|
+
function formatPayload(alertType, newAdvisories) {
|
|
313
|
+
// alertType: 'slack' | 'discord' | 'generic'
|
|
314
|
+
// Slack and Discord both accept `{ text }` for simple messages.
|
|
315
|
+
const lines = newAdvisories.slice(0, 10).map(a =>
|
|
316
|
+
`• \`${a.ecosystem}:${a.pkg}\` — ${a.id} (${a.severity || 'unknown'})${a.summary ? ' — ' + _truncate(a.summary, 100) : ''}`
|
|
317
|
+
);
|
|
318
|
+
const overflow = newAdvisories.length > 10 ? `\n+${newAdvisories.length - 10} more` : '';
|
|
319
|
+
const text = `🚨 *New CVEs in your dependencies* (${newAdvisories.length})\n` + lines.join('\n') + overflow + '\n\nRun `/scan --all` to assess impact.';
|
|
320
|
+
if (alertType === 'slack' || alertType === 'discord') return { text };
|
|
321
|
+
// Generic webhook: full structured payload.
|
|
322
|
+
return { event: 'new_cve', count: newAdvisories.length, advisories: newAdvisories };
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
async function _post(url, payload, { fetchImpl = globalThis.fetch, timeoutMs = 4000 } = {}) {
|
|
326
|
+
try {
|
|
327
|
+
const controller = new AbortController();
|
|
328
|
+
const t = setTimeout(() => controller.abort(), timeoutMs);
|
|
329
|
+
const res = await fetchImpl(url, {
|
|
330
|
+
method: 'POST',
|
|
331
|
+
headers: { 'Content-Type': 'application/json' },
|
|
332
|
+
body: JSON.stringify(payload),
|
|
333
|
+
signal: controller.signal,
|
|
334
|
+
});
|
|
335
|
+
clearTimeout(t);
|
|
336
|
+
return { ok: res.ok, status: res.status };
|
|
337
|
+
} catch (e) { return { ok: false, error: String(e?.message || e).slice(0, 200) }; }
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// ─── Severity filter ─────────────────────────────────────────────────────
|
|
341
|
+
|
|
342
|
+
const SEV_RANK = { critical: 4, high: 3, medium: 2, low: 1, unknown: 0 };
|
|
343
|
+
|
|
344
|
+
function _normalizeSeverity(vuln) {
|
|
345
|
+
// OSV severity has a few possible shapes. Best-effort.
|
|
346
|
+
const dbSpec = vuln.database_specific?.severity || '';
|
|
347
|
+
if (/critical/i.test(dbSpec)) return 'critical';
|
|
348
|
+
if (/high/i.test(dbSpec)) return 'high';
|
|
349
|
+
if (/medium|moderate/i.test(dbSpec)) return 'medium';
|
|
350
|
+
if (/low/i.test(dbSpec)) return 'low';
|
|
351
|
+
// CVSS score
|
|
352
|
+
const score = vuln.severity?.[0]?.score;
|
|
353
|
+
if (typeof score === 'number') {
|
|
354
|
+
if (score >= 9) return 'critical';
|
|
355
|
+
if (score >= 7) return 'high';
|
|
356
|
+
if (score >= 4) return 'medium';
|
|
357
|
+
return 'low';
|
|
358
|
+
}
|
|
359
|
+
return 'unknown';
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// ─── Main entry — runOnce ───────────────────────────────────────────────
|
|
363
|
+
|
|
364
|
+
async function runOnce(scanRoot, opts = {}) {
|
|
365
|
+
// opts: { alertUrl, alertType, minSeverity, dryRun, offline, fetchImpl,
|
|
366
|
+
// logger, throttleMs }
|
|
367
|
+
const log = opts.logger || ((msg) => process.stderr.write(msg + '\n'));
|
|
368
|
+
const cfg = loadConfig(scanRoot);
|
|
369
|
+
const alertUrl = opts.alertUrl || cfg?.alertUrl || process.env.CVE_ALERT_URL;
|
|
370
|
+
const alertType = opts.alertType || cfg?.alertType || 'slack';
|
|
371
|
+
const minSeverity = opts.minSeverity || cfg?.minSeverity || 'low';
|
|
372
|
+
const dryRun = !!opts.dryRun;
|
|
373
|
+
const offline = !!opts.offline || process.env.AGENTIC_SECURITY_OFFLINE === '1';
|
|
374
|
+
const fetchImpl = opts.fetchImpl || globalThis.fetch;
|
|
375
|
+
const throttleMs = typeof opts.throttleMs === 'number' ? opts.throttleMs : 50;
|
|
376
|
+
|
|
377
|
+
if (offline && !dryRun) {
|
|
378
|
+
return { ok: false, reason: 'offline-mode-set' };
|
|
379
|
+
}
|
|
380
|
+
if (typeof fetchImpl !== 'function') {
|
|
381
|
+
return { ok: false, reason: 'fetch-unavailable' };
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
const deps = readDeps(scanRoot);
|
|
385
|
+
if (deps.length === 0) {
|
|
386
|
+
return { ok: true, depsChecked: 0, newAdvisories: [], alertSent: false, reason: 'no-deps-found' };
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const state = loadState(scanRoot);
|
|
390
|
+
const newAdvisories = [];
|
|
391
|
+
const sevFloor = SEV_RANK[minSeverity] ?? 0;
|
|
392
|
+
|
|
393
|
+
for (const dep of deps) {
|
|
394
|
+
const vulns = await _queryOsvForDep(dep, { fetchImpl, timeoutMs: opts.timeoutMs });
|
|
395
|
+
for (const v of vulns) {
|
|
396
|
+
if (!v.id || state.known.has(v.id)) continue;
|
|
397
|
+
const sev = _normalizeSeverity(v);
|
|
398
|
+
if ((SEV_RANK[sev] ?? 0) < sevFloor) {
|
|
399
|
+
// Below user's floor; remember the ID so we don't re-fire next run,
|
|
400
|
+
// but don't surface in the alert.
|
|
401
|
+
state.known.add(v.id);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
newAdvisories.push({
|
|
405
|
+
id: v.id,
|
|
406
|
+
pkg: dep.name,
|
|
407
|
+
ecosystem: dep.ecosystem,
|
|
408
|
+
severity: sev,
|
|
409
|
+
summary: v.summary || '',
|
|
410
|
+
published: v.published || null,
|
|
411
|
+
});
|
|
412
|
+
state.known.add(v.id);
|
|
413
|
+
}
|
|
414
|
+
if (throttleMs > 0) await new Promise(r => setTimeout(r, throttleMs));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
state.lastRun = new Date().toISOString();
|
|
418
|
+
if (!dryRun) persistState(scanRoot, state);
|
|
419
|
+
|
|
420
|
+
let alertSent = false;
|
|
421
|
+
let alertError = null;
|
|
422
|
+
if (newAdvisories.length > 0 && alertUrl && !dryRun) {
|
|
423
|
+
const payload = formatPayload(alertType, newAdvisories);
|
|
424
|
+
const r = await _post(alertUrl, payload, { fetchImpl, timeoutMs: opts.timeoutMs });
|
|
425
|
+
alertSent = r.ok;
|
|
426
|
+
if (!r.ok) alertError = r.error || `HTTP ${r.status}`;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
log(`agentic-security cve-watch: deps=${deps.length} new=${newAdvisories.length} sent=${alertSent}${alertError ? ' err=' + alertError : ''}${dryRun ? ' (dry-run)' : ''}`);
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
ok: true,
|
|
433
|
+
depsChecked: deps.length,
|
|
434
|
+
newAdvisories,
|
|
435
|
+
alertSent,
|
|
436
|
+
alertError,
|
|
437
|
+
minSeverity,
|
|
438
|
+
dryRun,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const _internals = {
|
|
443
|
+
ECOSYSTEM_BY_MANIFEST,
|
|
444
|
+
MANIFEST_READERS,
|
|
445
|
+
_readPackageJson, _readRequirementsTxt, _readPyprojectToml, _readGemfile,
|
|
446
|
+
_readGoMod, _readCargoToml, _readComposerJson, _readMavenLikeXml, _readPubspecYaml,
|
|
447
|
+
_normalizeSeverity,
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
/***/ })
|
|
452
|
+
|
|
453
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export const id = 9479;
|
|
2
|
+
export const ids = [9479];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 9479:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
+
/* harmony export */ sweepGitHistory: () => (/* binding */ sweepGitHistory)
|
|
10
|
+
/* harmony export */ });
|
|
11
|
+
/* unused harmony exports extractAddedLines, splitDiffByFile, scanHistoryDiff */
|
|
12
|
+
/* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31421);
|
|
13
|
+
/* harmony import */ var _util_git_hardening_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12179);
|
|
14
|
+
/* harmony import */ var _language_secrets_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67855);
|
|
15
|
+
// R15 (PRD §5) — git-history secret sweep.
|
|
16
|
+
//
|
|
17
|
+
// A secret removed from HEAD but present in any past commit is still
|
|
18
|
+
// recoverable from `.git` and must be rotated — the most dangerous secret case,
|
|
19
|
+
// and one a working-tree-only scan misses entirely. This sweeps recent history
|
|
20
|
+
// (bounded), feeding the ADDED lines of each commit through the same credential
|
|
21
|
+
// detector the file scan uses.
|
|
22
|
+
//
|
|
23
|
+
// The detector is INJECTED (detectFn) rather than imported, so this module has
|
|
24
|
+
// no dependency back into engine.js (avoids a circular import) and the parsing
|
|
25
|
+
// stays pure + unit-testable. Live-credential validation (is the key active?)
|
|
26
|
+
// needs network and is deferred — see the rollup.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// Pull the post-image (added) lines out of a unified diff: lines starting with
|
|
33
|
+
// a single '+' (not the '+++' file header). Returns reconstructed text.
|
|
34
|
+
function extractAddedLines(diffText) {
|
|
35
|
+
const out = [];
|
|
36
|
+
for (const line of String(diffText || '').split('\n')) {
|
|
37
|
+
if (line.startsWith('+') && !line.startsWith('+++')) out.push(line.slice(1));
|
|
38
|
+
}
|
|
39
|
+
return out.join('\n');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Split a unified diff into per-file sections with the POST-IMAGE line number of every added line, so a
|
|
43
|
+
// finding can name the file and line it was committed at (the combined text alone loses both).
|
|
44
|
+
function splitDiffByFile(diffText) {
|
|
45
|
+
const files = [];
|
|
46
|
+
let cur = null; let next = 0;
|
|
47
|
+
for (const line of String(diffText || '').split('\n')) {
|
|
48
|
+
const h = /^diff --git a\/(.+?) b\/(.+)$/.exec(line);
|
|
49
|
+
if (h) { cur = { path: h[2], added: [] }; files.push(cur); next = 0; continue; }
|
|
50
|
+
if (!cur) continue;
|
|
51
|
+
const hh = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line);
|
|
52
|
+
if (hh) { next = parseInt(hh[1], 10); continue; }
|
|
53
|
+
if (line.startsWith('+++') || line.startsWith('---')) continue;
|
|
54
|
+
if (line.startsWith('+')) { cur.added.push({ text: line.slice(1), line: next }); next++; }
|
|
55
|
+
else if (!line.startsWith('-') && !line.startsWith('\\')) next++;
|
|
56
|
+
}
|
|
57
|
+
return files;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Pure: run the injected credential detector over a commit's added lines.
|
|
61
|
+
// detectFn has the scanCredentials(fp, raw) shape and returns Finding[]. `extra` are additional detectors
|
|
62
|
+
// ((path, text) => Finding[]) run against each file's added lines WITH the real path, so extension-gated
|
|
63
|
+
// detectors (Haskell/Nix split-secret) apply to history too.
|
|
64
|
+
function scanHistoryDiff(diffText, commit, detectFn, extra = []) {
|
|
65
|
+
if (typeof detectFn !== 'function') return [];
|
|
66
|
+
const sections = splitDiffByFile(diffText);
|
|
67
|
+
const remediation = 'Rotate the credential now, then purge it from history (git filter-repo / BFG) and move it to a secrets manager. Removing it from HEAD alone is insufficient.';
|
|
68
|
+
const wrap = (f, sec, addedLines) => {
|
|
69
|
+
const hit = Number.isInteger(f.line) && f.line >= 1 ? addedLines[f.line - 1] : null;
|
|
70
|
+
const prov = f.rotation ? {} : (0,_language_secrets_js__WEBPACK_IMPORTED_MODULE_2__/* .providerInfo */ .cf)(f._rawProviderValue || '');
|
|
71
|
+
const out = {
|
|
72
|
+
...f, ...prov,
|
|
73
|
+
id: `secret-history:${commit}:${f.id || f.vuln || 'secret'}`,
|
|
74
|
+
file: `git-history@${commit}`, line: 0, commit, _historical: true,
|
|
75
|
+
...(sec ? { sourceFile: sec.path, sourceLine: hit ? hit.line : null } : {}),
|
|
76
|
+
vuln: `${f.vuln || 'Hardcoded Secret'} (in git history)`,
|
|
77
|
+
description: `${f.description || 'A credential was committed.'} Found in commit ${commit}${sec ? ` (${sec.path}${hit ? `:${hit.line}` : ''})` : ''}; even if removed from HEAD it remains recoverable from git and must be rotated.`,
|
|
78
|
+
remediation,
|
|
79
|
+
// report/index.js's _remediationOf checks `.fix` before `.remediation`
|
|
80
|
+
// — the underlying detector already set `.fix` to a generic "remove
|
|
81
|
+
// the line" string, which would otherwise silently shadow this
|
|
82
|
+
// history-specific instruction ("removing it from HEAD alone is
|
|
83
|
+
// insufficient") in every report format.
|
|
84
|
+
fix: remediation,
|
|
85
|
+
};
|
|
86
|
+
delete out._rawProviderValue;
|
|
87
|
+
return out;
|
|
88
|
+
};
|
|
89
|
+
const results = [];
|
|
90
|
+
if (!sections.length) {
|
|
91
|
+
const added = extractAddedLines(diffText);
|
|
92
|
+
if (!added.trim()) return [];
|
|
93
|
+
let findings = [];
|
|
94
|
+
try { findings = detectFn(`git-history@${commit}`, added) || []; } catch { return []; }
|
|
95
|
+
return findings.map((f) => wrap(f, null, []));
|
|
96
|
+
}
|
|
97
|
+
for (const sec of sections) {
|
|
98
|
+
if (!sec.added.length) continue;
|
|
99
|
+
const text = sec.added.map((a) => a.text).join('\n');
|
|
100
|
+
if (!text.trim()) continue;
|
|
101
|
+
let findings = [];
|
|
102
|
+
try { findings = detectFn(`git-history@${commit}`, text) || []; } catch { findings = []; }
|
|
103
|
+
for (const f of findings) results.push(wrap(f, sec, sec.added));
|
|
104
|
+
for (const ex of extra || []) {
|
|
105
|
+
let more = [];
|
|
106
|
+
try { more = ex(sec.path, text) || []; } catch { more = []; }
|
|
107
|
+
for (const f of more) results.push(wrap(f, sec, sec.added));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return results;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const defaultExtra = [_language_secrets_js__WEBPACK_IMPORTED_MODULE_2__/* .scanLanguageSecretConcat */ ._d, _language_secrets_js__WEBPACK_IMPORTED_MODULE_2__/* .scanDependencyUrlCredentials */ .y6];
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Sweep up to `maxCommits` of recent history for secrets. Best-effort: returns
|
|
117
|
+
* [] when `scanRoot` is not a git repo or git is unavailable. Dedups a secret
|
|
118
|
+
* that recurs across commits to its earliest sighting.
|
|
119
|
+
*/
|
|
120
|
+
function sweepGitHistory(scanRoot, detectFn, { maxCommits = 50, timeoutMs = 20000, extraDetectors = null } = {}) {
|
|
121
|
+
if (!scanRoot || typeof detectFn !== 'function') return [];
|
|
122
|
+
let out;
|
|
123
|
+
try {
|
|
124
|
+
// Second independent Finding Provenance PRD audit (FR-PROV-024): this
|
|
125
|
+
// scanRoot is a scanned repository, not this project's own trusted
|
|
126
|
+
// checkout. `--no-textconv` alone (the pre-existing hardening here) closes
|
|
127
|
+
// the .gitattributes textconv surface but NOT `core.fsmonitor` /
|
|
128
|
+
// `core.hooksPath` — this `log -p` call renders every historical commit's
|
|
129
|
+
// diff content, the same shape verified exploitable in
|
|
130
|
+
// provenance/git-evidence.js, so it gets the full hardening too.
|
|
131
|
+
out = (0,node_child_process__WEBPACK_IMPORTED_MODULE_0__.execFileSync)('git', (0,_util_git_hardening_js__WEBPACK_IMPORTED_MODULE_1__/* .hardenGitArgs */ .Ax)(['-C', scanRoot, 'log', '-p', '-n', String(maxCommits), '--no-color', '--no-merges', '--no-textconv']),
|
|
132
|
+
{ encoding: 'utf8', maxBuffer: 96 * 1024 * 1024, timeout: timeoutMs, stdio: ['ignore', 'pipe', 'ignore'], env: (0,_util_git_hardening_js__WEBPACK_IMPORTED_MODULE_1__/* .hardenGitEnv */ .Si)() });
|
|
133
|
+
} catch { return []; }
|
|
134
|
+
const parts = out.split(/^commit ([0-9a-f]{7,40})/m); // [pre, sha, body, sha, body, ...]
|
|
135
|
+
const findings = [];
|
|
136
|
+
const seen = new Set();
|
|
137
|
+
for (let i = 1; i < parts.length; i += 2) {
|
|
138
|
+
const sha = (parts[i] || '').slice(0, 12);
|
|
139
|
+
for (const f of scanHistoryDiff(parts[i + 1] || '', sha, detectFn, extraDetectors || defaultExtra)) {
|
|
140
|
+
const key = `${f.vuln}:${(f.snippet || f.match || '').slice(0, 40)}`;
|
|
141
|
+
if (seen.has(key)) continue;
|
|
142
|
+
seen.add(key);
|
|
143
|
+
findings.push(f);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return findings;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
/***/ })
|
|
151
|
+
|
|
152
|
+
};
|