@clear-capabilities/agentic-security-scanner 0.172.1 → 0.173.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -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 +28 -3
- 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 +272 -20
- 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/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/util/string-memo.js +38 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
export const id = 3314;
|
|
2
|
+
export const ids = [3314];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 33314:
|
|
6
|
+
/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ computePrDelta: () => (/* binding */ computePrDelta),
|
|
11
|
+
/* harmony export */ netNewGate: () => (/* binding */ netNewGate),
|
|
12
|
+
/* harmony export */ renderPrDeltaText: () => (/* binding */ renderPrDeltaText)
|
|
13
|
+
/* harmony export */ });
|
|
14
|
+
/* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31421);
|
|
15
|
+
/* harmony import */ var _util_git_hardening_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12179);
|
|
16
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28369);
|
|
17
|
+
/* harmony import */ var _language_discovery_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(41928);
|
|
18
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_engine_js__WEBPACK_IMPORTED_MODULE_2__]);
|
|
19
|
+
_engine_js__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
20
|
+
// Shadowscan / security-DELTA on PR (v0.72).
|
|
21
|
+
//
|
|
22
|
+
// Most SAST PR-comment integrations show absolute counts — "12 findings
|
|
23
|
+
// detected in changed files." Engineers can't act on that: 11 of those
|
|
24
|
+
// 12 already existed before they touched the file. They want a DELTA:
|
|
25
|
+
// what did THIS PR introduce, what did it remove, what changed.
|
|
26
|
+
//
|
|
27
|
+
// This module diffs two scans (PR branch vs base) by stableId and emits
|
|
28
|
+
// both a JSON delta and a human-readable summary suitable for embedding
|
|
29
|
+
// in a PR comment. Reuses the existing `history-scan.js` machinery for
|
|
30
|
+
// the at-ref scans.
|
|
31
|
+
//
|
|
32
|
+
// Algorithm:
|
|
33
|
+
// 1. Scan the base ref (in-memory via runFullScan, no checkout)
|
|
34
|
+
// 2. Scan the head ref (same way)
|
|
35
|
+
// 3. Key findings by stableId
|
|
36
|
+
// 4. Emit:
|
|
37
|
+
// - introduced: findings in head not in base
|
|
38
|
+
// - resolved: findings in base not in head
|
|
39
|
+
// - persistent: findings in both (changed severity/cwe → 'shifted')
|
|
40
|
+
// 5. Severity-summary counts each side
|
|
41
|
+
//
|
|
42
|
+
// Output shape stays stable so downstream renderers (advisor-tone PR
|
|
43
|
+
// comment) can transform without re-walking IR.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const FILE_EXT_RE = /\.(?:js|jsx|ts|tsx|mjs|cjs|py|java|cs|kt|go|rb|php|sol|swift|rs|tf|yml|yaml|json|toml|md|hs|lhs|hsc|hs-boot|nix|cabal)$/i;
|
|
51
|
+
const SEVERITIES = ['critical', 'high', 'medium', 'low', 'info'];
|
|
52
|
+
|
|
53
|
+
// `root` is the PR's repository — a scan target, not this project's own
|
|
54
|
+
// trusted checkout — hardened per FR-PROV-024 / the second Finding
|
|
55
|
+
// Provenance PRD audit (same exposure class as
|
|
56
|
+
// provenance/git-evidence.js's `_run`).
|
|
57
|
+
function _git(root, args) {
|
|
58
|
+
const r = (0,node_child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync)('git', (0,_util_git_hardening_js__WEBPACK_IMPORTED_MODULE_1__/* .hardenGitArgs */ .Ax)(args), { cwd: root, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, env: (0,_util_git_hardening_js__WEBPACK_IMPORTED_MODULE_1__/* .hardenGitEnv */ .Si)() });
|
|
59
|
+
return { ok: r.status === 0, stdout: r.stdout || '', stderr: r.stderr || '' };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function _readFileAtRef(root, ref, file) {
|
|
63
|
+
// `--no-textconv`: this blob-cat form of `show` (`<ref>:<file>`, not a
|
|
64
|
+
// diff) was verified NOT reachable via a hostile textconv driver in
|
|
65
|
+
// current git, same as git-evidence.js's getBlobAtCommit — kept for
|
|
66
|
+
// defense-in-depth/uniformity.
|
|
67
|
+
const r = _git(root, ['show', '--no-textconv', `${ref}:${file}`]);
|
|
68
|
+
return r.ok ? r.stdout : null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _listFilesAtRef(root, ref) {
|
|
72
|
+
const r = _git(root, ['ls-tree', '-r', '--name-only', ref]);
|
|
73
|
+
if (!r.ok) return [];
|
|
74
|
+
return r.stdout.trim().split('\n').filter(p => {
|
|
75
|
+
if (!p) return false;
|
|
76
|
+
if (p.includes('/node_modules/') || p.includes('/.venv/')) return false;
|
|
77
|
+
if ((0,_language_discovery_js__WEBPACK_IMPORTED_MODULE_3__/* .isLanguageExcludedPath */ .EG)(p)) return false;
|
|
78
|
+
return FILE_EXT_RE.test(p) || (0,_language_discovery_js__WEBPACK_IMPORTED_MODULE_3__/* .isLanguageManifest */ .mD)(p);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function _scanAtRef(root, ref) {
|
|
83
|
+
const files = _listFilesAtRef(root, ref);
|
|
84
|
+
const fileContents = {};
|
|
85
|
+
const depFileContents = {};
|
|
86
|
+
for (const f of files) {
|
|
87
|
+
const c = _readFileAtRef(root, ref, f);
|
|
88
|
+
if (c == null) continue;
|
|
89
|
+
// Haskell/Nix manifests and lock files are dependency inputs, not code (the same split a working-tree scan makes).
|
|
90
|
+
if ((0,_language_discovery_js__WEBPACK_IMPORTED_MODULE_3__/* .isLanguageManifest */ .mD)(f)) depFileContents[f] = c; else fileContents[f] = c;
|
|
91
|
+
}
|
|
92
|
+
// `provenance:false` — a base-ref snapshot, not the current working state.
|
|
93
|
+
// Beyond the wasted git walks, updateLifecycle marks every open stableId
|
|
94
|
+
// absent from the finding set it is handed as `remediated`; running the PR
|
|
95
|
+
// delta gate would silently rewrite the project's lifecycle store from the
|
|
96
|
+
// base ref's findings.
|
|
97
|
+
return (0,_engine_js__WEBPACK_IMPORTED_MODULE_2__/* .runFullScan */ .wW)({ fileContents, depFileContents, scanRoot: root, provenance: false }, () => {});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function _summary(findings) {
|
|
101
|
+
const out = { total: 0 };
|
|
102
|
+
for (const s of SEVERITIES) out[s] = 0;
|
|
103
|
+
for (const f of (findings || [])) {
|
|
104
|
+
const s = f.severity || 'info';
|
|
105
|
+
if (out[s] !== undefined) out[s]++;
|
|
106
|
+
out.total++;
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function _changedFiles(root, baseRef, headRef) {
|
|
112
|
+
// `--no-ext-diff`: found during the second-audit-remediation sweep — this
|
|
113
|
+
// is a `git diff` call site (`--name-only`, no content rendered, so not
|
|
114
|
+
// itself a verified exploit path today, same as runScan.js's
|
|
115
|
+
// `changedSince`), but every `diff` invocation in this codebase gets it
|
|
116
|
+
// uniformly per the live exploit VERIFIED in material-change.js's
|
|
117
|
+
// classifyGitDiff (external diff drivers fire on `git diff` even with
|
|
118
|
+
// `--no-textconv`, which is a surface `--no-textconv` alone does not close).
|
|
119
|
+
const r = _git(root, ['diff', '--name-only', '--no-ext-diff', `${baseRef}...${headRef}`]);
|
|
120
|
+
if (!r.ok) return new Set();
|
|
121
|
+
return new Set(r.stdout.trim().split('\n').filter(Boolean));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Top-level entry: compute the delta between two refs.
|
|
126
|
+
*
|
|
127
|
+
* root: scan root (a git repo)
|
|
128
|
+
* baseRef: the ref to compare against (e.g. main, origin/main)
|
|
129
|
+
* headRef: the ref to score (e.g. HEAD, the PR branch). Defaults HEAD.
|
|
130
|
+
*
|
|
131
|
+
* Returns:
|
|
132
|
+
* {
|
|
133
|
+
* baseRef, headRef,
|
|
134
|
+
* changedFiles: [...], // git diff --name-only base...head
|
|
135
|
+
* base: { findings, summary, secrets, supplyChain, logicVulns },
|
|
136
|
+
* head: { findings, summary, secrets, supplyChain, logicVulns },
|
|
137
|
+
* introduced: Finding[], // new in head only
|
|
138
|
+
* resolved: Finding[], // removed from base
|
|
139
|
+
* persistent: Finding[], // same stableId in both (no semantic change)
|
|
140
|
+
* shifted: Finding[], // same stableId, severity OR cwe changed
|
|
141
|
+
* summary: { introduced: SeveritySummary, resolved, persistent, net },
|
|
142
|
+
* }
|
|
143
|
+
*
|
|
144
|
+
* `net` is per-severity (head − base). A negative critical count means
|
|
145
|
+
* the PR resolved a critical finding overall.
|
|
146
|
+
*/
|
|
147
|
+
async function computePrDelta(root, { baseRef, headRef = 'HEAD' } = {}) {
|
|
148
|
+
if (!baseRef) throw new Error('computePrDelta: baseRef is required');
|
|
149
|
+
const changedFiles = [..._changedFiles(root, baseRef, headRef)];
|
|
150
|
+
const baseScan = await _scanAtRef(root, baseRef);
|
|
151
|
+
const headScan = await _scanAtRef(root, headRef);
|
|
152
|
+
const baseById = new Map();
|
|
153
|
+
const headById = new Map();
|
|
154
|
+
for (const f of (baseScan.findings || [])) {
|
|
155
|
+
const k = f.stableId || f.id;
|
|
156
|
+
if (k) baseById.set(k, f);
|
|
157
|
+
}
|
|
158
|
+
for (const f of (headScan.findings || [])) {
|
|
159
|
+
const k = f.stableId || f.id;
|
|
160
|
+
if (k) headById.set(k, f);
|
|
161
|
+
}
|
|
162
|
+
const introduced = [];
|
|
163
|
+
const resolved = [];
|
|
164
|
+
const persistent = [];
|
|
165
|
+
const shifted = [];
|
|
166
|
+
for (const [k, f] of headById) {
|
|
167
|
+
if (!baseById.has(k)) introduced.push(f);
|
|
168
|
+
else {
|
|
169
|
+
const base = baseById.get(k);
|
|
170
|
+
if (base.severity !== f.severity || base.cwe !== f.cwe) {
|
|
171
|
+
shifted.push({ from: base, to: f });
|
|
172
|
+
} else {
|
|
173
|
+
persistent.push(f);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
for (const [k, f] of baseById) {
|
|
178
|
+
if (!headById.has(k)) resolved.push(f);
|
|
179
|
+
}
|
|
180
|
+
// Net severity (head − base).
|
|
181
|
+
const net = {};
|
|
182
|
+
const baseSummary = _summary(baseScan.findings || []);
|
|
183
|
+
const headSummary = _summary(headScan.findings || []);
|
|
184
|
+
for (const s of [...SEVERITIES, 'total']) net[s] = (headSummary[s] || 0) - (baseSummary[s] || 0);
|
|
185
|
+
return {
|
|
186
|
+
baseRef, headRef,
|
|
187
|
+
changedFiles,
|
|
188
|
+
base: {
|
|
189
|
+
findings: baseScan.findings || [],
|
|
190
|
+
summary: baseSummary,
|
|
191
|
+
secrets: baseScan.secrets || [],
|
|
192
|
+
supplyChain: baseScan.supplyChain || [],
|
|
193
|
+
logicVulns: baseScan.logicVulns || [],
|
|
194
|
+
},
|
|
195
|
+
head: {
|
|
196
|
+
findings: headScan.findings || [],
|
|
197
|
+
summary: headSummary,
|
|
198
|
+
secrets: headScan.secrets || [],
|
|
199
|
+
supplyChain: headScan.supplyChain || [],
|
|
200
|
+
logicVulns: headScan.logicVulns || [],
|
|
201
|
+
},
|
|
202
|
+
introduced,
|
|
203
|
+
resolved,
|
|
204
|
+
persistent,
|
|
205
|
+
shifted,
|
|
206
|
+
summary: {
|
|
207
|
+
introduced: _summary(introduced),
|
|
208
|
+
resolved: _summary(resolved),
|
|
209
|
+
persistent: _summary(persistent),
|
|
210
|
+
net,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Lightweight text summary used as a CLI fallback when --json isn't set.
|
|
217
|
+
*/
|
|
218
|
+
// R24 (PRD §5) — net-new CI gate. Blocks the build ONLY on findings the PR
|
|
219
|
+
// INTRODUCED (delta.introduced), at or above `failOn` severity — never on the
|
|
220
|
+
// pre-existing backlog. This is the only SAST CI posture teams tolerate
|
|
221
|
+
// long-term. Pure + deterministic: takes a delta, returns the gate decision.
|
|
222
|
+
const _NETNEW_SEV_RANK = { critical: 3, high: 2, medium: 1, low: 0, info: -1 };
|
|
223
|
+
function netNewGate(delta, failOn = 'critical') {
|
|
224
|
+
const introduced = (delta && Array.isArray(delta.introduced)) ? delta.introduced : [];
|
|
225
|
+
if (failOn === 'none') return { fail: false, failOn, introducedCount: introduced.length, blocked: [] };
|
|
226
|
+
const threshold = _NETNEW_SEV_RANK[failOn] ?? 3;
|
|
227
|
+
const blocked = introduced.filter((f) => (_NETNEW_SEV_RANK[f.severity] ?? -1) >= threshold);
|
|
228
|
+
return { fail: blocked.length > 0, failOn, introducedCount: introduced.length, blocked };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function renderPrDeltaText(delta) {
|
|
232
|
+
const i = delta.summary.introduced;
|
|
233
|
+
const r = delta.summary.resolved;
|
|
234
|
+
const lines = [];
|
|
235
|
+
lines.push(`Delta: ${delta.baseRef} → ${delta.headRef}`);
|
|
236
|
+
lines.push(`Changed files: ${delta.changedFiles.length}`);
|
|
237
|
+
lines.push('');
|
|
238
|
+
if (delta.introduced.length === 0 && delta.resolved.length === 0 && delta.shifted.length === 0) {
|
|
239
|
+
lines.push('No security delta. Safe to merge.');
|
|
240
|
+
return lines.join('\n');
|
|
241
|
+
}
|
|
242
|
+
lines.push(`Introduced: ${delta.introduced.length} ` +
|
|
243
|
+
`(crit ${i.critical} · high ${i.high} · med ${i.medium} · low ${i.low})`);
|
|
244
|
+
lines.push(`Resolved: ${delta.resolved.length} ` +
|
|
245
|
+
`(crit ${r.critical} · high ${r.high} · med ${r.medium} · low ${r.low})`);
|
|
246
|
+
if (delta.shifted.length) lines.push(`Shifted: ${delta.shifted.length}`);
|
|
247
|
+
if (delta.introduced.length) {
|
|
248
|
+
lines.push('');
|
|
249
|
+
lines.push('Newly introduced:');
|
|
250
|
+
for (const f of delta.introduced.slice(0, 20)) {
|
|
251
|
+
lines.push(` + ${f.severity.padEnd(8)} ${f.cwe || ''} ${f.vuln} (${f.file}:${f.line})`);
|
|
252
|
+
}
|
|
253
|
+
if (delta.introduced.length > 20) lines.push(` … ${delta.introduced.length - 20} more`);
|
|
254
|
+
}
|
|
255
|
+
return lines.join('\n');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
__webpack_async_result__();
|
|
259
|
+
} catch(e) { __webpack_async_result__(e); } });
|
|
260
|
+
|
|
261
|
+
/***/ })
|
|
262
|
+
|
|
263
|
+
};
|