@clear-capabilities/agentic-security-scanner 0.185.0 → 0.186.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/bin/agentic-security.js +24 -1
- package/dist/1128.index.js +25 -21
- package/dist/2584.index.js +1 -1
- package/dist/4171.index.js +2 -2
- package/dist/5752.index.js +466 -0
- package/dist/7405.index.js +1 -1
- package/dist/8158.index.js +1713 -0
- package/dist/8798.index.js +1 -1
- package/dist/9382.index.js +2 -2
- package/dist/9579.index.js +1 -1
- package/dist/agentic-security.mjs +29 -29
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/dist/{0b301d45b231f144a1b4.json → ca62ee93079be4c24eee.json} +7 -7
- package/package.json +7 -7
- package/src/dataflow/CLAUDE.md +6 -3
- package/src/dataflow/access-paths.js +12 -2
- package/src/dataflow/demand-query.js +279 -40
- package/src/dataflow/dep-fingerprint.js +1 -1
- package/src/dataflow/exploit-prover.js +6 -2
- package/src/dataflow/ir-cache.js +268 -0
- package/src/dataflow/privacy-taint.js +7 -0
- package/src/engine.js +62 -5
- package/src/ir/CLAUDE.md +4 -0
- package/src/ir/callgraph.js +36 -8
- package/src/ir/index.js +18 -4
- package/src/ir/parser-js.js +10 -0
- package/src/language/CLAUDE.md +13 -0
- package/src/language/nix-option-types.js +170 -0
- package/src/language/nix-script-taint.js +46 -3
- package/src/language/nix-secrets.js +20 -2
- package/src/lineage/CLAUDE.md +2 -1
- package/src/lineage/smt-orchestrator.js +47 -11
- package/src/lineage/smt-z3-backend.js +294 -0
- package/src/posture/CLAUDE.md +5 -1
- package/src/posture/business-logic.js +16 -7
- package/src/posture/dag-commands.js +442 -0
- package/src/posture/finding-defaults.js +19 -0
- package/src/posture/git-history.js +91 -1
- package/src/sast/CLAUDE.md +2 -0
- package/src/sast/_call-args.js +70 -0
- package/src/sast/init-scope.js +87 -0
- package/src/sast/listen-bind-address.js +49 -0
- package/src/sast/redirect-target.js +106 -0
- package/src/sast/reflected-input.js +76 -0
- package/src/sast/send-file-root.js +27 -0
- package/src/sast/sensitive-data-logging.js +38 -1
- package/dist/119.index.js +0 -197
- package/dist/128.index.js +0 -129
- package/dist/1293.index.js +0 -5689
- package/dist/1336.index.js +0 -16331
- package/dist/1351.index.js +0 -133
- package/dist/1387.index.js +0 -271
- package/dist/1437.index.js +0 -23
- package/dist/1445.index.js +0 -110
- package/dist/1505.index.js +0 -151
- package/dist/1557.index.js +0 -293
- package/dist/1621.index.js +0 -311
- package/dist/1751.index.js +0 -160
- package/dist/1765.index.js +0 -727
- package/dist/1861.index.js +0 -690
- package/dist/1906.index.js +0 -433
- package/dist/208.index.js +0 -1631
- package/dist/2223.index.js +0 -159
- package/dist/2238.index.js +0 -295
- package/dist/2530.index.js +0 -152
- package/dist/2565.index.js +0 -116
- package/dist/2574.index.js +0 -127
- package/dist/2620.index.js +0 -345
- package/dist/2773.index.js +0 -98
- package/dist/2775.index.js +0 -32
- package/dist/2966.index.js +0 -171
- package/dist/2972.index.js +0 -87
- package/dist/2991.index.js +0 -131
- package/dist/3063.index.js +0 -833
- package/dist/3075.index.js +0 -227
- package/dist/3121.index.js +0 -297
- package/dist/3314.index.js +0 -263
- package/dist/3480.index.js +0 -1822
- package/dist/3481.index.js +0 -24
- package/dist/3506.index.js +0 -268
- package/dist/3533.index.js +0 -591
- package/dist/3653.index.js +0 -450
- package/dist/3740.index.js +0 -722
- package/dist/3822.index.js +0 -131
- package/dist/3868.index.js +0 -292
- package/dist/3918.index.js +0 -192
- package/dist/4090.index.js +0 -288
- package/dist/4113.index.js +0 -1286
- package/dist/4121.index.js +0 -1190
- package/dist/4142.index.js +0 -690
- package/dist/4168.index.js +0 -509
- package/dist/4281.index.js +0 -993
- package/dist/4336.index.js +0 -436
- package/dist/4387.index.js +0 -532
- package/dist/4413.index.js +0 -302
- package/dist/4476.index.js +0 -4510
- package/dist/4491.index.js +0 -133
- package/dist/4538.index.js +0 -185
- package/dist/4684.index.js +0 -319
- package/dist/4740.index.js +0 -165
- package/dist/4780.index.js +0 -209
- package/dist/4802.index.js +0 -225
- package/dist/4812.index.js +0 -379
- package/dist/4835.index.js +0 -126
- package/dist/494.index.js +0 -226
- package/dist/4991.index.js +0 -549
- package/dist/5199.index.js +0 -305
- package/dist/5216.index.js +0 -109
- package/dist/5439.index.js +0 -301
- package/dist/5443.index.js +0 -97
- package/dist/5496.index.js +0 -377
- package/dist/5738.index.js +0 -240
- package/dist/5801.index.js +0 -588
- package/dist/5817.index.js +0 -714
- package/dist/5858.index.js +0 -223
- package/dist/5933.index.js +0 -143
- package/dist/601.index.js +0 -23
- package/dist/6173.index.js +0 -273
- package/dist/6291.index.js +0 -1871
- package/dist/6312.index.js +0 -666
- package/dist/634.index.js +0 -16182
- package/dist/644.index.js +0 -87
- package/dist/6508.index.js +0 -283
- package/dist/6560.index.js +0 -645
- package/dist/6576.index.js +0 -422
- package/dist/6579.index.js +0 -271
- package/dist/6655.index.js +0 -3221
- package/dist/6745.index.js +0 -305
- package/dist/6818.index.js +0 -21642
- package/dist/6932.index.js +0 -1190
- package/dist/6972.index.js +0 -167
- package/dist/6995.index.js +0 -163
- package/dist/7249.index.js +0 -191
- package/dist/7372.index.js +0 -1197
- package/dist/7546.index.js +0 -541
- package/dist/76.index.js +0 -448
- package/dist/7879.index.js +0 -163
- package/dist/8025.index.js +0 -130
- package/dist/8054.index.js +0 -248
- package/dist/808.index.js +0 -1330
- package/dist/8097.index.js +0 -201
- package/dist/8126.index.js +0 -191
- package/dist/8178.index.js +0 -78
- package/dist/8382.index.js +0 -93
- package/dist/8408.index.js +0 -261
- package/dist/8540.index.js +0 -174
- package/dist/8635.index.js +0 -802
- package/dist/8688.index.js +0 -410
- package/dist/8699.index.js +0 -779
- package/dist/8891.index.js +0 -457
- package/dist/8916.index.js +0 -885
- package/dist/9146.index.js +0 -170
- package/dist/9168.index.js +0 -841
- package/dist/9292.index.js +0 -369
- package/dist/9422.index.js +0 -866
- package/dist/9440.index.js +0 -453
- package/dist/9479.index.js +0 -152
- package/dist/9481.index.js +0 -220
- package/dist/9539.index.js +0 -100
- package/dist/9547.index.js +0 -103
- package/dist/9692.index.js +0 -90
- package/dist/9800.index.js +0 -462
- package/dist/9899.index.js +0 -138
- package/dist/9981.index.js +0 -206
- package/dist/999.index.js +0 -117
- package/dist/9999.index.js +0 -1698
package/dist/8097.index.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
export const id = 8097;
|
|
2
|
-
export const ids = [8097];
|
|
3
|
-
export const modules = {
|
|
4
|
-
|
|
5
|
-
/***/ 48097:
|
|
6
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
/* harmony export */ productionFeedbackReport: () => (/* binding */ productionFeedbackReport),
|
|
10
|
-
/* harmony export */ renderProductionFeedbackSummary: () => (/* binding */ renderProductionFeedbackSummary)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* unused harmony exports CATEGORIES, collectFeedbackEvents, summarizeFeedbackTrend, _internals */
|
|
13
|
-
/* harmony import */ var _suppressions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82166);
|
|
14
|
-
/* harmony import */ var _triage_memory_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77008);
|
|
15
|
-
/* harmony import */ var _sca_policy_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(75228);
|
|
16
|
-
/* harmony import */ var _fix_history_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74294);
|
|
17
|
-
/* harmony import */ var _fix_metrics_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(62683);
|
|
18
|
-
// FR-907 (assurance-hardening PRD): "Add longitudinal production feedback
|
|
19
|
-
// measurement | Metrics separate user suppression, accepted risk, invalid
|
|
20
|
-
// finding, fixed finding, and verification outcome."
|
|
21
|
-
//
|
|
22
|
-
// Read-only aggregation over 5 ALREADY-BUILT, separate mechanisms — this
|
|
23
|
-
// module invents no new storage of its own, only a unified view:
|
|
24
|
-
//
|
|
25
|
-
// user-suppression -> triage-memory.jsonl (decision:'wont-fix'),
|
|
26
|
-
// accepted.json (vibecoder soft-accept, dated),
|
|
27
|
-
// suppressions.yml (pro exception, undated)
|
|
28
|
-
// invalid-finding -> triage-memory.jsonl (decision:'false-positive')
|
|
29
|
-
// accepted-risk -> sca-policy.yml's accept-risk[] (undated snapshot
|
|
30
|
-
// — the policy file has no per-entry creation
|
|
31
|
-
// timestamp, only an optional future `expires`)
|
|
32
|
-
// fixed-finding -> fix-history/log.json (dated via `appliedAt`,
|
|
33
|
-
// status-tagged: applied/pending/reverted/failed)
|
|
34
|
-
// verification-outcome -> fix-metrics.jsonl (dated via `at`, ok-tagged)
|
|
35
|
-
//
|
|
36
|
-
// "Longitudinal" means: every event that HAS a real timestamp is usable in
|
|
37
|
-
// a time-bucketed trend; every event that does NOT (accept-risk entries,
|
|
38
|
-
// pro suppressions — neither schema records when the entry was added) is
|
|
39
|
-
// still counted in its category total but reported separately as
|
|
40
|
-
// "undated" rather than silently smeared across the time window or
|
|
41
|
-
// silently dropped. Same disclosed-gap discipline this codebase already
|
|
42
|
-
// uses elsewhere (privacy-framework.js's engine-gap bucket, accuracy-
|
|
43
|
-
// scorecard.js's excluded-from-denominator entries) — a number without
|
|
44
|
-
// its caveat is not a measurement.
|
|
45
|
-
//
|
|
46
|
-
// Never throws (posture convention): each of the 5 reads is wrapped
|
|
47
|
-
// independently, so a missing or malformed source degrades only that ONE
|
|
48
|
-
// category to empty, never blocks the other four. Every underlying reader
|
|
49
|
-
// (loadSoftAccepted, loadProSuppressions, loadMemory, loadScaPolicy,
|
|
50
|
-
// readLog, loadFixAttempts) already degrades gracefully on its own; the
|
|
51
|
-
// wrapping here is defense in depth against a reader whose contract
|
|
52
|
-
// changes later, not a claim that today's readers can throw.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const MS_PER_DAY = 86400000;
|
|
61
|
-
|
|
62
|
-
// The 5 categories named verbatim in FR-907's own acceptance criterion.
|
|
63
|
-
const CATEGORIES = Object.freeze([
|
|
64
|
-
'user-suppression', 'accepted-risk', 'invalid-finding', 'fixed-finding', 'verification-outcome',
|
|
65
|
-
]);
|
|
66
|
-
|
|
67
|
-
function _safe(fn) {
|
|
68
|
-
try { return fn(); } catch { return []; }
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* One unified event per underlying record, tagged with which of the 5
|
|
73
|
-
* PRD-named categories it belongs to. `at` is an ISO timestamp or null
|
|
74
|
-
* when the source schema has no per-entry creation date. `raw` keeps the
|
|
75
|
-
* original record for drill-down — never re-derived from the unified
|
|
76
|
-
* shape, so nothing is lost in translation.
|
|
77
|
-
*/
|
|
78
|
-
function collectFeedbackEvents(scanRoot) {
|
|
79
|
-
const events = [];
|
|
80
|
-
|
|
81
|
-
for (const e of _safe(() => (0,_suppressions_js__WEBPACK_IMPORTED_MODULE_0__/* .loadSoftAccepted */ .gv)(scanRoot))) {
|
|
82
|
-
events.push({
|
|
83
|
-
category: 'user-suppression', source: 'suppressions.js:accepted.json',
|
|
84
|
-
at: e.accepted_at || null, findingId: e.id || null, file: e.file || null,
|
|
85
|
-
line: e.line ?? null, outcome: 'soft-accepted', raw: e,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
for (const e of _safe(() => (0,_suppressions_js__WEBPACK_IMPORTED_MODULE_0__/* .loadProSuppressions */ .KM)(scanRoot))) {
|
|
89
|
-
events.push({
|
|
90
|
-
category: 'user-suppression', source: 'suppressions.js:suppressions.yml',
|
|
91
|
-
at: null, findingId: e.finding_id || null, file: e.file || null,
|
|
92
|
-
line: null, outcome: 'pro-exception', raw: e,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
for (const e of _safe(() => (0,_triage_memory_js__WEBPACK_IMPORTED_MODULE_1__/* .loadMemory */ .ab)(scanRoot))) {
|
|
96
|
-
if (e.decision === 'wont-fix') {
|
|
97
|
-
events.push({
|
|
98
|
-
category: 'user-suppression', source: 'triage-memory.js',
|
|
99
|
-
at: e.at || null, findingId: e.id || null, file: e.file || null,
|
|
100
|
-
line: e.line ?? null, outcome: 'wont-fix', raw: e,
|
|
101
|
-
});
|
|
102
|
-
} else if (e.decision === 'false-positive') {
|
|
103
|
-
events.push({
|
|
104
|
-
category: 'invalid-finding', source: 'triage-memory.js',
|
|
105
|
-
at: e.at || null, findingId: e.id || null, file: e.file || null,
|
|
106
|
-
line: e.line ?? null, outcome: 'false-positive', raw: e,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const scaPolicy = _safe(() => (0,_sca_policy_js__WEBPACK_IMPORTED_MODULE_2__/* .loadScaPolicy */ .IN)(scanRoot));
|
|
111
|
-
const acceptRisk = scaPolicy && Array.isArray(scaPolicy.acceptRisk) ? scaPolicy.acceptRisk : [];
|
|
112
|
-
for (const e of acceptRisk) {
|
|
113
|
-
events.push({
|
|
114
|
-
category: 'accepted-risk', source: 'sca-policy.js',
|
|
115
|
-
at: null, findingId: e.cve || e.package || null, file: null,
|
|
116
|
-
line: null, outcome: 'accept-risk', raw: e,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
for (const e of _safe(() => (0,_fix_history_js__WEBPACK_IMPORTED_MODULE_3__/* .readLog */ .x6)(scanRoot))) {
|
|
120
|
-
events.push({
|
|
121
|
-
category: 'fixed-finding', source: 'fix-history.js',
|
|
122
|
-
at: e.appliedAt || null, findingId: e.findingId || e.stableId || null,
|
|
123
|
-
file: e.file || null, line: null, outcome: e.status || 'unknown', raw: e,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
for (const e of _safe(() => (0,_fix_metrics_js__WEBPACK_IMPORTED_MODULE_4__/* .loadFixAttempts */ .sU)(scanRoot))) {
|
|
127
|
-
events.push({
|
|
128
|
-
category: 'verification-outcome', source: 'fix-metrics.js',
|
|
129
|
-
at: e.at || null, findingId: e.stableId || null, file: null,
|
|
130
|
-
line: null, outcome: e.ok ? 'verified' : 'not-verified', raw: e,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return events;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Bucket events by day within a rolling `sinceDays`-day window — the same
|
|
139
|
-
* cutoff-window shape as posture/triage.js's own trend(). An event with no
|
|
140
|
-
* timestamp (or an unparseable one) cannot be placed on a time axis: it is
|
|
141
|
-
* counted once in `undated` per category rather than silently dropped or
|
|
142
|
-
* silently smeared into the window.
|
|
143
|
-
*/
|
|
144
|
-
function summarizeFeedbackTrend(events, { sinceDays = 30, now = Date.now() } = {}) {
|
|
145
|
-
const cutoff = now - sinceDays * MS_PER_DAY;
|
|
146
|
-
const byCategory = {};
|
|
147
|
-
for (const cat of CATEGORIES) byCategory[cat] = { total: 0, inWindow: 0, undated: 0 };
|
|
148
|
-
|
|
149
|
-
const dayBuckets = new Map(); // 'YYYY-MM-DD' -> { category: count }
|
|
150
|
-
for (const ev of Array.isArray(events) ? events : []) {
|
|
151
|
-
if (!ev || !CATEGORIES.includes(ev.category)) continue;
|
|
152
|
-
byCategory[ev.category].total++;
|
|
153
|
-
const t = ev.at ? Date.parse(ev.at) : NaN;
|
|
154
|
-
if (!Number.isFinite(t)) { byCategory[ev.category].undated++; continue; }
|
|
155
|
-
if (t < cutoff) continue;
|
|
156
|
-
byCategory[ev.category].inWindow++;
|
|
157
|
-
const dayKey = new Date(t).toISOString().slice(0, 10);
|
|
158
|
-
if (!dayBuckets.has(dayKey)) dayBuckets.set(dayKey, {});
|
|
159
|
-
const bucket = dayBuckets.get(dayKey);
|
|
160
|
-
bucket[ev.category] = (bucket[ev.category] || 0) + 1;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const series = [...dayBuckets.entries()]
|
|
164
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
165
|
-
.map(([day, counts]) => ({ day, counts }));
|
|
166
|
-
return { sinceDays, byCategory, series };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Convenience wrapper: collect + summarize in one call — same pattern as
|
|
171
|
-
* fix-metrics.js's fixDurationReport(scanRoot).
|
|
172
|
-
*/
|
|
173
|
-
function productionFeedbackReport(scanRoot, opts) {
|
|
174
|
-
const events = collectFeedbackEvents(scanRoot);
|
|
175
|
-
return { events, ...summarizeFeedbackTrend(events, opts) };
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* One block of human-readable summary, or null when nothing was measured
|
|
180
|
-
* at all — same "null when nothing measured" contract as
|
|
181
|
-
* renderFixDurationSummary, so a caller can skip the section entirely
|
|
182
|
-
* rather than print an empty header.
|
|
183
|
-
*/
|
|
184
|
-
function renderProductionFeedbackSummary(report) {
|
|
185
|
-
if (!report || !Array.isArray(report.events) || !report.events.length) return null;
|
|
186
|
-
const lines = [`Production feedback (last ${report.sinceDays}d):`];
|
|
187
|
-
for (const cat of CATEGORIES) {
|
|
188
|
-
const c = report.byCategory[cat];
|
|
189
|
-
if (!c || c.total === 0) continue;
|
|
190
|
-
const undatedNote = c.undated ? `, ${c.undated} undated` : '';
|
|
191
|
-
lines.push(` ${cat}: ${c.inWindow} in window / ${c.total} total${undatedNote}`);
|
|
192
|
-
}
|
|
193
|
-
return lines.length > 1 ? lines.join('\n') : null;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const _internals = { MS_PER_DAY };
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
/***/ })
|
|
200
|
-
|
|
201
|
-
};
|
package/dist/8126.index.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
export const id = 8126;
|
|
2
|
-
export const ids = [8126];
|
|
3
|
-
export const modules = {
|
|
4
|
-
|
|
5
|
-
/***/ 18126:
|
|
6
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
/* harmony export */ createCascadePool: () => (/* binding */ createCascadePool)
|
|
10
|
-
/* harmony export */ });
|
|
11
|
-
/* unused harmony export DEFAULT_GRACE_MS */
|
|
12
|
-
/* harmony import */ var node_worker_threads__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75919);
|
|
13
|
-
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76760);
|
|
14
|
-
/* harmony import */ var node_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73136);
|
|
15
|
-
// FR-202 phase 3b (D-0050): a pool of long-lived workers, each running engine.js's
|
|
16
|
-
// _runFileCascade for many files over its lifetime, instead of the one-shot-per-call
|
|
17
|
-
// model runWithDeadline/analyzer-supervisor.js uses (which is correct for FR-202's
|
|
18
|
-
// primitive-level proof but would force whole-project setup — _buildProjectIndex,
|
|
19
|
-
// _buildGlobalJavaTaintedMethodIndex, _loadCustomRules — to redo per FILE, an O(n^2)
|
|
20
|
-
// cost across a scan). Each worker performs that setup ONCE at creation via
|
|
21
|
-
// _initCascadeWorkerState, then answers task messages over its lifetime.
|
|
22
|
-
//
|
|
23
|
-
// A task that exceeds its deadline+grace gets its OWN worker terminated (genuinely
|
|
24
|
-
// preemptive, mirroring analyzer-supervisor.js's worker.terminate() precedent) and a
|
|
25
|
-
// fresh replacement worker is spawned to keep the pool at full size for later files —
|
|
26
|
-
// one hung file costs one worker restart, not the whole scan.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// `new Worker()` needs a REAL file on disk -- once ncc bundles this module's code
|
|
32
|
-
// into a dist/ chunk, `import.meta.url` resolves to that chunk's location (dist/),
|
|
33
|
-
// not to src/pipeline/, so a naive path.join(HERE, 'cascade-worker.js') would look
|
|
34
|
-
// for a file that was never copied there. src/ always ships as a sibling of dist/
|
|
35
|
-
// (see package.json's "files"), in both a dev checkout and the published npm
|
|
36
|
-
// package, so fall back to the real, unbundled worker script in that case.
|
|
37
|
-
function _resolveDefaultWorkerScript() {
|
|
38
|
-
const hereDir = node_path__WEBPACK_IMPORTED_MODULE_1__.dirname((0,node_url__WEBPACK_IMPORTED_MODULE_2__.fileURLToPath)(import.meta.url));
|
|
39
|
-
if (node_path__WEBPACK_IMPORTED_MODULE_1__.basename(hereDir) === 'pipeline') return node_path__WEBPACK_IMPORTED_MODULE_1__.join(hereDir, 'cascade-worker.js');
|
|
40
|
-
return node_path__WEBPACK_IMPORTED_MODULE_1__.join(hereDir, '..', 'src', 'pipeline', 'cascade-worker.js');
|
|
41
|
-
}
|
|
42
|
-
const DEFAULT_WORKER_SCRIPT = _resolveDefaultWorkerScript();
|
|
43
|
-
const DEFAULT_GRACE_MS = 500;
|
|
44
|
-
|
|
45
|
-
function spawnReadyWorker({ workerScript, modulePath, fileContents, scanRoot }) {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
let settled = false;
|
|
48
|
-
const worker = new node_worker_threads__WEBPACK_IMPORTED_MODULE_0__.Worker(workerScript, { workerData: { modulePath, fileContents, scanRoot } });
|
|
49
|
-
const finish = (fn, value) => {
|
|
50
|
-
if (settled) return;
|
|
51
|
-
settled = true;
|
|
52
|
-
worker.off('message', onMessage);
|
|
53
|
-
worker.off('error', onError);
|
|
54
|
-
fn(value);
|
|
55
|
-
};
|
|
56
|
-
const onMessage = (msg) => {
|
|
57
|
-
if (!msg) return;
|
|
58
|
-
if (msg.type === 'ready') finish(resolve, worker);
|
|
59
|
-
else if (msg.type === 'init-error') { worker.terminate().catch(() => {}); finish(reject, new Error(msg.error)); }
|
|
60
|
-
};
|
|
61
|
-
const onError = (err) => { worker.terminate().catch(() => {}); finish(reject, err); };
|
|
62
|
-
worker.on('message', onMessage);
|
|
63
|
-
worker.on('error', onError);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @param {object} opts
|
|
69
|
-
* @param {Record<string,string>} opts.fileContents - broadcast once to every worker at creation.
|
|
70
|
-
* @param {string|null} opts.scanRoot
|
|
71
|
-
* @param {number} [opts.poolSize=4]
|
|
72
|
-
* @param {string} opts.modulePath - absolute path to the engine.js each worker imports.
|
|
73
|
-
* @param {string} [opts.workerScript] - defaults to cascade-worker.js next to this file.
|
|
74
|
-
* @param {number} [opts.graceMs]
|
|
75
|
-
*/
|
|
76
|
-
function createCascadePool(opts = {}) {
|
|
77
|
-
const {
|
|
78
|
-
fileContents = {},
|
|
79
|
-
scanRoot = null,
|
|
80
|
-
poolSize = 4,
|
|
81
|
-
workerScript = DEFAULT_WORKER_SCRIPT,
|
|
82
|
-
modulePath,
|
|
83
|
-
graceMs = DEFAULT_GRACE_MS,
|
|
84
|
-
} = opts;
|
|
85
|
-
if (!modulePath) throw new Error('createCascadePool requires opts.modulePath');
|
|
86
|
-
if (!(Number.isInteger(poolSize) && poolSize > 0)) throw new Error('createCascadePool requires opts.poolSize to be a positive integer');
|
|
87
|
-
|
|
88
|
-
const idle = [];
|
|
89
|
-
const pendingIdle = [];
|
|
90
|
-
const allWorkers = new Set();
|
|
91
|
-
let nextTaskId = 1;
|
|
92
|
-
let closed = false;
|
|
93
|
-
let spawnFailureCount = 0;
|
|
94
|
-
let lastSpawnError = null;
|
|
95
|
-
|
|
96
|
-
function spawnAndRegister() {
|
|
97
|
-
return spawnReadyWorker({ workerScript, modulePath, fileContents, scanRoot }).then((w) => {
|
|
98
|
-
allWorkers.add(w);
|
|
99
|
-
return w;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Background respawn after a killed worker (see runFile's timeout branch)
|
|
104
|
-
// is deliberately fire-and-forget -- the timed-out task has already
|
|
105
|
-
// resolved and nothing is waiting on this promise -- but a swallowed
|
|
106
|
-
// failure here would otherwise shrink the pool invisibly (e.g. thread
|
|
107
|
-
// exhaustion making every future respawn fail silently forever). Track
|
|
108
|
-
// it instead of a bare `.catch(() => {})`.
|
|
109
|
-
function respawnInBackground() {
|
|
110
|
-
spawnAndRegister().then(releaseWorker).catch((err) => {
|
|
111
|
-
spawnFailureCount += 1;
|
|
112
|
-
lastSpawnError = err;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function releaseWorker(w) {
|
|
117
|
-
if (closed) { allWorkers.delete(w); w.terminate().catch(() => {}); return; }
|
|
118
|
-
if (pendingIdle.length) pendingIdle.shift()(w);
|
|
119
|
-
else idle.push(w);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function acquireWorker() {
|
|
123
|
-
if (idle.length) return Promise.resolve(idle.pop());
|
|
124
|
-
return new Promise((resolve) => pendingIdle.push(resolve));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const ready = Promise.all(
|
|
128
|
-
Array.from({ length: poolSize }, () => spawnAndRegister().then(releaseWorker))
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Run one file's cascade on a pooled worker. Resolves with
|
|
133
|
-
* {ok:true, result} | {ok:false, error} | {ok:false, timedOut:true, timeoutMs, graceMs}.
|
|
134
|
-
* Never rejects.
|
|
135
|
-
*/
|
|
136
|
-
async function runFile(p, c, taskScanRoot, detectorErrors, taskOpts = {}) {
|
|
137
|
-
await ready;
|
|
138
|
-
if (closed) return { ok: false, error: 'pool is closed' };
|
|
139
|
-
const timeoutMs = taskOpts.timeoutMs;
|
|
140
|
-
const worker = await acquireWorker();
|
|
141
|
-
const id = nextTaskId++;
|
|
142
|
-
return new Promise((resolve) => {
|
|
143
|
-
let settled = false;
|
|
144
|
-
let killTimer = null;
|
|
145
|
-
const onMessage = (msg) => {
|
|
146
|
-
if (settled || !msg || msg.id !== id) return;
|
|
147
|
-
settled = true;
|
|
148
|
-
if (killTimer) clearTimeout(killTimer);
|
|
149
|
-
worker.off('message', onMessage);
|
|
150
|
-
releaseWorker(worker);
|
|
151
|
-
resolve(msg.ok ? { ok: true, result: msg.result } : { ok: false, error: msg.error });
|
|
152
|
-
};
|
|
153
|
-
worker.on('message', onMessage);
|
|
154
|
-
if (Number.isFinite(timeoutMs) && timeoutMs > 0) {
|
|
155
|
-
killTimer = setTimeout(() => {
|
|
156
|
-
if (settled) return;
|
|
157
|
-
settled = true;
|
|
158
|
-
worker.off('message', onMessage);
|
|
159
|
-
allWorkers.delete(worker);
|
|
160
|
-
worker.terminate().catch(() => {});
|
|
161
|
-
if (!closed) respawnInBackground();
|
|
162
|
-
resolve({ ok: false, timedOut: true, timeoutMs, graceMs });
|
|
163
|
-
}, timeoutMs + graceMs);
|
|
164
|
-
killTimer.unref?.();
|
|
165
|
-
}
|
|
166
|
-
worker.postMessage({ type: 'task', id, p, c, scanRoot: taskScanRoot, detectorErrors });
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
async function shutdown() {
|
|
171
|
-
closed = true;
|
|
172
|
-
await ready.catch(() => {});
|
|
173
|
-
for (const w of allWorkers) await w.terminate().catch(() => {});
|
|
174
|
-
allWorkers.clear();
|
|
175
|
-
idle.length = 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
runFile,
|
|
180
|
-
shutdown,
|
|
181
|
-
ready,
|
|
182
|
-
DEFAULT_GRACE_MS: graceMs,
|
|
183
|
-
getSpawnFailureCount: () => spawnFailureCount,
|
|
184
|
-
getLastSpawnError: () => lastSpawnError,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
/***/ })
|
|
190
|
-
|
|
191
|
-
};
|
package/dist/8178.index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
export const id = 8178;
|
|
2
|
-
export const ids = [8178];
|
|
3
|
-
export const modules = {
|
|
4
|
-
|
|
5
|
-
/***/ 48178:
|
|
6
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
/* harmony export */ exportFlowsCSV: () => (/* binding */ exportFlowsCSV)
|
|
10
|
-
/* harmony export */ });
|
|
11
|
-
/* harmony import */ var _protection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59114);
|
|
12
|
-
// export-csv.js — Milestone 4, sub-project JSON/CSV export.
|
|
13
|
-
//
|
|
14
|
-
// One row per FLOW (not node, not edge — the closest analogue in this
|
|
15
|
-
// domain to report/index.js's own toCSV's "one row per finding", per this
|
|
16
|
-
// sub-project's own scoping doc decision 3). Node/edge CSV exports are
|
|
17
|
-
// deferred, named explicitly in that doc, not attempted here.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Same escaping convention as report/index.js's own toCSV — quote only
|
|
22
|
-
// when a comma/quote/newline is present, double embedded quotes.
|
|
23
|
-
function esc(v) {
|
|
24
|
-
if (v == null) return '';
|
|
25
|
-
const s = String(v);
|
|
26
|
-
return /[",\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Join character for a flow's multiple `dataClasses` values in one CSV
|
|
30
|
-
// cell: `;`, not `,`. Chosen (this module's own decision, not prescribed
|
|
31
|
-
// by the plan) because `,` is CSV's own delimiter — joining multiple
|
|
32
|
-
// classes with it would put a raw delimiter inside a single logical cell
|
|
33
|
-
// value, forcing outer quoting for the ordinary multi-class case (e.g. a
|
|
34
|
-
// field classified both PCI and PII). `;` never collides with the CSV
|
|
35
|
-
// grammar, so the common case ("PCI;PII") never needs quoting at all.
|
|
36
|
-
// `esc()` still quotes correctly if a comma ends up in cell content for
|
|
37
|
-
// any other reason (see export-csv.test.js's own escaping test) — this
|
|
38
|
-
// choice only avoids manufacturing that case in the common path.
|
|
39
|
-
const DATA_CLASSES_JOIN = ';';
|
|
40
|
-
|
|
41
|
-
function _dataClassesForFlow(flow, dataElementsById) {
|
|
42
|
-
const classes = new Set();
|
|
43
|
-
for (const deId of flow.dataElementIds ?? []) {
|
|
44
|
-
const de = dataElementsById.get(deId);
|
|
45
|
-
for (const c of de?.dataClasses ?? []) classes.add(c);
|
|
46
|
-
}
|
|
47
|
-
return [...classes].sort();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _dimensionVerdict(flow, edgesById, dimension) {
|
|
51
|
-
const verdicts = (flow.edgeIds ?? [])
|
|
52
|
-
.map((id) => edgesById.get(id)?.protection?.[dimension]?.verdict)
|
|
53
|
-
.filter(Boolean);
|
|
54
|
-
return (0,_protection_js__WEBPACK_IMPORTED_MODULE_0__/* .aggregateVerdicts */ .SX)(verdicts);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function exportFlowsCSV(graph) {
|
|
58
|
-
const dataElementsById = new Map((graph.dataElements ?? []).map((d) => [d.id, d]));
|
|
59
|
-
const edgesById = new Map((graph.edges ?? []).map((e) => [e.id, e]));
|
|
60
|
-
const header = ['id', 'source', 'sink', 'dataClasses', 'transitVerdict', 'atRestVerdict', 'handlingVerdict', 'policyVerdict', 'coverageStatus'];
|
|
61
|
-
const rows = [header.join(',')];
|
|
62
|
-
for (const flow of graph.flows ?? []) {
|
|
63
|
-
rows.push([
|
|
64
|
-
esc(flow.id), esc(flow.source), esc(flow.sink),
|
|
65
|
-
esc(_dataClassesForFlow(flow, dataElementsById).join(DATA_CLASSES_JOIN)),
|
|
66
|
-
esc(_dimensionVerdict(flow, edgesById, 'transit')),
|
|
67
|
-
esc(_dimensionVerdict(flow, edgesById, 'atRest')),
|
|
68
|
-
esc(_dimensionVerdict(flow, edgesById, 'handling')),
|
|
69
|
-
esc(flow.policyVerdict), esc(flow.coverageStatus),
|
|
70
|
-
].join(','));
|
|
71
|
-
}
|
|
72
|
-
return rows.join('\n');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/***/ })
|
|
77
|
-
|
|
78
|
-
};
|
package/dist/8382.index.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export const id = 8382;
|
|
2
|
-
export const ids = [8382];
|
|
3
|
-
export const modules = {
|
|
4
|
-
|
|
5
|
-
/***/ 78382:
|
|
6
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
/* harmony export */ qc: () => (/* binding */ IMPACT_VERSION),
|
|
10
|
-
/* harmony export */ validateImpactAssessment: () => (/* binding */ validateImpactAssessment)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* unused harmony exports IMPACT_TARGET_KINDS, IMPACT_SCOPE_VALUES, IMPACT_TRACE_KINDS */
|
|
13
|
-
// impact-assessment.js — M5 deliverable #4 (FR-507 §10.10): the
|
|
14
|
-
// ImpactAssessment extension contract — the result of asking "what is
|
|
15
|
-
// reachable from this compromised node/edge/flow/data element, per the
|
|
16
|
-
// graph's own already-scanned evidence." NOT a DataFlowGraph v1 entity,
|
|
17
|
-
// mirrors recipient-profile.js's/scenario.js's own contract shape
|
|
18
|
-
// exactly (structural-only {valid, errors} validator, zero graph
|
|
19
|
-
// access at construction time).
|
|
20
|
-
//
|
|
21
|
-
// See docs/superpowers/plans/2026-09-02-data-flow-explorer-m5-blast-radius-impact-scoping.md
|
|
22
|
-
// for the full design reasoning, including why there is no
|
|
23
|
-
// affectedObligationIds field (ObligationMapping records are built on
|
|
24
|
-
// demand per compliance framework, not stored on the graph) and why
|
|
25
|
-
// `scope` is always 'possible' today (no runtime-corroboration layer
|
|
26
|
-
// exists yet).
|
|
27
|
-
|
|
28
|
-
const IMPACT_VERSION = '1.0.0';
|
|
29
|
-
|
|
30
|
-
const IMPACT_TARGET_KINDS = Object.freeze(['node', 'edge', 'flow', 'dataElement']);
|
|
31
|
-
|
|
32
|
-
// 'possible' is the only value any producer emits today — 'observed'
|
|
33
|
-
// is reserved for a future Digital Twin (M5 #7) increment with a real
|
|
34
|
-
// runtime-corroboration signal. Both are valid schema values now so
|
|
35
|
-
// that increment needs no breaking change to this contract later.
|
|
36
|
-
const IMPACT_SCOPE_VALUES = Object.freeze(['possible', 'observed']);
|
|
37
|
-
|
|
38
|
-
// Discloses WHICH of the two genuinely different traversal semantics
|
|
39
|
-
// produced this record (final-review I2 fix) — `scope` alone cannot
|
|
40
|
-
// distinguish them, since both families emit `scope: 'possible'`.
|
|
41
|
-
// 'topology_reachable': a `node` target's topology-wide showAllPaths
|
|
42
|
-
// BFS — "everything this compromised node could push to." 'flow_
|
|
43
|
-
// restricted': an `edge`/`flow`/`dataElement` target's direct trace
|
|
44
|
-
// over the flows that actually carry it — never the topology-wide BFS.
|
|
45
|
-
// Without this field a JSON consumer cannot tell "exact carrier trace"
|
|
46
|
-
// from "topological presumption" apart, the exact silent-conflation
|
|
47
|
-
// this codebase's own disclosure discipline exists to prevent.
|
|
48
|
-
const IMPACT_TRACE_KINDS = Object.freeze(['topology_reachable', 'flow_restricted']);
|
|
49
|
-
|
|
50
|
-
function _isNonEmptyString(v) { return typeof v === 'string' && v.length > 0; }
|
|
51
|
-
function _isStringArray(v) { return Array.isArray(v) && v.every((x) => typeof x === 'string'); }
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Structural validation only — mirrors validateRecipientProfile's/
|
|
55
|
-
* validateScenario's own {valid, errors} shape and "never throws"
|
|
56
|
-
* contract.
|
|
57
|
-
*/
|
|
58
|
-
function validateImpactAssessment(record) {
|
|
59
|
-
const errors = [];
|
|
60
|
-
const err = (p, message) => errors.push({ path: p, message });
|
|
61
|
-
if (!record || typeof record !== 'object' || Array.isArray(record)) {
|
|
62
|
-
err('$', 'ImpactAssessment record must be an object');
|
|
63
|
-
return { valid: false, errors };
|
|
64
|
-
}
|
|
65
|
-
if (!_isNonEmptyString(record.id) || !record.id.startsWith('impact:')) {
|
|
66
|
-
err('$.id', 'id is required and must start with "impact:"');
|
|
67
|
-
}
|
|
68
|
-
if (!_isNonEmptyString(record.version)) err('$.version', 'version is required');
|
|
69
|
-
if (!_isNonEmptyString(record.graphId)) err('$.graphId', 'graphId is required');
|
|
70
|
-
if (!_isNonEmptyString(record.graphDigest)) err('$.graphDigest', 'graphDigest is required');
|
|
71
|
-
if (!_isNonEmptyString(record.targetId)) err('$.targetId', 'targetId is required');
|
|
72
|
-
if (!IMPACT_TARGET_KINDS.includes(record.targetKind)) {
|
|
73
|
-
err('$.targetKind', `targetKind must be one of ${IMPACT_TARGET_KINDS.join('|')}`);
|
|
74
|
-
}
|
|
75
|
-
if (!IMPACT_SCOPE_VALUES.includes(record.scope)) {
|
|
76
|
-
err('$.scope', `scope must be one of ${IMPACT_SCOPE_VALUES.join('|')}`);
|
|
77
|
-
}
|
|
78
|
-
if (!IMPACT_TRACE_KINDS.includes(record.traceKind)) {
|
|
79
|
-
err('$.traceKind', `traceKind must be one of ${IMPACT_TRACE_KINDS.join('|')}`);
|
|
80
|
-
}
|
|
81
|
-
if (!_isStringArray(record.affectedNodeIds ?? [])) err('$.affectedNodeIds', 'affectedNodeIds must be an array of strings');
|
|
82
|
-
if (!_isStringArray(record.affectedEdgeIds ?? [])) err('$.affectedEdgeIds', 'affectedEdgeIds must be an array of strings');
|
|
83
|
-
if (!_isStringArray(record.affectedDataClasses ?? [])) err('$.affectedDataClasses', 'affectedDataClasses must be an array of strings');
|
|
84
|
-
if (!_isStringArray(record.affectedRecipientProfileIds ?? [])) err('$.affectedRecipientProfileIds', 'affectedRecipientProfileIds must be an array of strings');
|
|
85
|
-
if (!_isStringArray(record.coverageLimitations ?? [])) err('$.coverageLimitations', 'coverageLimitations must be an array of strings');
|
|
86
|
-
if (!_isNonEmptyString(record.generatedAt)) err('$.generatedAt', 'generatedAt is required');
|
|
87
|
-
return { valid: errors.length === 0, errors };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/***/ })
|
|
92
|
-
|
|
93
|
-
};
|