guardrail-core 1.0.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/dist/__tests__/autopilot.test.d.ts +7 -0
- package/dist/__tests__/autopilot.test.d.ts.map +1 -0
- package/dist/__tests__/autopilot.test.js +156 -0
- package/dist/__tests__/tier-config.test.d.ts +9 -0
- package/dist/__tests__/tier-config.test.d.ts.map +1 -0
- package/dist/__tests__/tier-config.test.js +230 -0
- package/dist/__tests__/utils/hash-inline.test.d.ts +2 -0
- package/dist/__tests__/utils/hash-inline.test.d.ts.map +1 -0
- package/dist/__tests__/utils/hash-inline.test.js +62 -0
- package/dist/__tests__/utils/hash.test.d.ts +3 -0
- package/dist/__tests__/utils/hash.test.d.ts.map +1 -0
- package/dist/__tests__/utils/hash.test.js +95 -0
- package/dist/__tests__/utils/simple.test.d.ts +1 -0
- package/dist/__tests__/utils/simple.test.d.ts.map +1 -0
- package/dist/__tests__/utils/simple.test.js +10 -0
- package/dist/__tests__/utils/utils-simple.test.d.ts +1 -0
- package/dist/__tests__/utils/utils-simple.test.d.ts.map +1 -0
- package/dist/__tests__/utils/utils-simple.test.js +6 -0
- package/dist/__tests__/utils/utils.test.d.ts +15 -0
- package/dist/__tests__/utils/utils.test.d.ts.map +1 -0
- package/dist/__tests__/utils/utils.test.js +172 -0
- package/dist/autopilot/autopilot-runner.d.ts +33 -0
- package/dist/autopilot/autopilot-runner.d.ts.map +1 -0
- package/dist/autopilot/autopilot-runner.js +479 -0
- package/dist/autopilot/index.d.ts +6 -0
- package/dist/autopilot/index.d.ts.map +1 -0
- package/dist/autopilot/index.js +25 -0
- package/dist/autopilot/types.d.ts +102 -0
- package/dist/autopilot/types.d.ts.map +1 -0
- package/dist/autopilot/types.js +18 -0
- package/dist/cache/index.d.ts +7 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +22 -0
- package/dist/cache/redis-cache.d.ts +145 -0
- package/dist/cache/redis-cache.d.ts.map +1 -0
- package/dist/cache/redis-cache.js +459 -0
- package/dist/ci/github-actions.d.ts +77 -0
- package/dist/ci/github-actions.d.ts.map +1 -0
- package/dist/ci/github-actions.js +277 -0
- package/dist/ci/index.d.ts +12 -0
- package/dist/ci/index.d.ts.map +1 -0
- package/dist/ci/index.js +27 -0
- package/dist/ci/pre-commit.d.ts +65 -0
- package/dist/ci/pre-commit.d.ts.map +1 -0
- package/dist/ci/pre-commit.js +286 -0
- package/dist/entitlements.d.ts +149 -0
- package/dist/entitlements.d.ts.map +1 -0
- package/dist/entitlements.js +464 -0
- package/dist/env.d.ts +113 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +204 -0
- package/dist/fix-packs/__tests__/generate-fix-packs.test.d.ts +7 -0
- package/dist/fix-packs/__tests__/generate-fix-packs.test.d.ts.map +1 -0
- package/dist/fix-packs/__tests__/generate-fix-packs.test.js +250 -0
- package/dist/fix-packs/generate-fix-packs.d.ts +15 -0
- package/dist/fix-packs/generate-fix-packs.d.ts.map +1 -0
- package/dist/fix-packs/generate-fix-packs.js +505 -0
- package/dist/fix-packs/index.d.ts +8 -0
- package/dist/fix-packs/index.d.ts.map +1 -0
- package/dist/fix-packs/index.js +23 -0
- package/dist/fix-packs/types.d.ts +113 -0
- package/dist/fix-packs/types.d.ts.map +1 -0
- package/dist/fix-packs/types.js +71 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/metrics/prometheus.d.ts +99 -0
- package/dist/metrics/prometheus.d.ts.map +1 -0
- package/dist/metrics/prometheus.js +306 -0
- package/dist/quota-ledger.d.ts +119 -0
- package/dist/quota-ledger.d.ts.map +1 -0
- package/dist/quota-ledger.js +462 -0
- package/dist/rbac/__tests__/permissions.test.d.ts +8 -0
- package/dist/rbac/__tests__/permissions.test.d.ts.map +1 -0
- package/dist/rbac/__tests__/permissions.test.js +350 -0
- package/dist/rbac/index.d.ts +9 -0
- package/dist/rbac/index.d.ts.map +1 -0
- package/dist/rbac/index.js +32 -0
- package/dist/rbac/permissions.d.ts +71 -0
- package/dist/rbac/permissions.d.ts.map +1 -0
- package/dist/rbac/permissions.js +247 -0
- package/dist/rbac/types.d.ts +69 -0
- package/dist/rbac/types.d.ts.map +1 -0
- package/dist/rbac/types.js +213 -0
- package/dist/tier-config.d.ts +203 -0
- package/dist/tier-config.d.ts.map +1 -0
- package/dist/tier-config.js +675 -0
- package/dist/types.d.ts +365 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/utils.d.ts +36 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +127 -0
- package/dist/verified-autofix/__tests__/format-validator.test.d.ts +11 -0
- package/dist/verified-autofix/__tests__/format-validator.test.d.ts.map +1 -0
- package/dist/verified-autofix/__tests__/format-validator.test.js +285 -0
- package/dist/verified-autofix/__tests__/pipeline.test.d.ts +11 -0
- package/dist/verified-autofix/__tests__/pipeline.test.d.ts.map +1 -0
- package/dist/verified-autofix/__tests__/pipeline.test.js +389 -0
- package/dist/verified-autofix/__tests__/repo-fingerprint.test.d.ts +11 -0
- package/dist/verified-autofix/__tests__/repo-fingerprint.test.d.ts.map +1 -0
- package/dist/verified-autofix/__tests__/repo-fingerprint.test.js +236 -0
- package/dist/verified-autofix/__tests__/workspace.test.d.ts +11 -0
- package/dist/verified-autofix/__tests__/workspace.test.d.ts.map +1 -0
- package/dist/verified-autofix/__tests__/workspace.test.js +314 -0
- package/dist/verified-autofix/format-validator.d.ts +101 -0
- package/dist/verified-autofix/format-validator.d.ts.map +1 -0
- package/dist/verified-autofix/format-validator.js +446 -0
- package/dist/verified-autofix/index.d.ts +14 -0
- package/dist/verified-autofix/index.d.ts.map +1 -0
- package/dist/verified-autofix/index.js +39 -0
- package/dist/verified-autofix/pipeline.d.ts +68 -0
- package/dist/verified-autofix/pipeline.d.ts.map +1 -0
- package/dist/verified-autofix/pipeline.js +330 -0
- package/dist/verified-autofix/repo-fingerprint.d.ts +56 -0
- package/dist/verified-autofix/repo-fingerprint.d.ts.map +1 -0
- package/dist/verified-autofix/repo-fingerprint.js +396 -0
- package/dist/verified-autofix/workspace.d.ts +83 -0
- package/dist/verified-autofix/workspace.d.ts.map +1 -0
- package/dist/verified-autofix/workspace.js +454 -0
- package/dist/verified-autofix.d.ts +182 -0
- package/dist/verified-autofix.d.ts.map +1 -0
- package/dist/verified-autofix.js +1021 -0
- package/dist/visualization/dependency-graph.d.ts +79 -0
- package/dist/visualization/dependency-graph.d.ts.map +1 -0
- package/dist/visualization/dependency-graph.js +399 -0
- package/dist/visualization/index.d.ts +5 -0
- package/dist/visualization/index.d.ts.map +1 -0
- package/dist/visualization/index.js +20 -0
- package/package.json +29 -0
- package/src/__tests__/autopilot.test.ts +196 -0
- package/src/__tests__/tier-config.test.ts +289 -0
- package/src/__tests__/utils/hash-inline.test.ts +76 -0
- package/src/__tests__/utils/hash.test.ts +119 -0
- package/src/__tests__/utils/simple.test.ts +10 -0
- package/src/__tests__/utils/utils-simple.test.ts +5 -0
- package/src/__tests__/utils/utils.test.ts +203 -0
- package/src/autopilot/autopilot-runner.ts +503 -0
- package/src/autopilot/index.ts +6 -0
- package/src/autopilot/types.ts +119 -0
- package/src/cache/index.ts +7 -0
- package/src/cache/redis-cache.d.ts +155 -0
- package/src/cache/redis-cache.d.ts.map +1 -0
- package/src/cache/redis-cache.ts +517 -0
- package/src/ci/github-actions.ts +335 -0
- package/src/ci/index.ts +12 -0
- package/src/ci/pre-commit.ts +338 -0
- package/src/db/usage-schema.prisma +114 -0
- package/src/entitlements.ts +570 -0
- package/src/env.d.ts +68 -0
- package/src/env.d.ts.map +1 -0
- package/src/env.ts +247 -0
- package/src/fix-packs/__tests__/generate-fix-packs.test.ts +317 -0
- package/src/fix-packs/generate-fix-packs.ts +577 -0
- package/src/fix-packs/index.ts +8 -0
- package/src/fix-packs/types.ts +206 -0
- package/src/index.d.ts +7 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.ts +12 -0
- package/src/metrics/prometheus.d.ts +104 -0
- package/src/metrics/prometheus.d.ts.map +1 -0
- package/src/metrics/prometheus.ts +446 -0
- package/src/quota-ledger.ts +548 -0
- package/src/rbac/__tests__/permissions.test.ts +446 -0
- package/src/rbac/index.ts +46 -0
- package/src/rbac/permissions.ts +301 -0
- package/src/rbac/types.ts +298 -0
- package/src/tier-config.json +157 -0
- package/src/tier-config.ts +815 -0
- package/src/types.d.ts +365 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.ts +441 -0
- package/src/utils.d.ts +36 -0
- package/src/utils.d.ts.map +1 -0
- package/src/utils.ts +140 -0
- package/src/verified-autofix/__tests__/format-validator.test.ts +335 -0
- package/src/verified-autofix/__tests__/pipeline.test.ts +419 -0
- package/src/verified-autofix/__tests__/repo-fingerprint.test.ts +241 -0
- package/src/verified-autofix/__tests__/workspace.test.ts +373 -0
- package/src/verified-autofix/format-validator.ts +517 -0
- package/src/verified-autofix/index.ts +63 -0
- package/src/verified-autofix/pipeline.ts +403 -0
- package/src/verified-autofix/repo-fingerprint.ts +459 -0
- package/src/verified-autofix/workspace.ts +531 -0
- package/src/verified-autofix.ts +1187 -0
- package/src/visualization/dependency-graph.d.ts +85 -0
- package/src/visualization/dependency-graph.d.ts.map +1 -0
- package/src/visualization/dependency-graph.ts +495 -0
- package/src/visualization/index.ts +5 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fix Packs Generator
|
|
4
|
+
*
|
|
5
|
+
* Generates deterministic Fix Packs from findings and repo fingerprint.
|
|
6
|
+
* Groups findings by category, file proximity, and risk level.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.generateFixPacks = generateFixPacks;
|
|
43
|
+
exports.generateRepoFingerprint = generateRepoFingerprint;
|
|
44
|
+
exports.parseFindingsFromScanOutput = parseFindingsFromScanOutput;
|
|
45
|
+
const crypto = __importStar(require("crypto"));
|
|
46
|
+
const types_1 = require("./types");
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// CONSTANTS
|
|
49
|
+
// ============================================================================
|
|
50
|
+
const DEFAULT_MAX_PACK_SIZE = 10;
|
|
51
|
+
const DEFAULT_MIN_PACK_SIZE = 1;
|
|
52
|
+
const FILE_PROXIMITY_THRESHOLD = 2;
|
|
53
|
+
const CATEGORY_PRIORITY = {
|
|
54
|
+
secrets: 0,
|
|
55
|
+
auth: 1,
|
|
56
|
+
security: 2,
|
|
57
|
+
routes: 3,
|
|
58
|
+
mocks: 4,
|
|
59
|
+
placeholders: 5,
|
|
60
|
+
deps: 6,
|
|
61
|
+
types: 7,
|
|
62
|
+
tests: 8,
|
|
63
|
+
performance: 9,
|
|
64
|
+
};
|
|
65
|
+
const CATEGORY_STRATEGY = {
|
|
66
|
+
secrets: 'auto',
|
|
67
|
+
auth: 'guided',
|
|
68
|
+
security: 'guided',
|
|
69
|
+
routes: 'auto',
|
|
70
|
+
mocks: 'auto',
|
|
71
|
+
placeholders: 'auto',
|
|
72
|
+
deps: 'guided',
|
|
73
|
+
types: 'ai-assisted',
|
|
74
|
+
tests: 'ai-assisted',
|
|
75
|
+
performance: 'manual',
|
|
76
|
+
};
|
|
77
|
+
const CATEGORY_REQUIRES_REVIEW = {
|
|
78
|
+
secrets: false,
|
|
79
|
+
auth: true,
|
|
80
|
+
security: true,
|
|
81
|
+
routes: false,
|
|
82
|
+
mocks: false,
|
|
83
|
+
placeholders: false,
|
|
84
|
+
deps: true,
|
|
85
|
+
types: false,
|
|
86
|
+
tests: true,
|
|
87
|
+
performance: true,
|
|
88
|
+
};
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// MAIN GENERATOR
|
|
91
|
+
// ============================================================================
|
|
92
|
+
function generateFixPacks(options) {
|
|
93
|
+
const { findings, repoFingerprint, groupByCategory = true, groupByFileProximity = true, maxPackSize = DEFAULT_MAX_PACK_SIZE, minPackSize = DEFAULT_MIN_PACK_SIZE, } = options;
|
|
94
|
+
if (findings.length === 0) {
|
|
95
|
+
return {
|
|
96
|
+
packs: [],
|
|
97
|
+
ungrouped: [],
|
|
98
|
+
stats: {
|
|
99
|
+
totalFindings: 0,
|
|
100
|
+
totalPacks: 0,
|
|
101
|
+
byCategory: {},
|
|
102
|
+
bySeverity: {},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const sortedFindings = sortFindings(findings);
|
|
107
|
+
let grouped;
|
|
108
|
+
if (groupByCategory) {
|
|
109
|
+
grouped = groupByCategories(sortedFindings);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
grouped = new Map([['all', sortedFindings]]);
|
|
113
|
+
}
|
|
114
|
+
if (groupByFileProximity) {
|
|
115
|
+
grouped = applyFileProximityGrouping(grouped, maxPackSize);
|
|
116
|
+
}
|
|
117
|
+
const packs = [];
|
|
118
|
+
const ungrouped = [];
|
|
119
|
+
let packIndex = 0;
|
|
120
|
+
const sortedGroups = Array.from(grouped.entries()).sort((a, b) => {
|
|
121
|
+
const catA = a[1][0]?.category || 'performance';
|
|
122
|
+
const catB = b[1][0]?.category || 'performance';
|
|
123
|
+
return CATEGORY_PRIORITY[catA] - CATEGORY_PRIORITY[catB];
|
|
124
|
+
});
|
|
125
|
+
for (const [, groupFindings] of sortedGroups) {
|
|
126
|
+
if (groupFindings.length < minPackSize) {
|
|
127
|
+
ungrouped.push(...groupFindings);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const chunks = chunkFindings(groupFindings, maxPackSize);
|
|
131
|
+
for (const chunk of chunks) {
|
|
132
|
+
const pack = createFixPack(chunk, repoFingerprint, packIndex++);
|
|
133
|
+
packs.push(pack);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const stats = calculateStats(findings, packs);
|
|
137
|
+
return {
|
|
138
|
+
packs: sortPacksBySeverityAndPriority(packs),
|
|
139
|
+
ungrouped,
|
|
140
|
+
stats,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// ============================================================================
|
|
144
|
+
// SORTING
|
|
145
|
+
// ============================================================================
|
|
146
|
+
function sortFindings(findings) {
|
|
147
|
+
return [...findings].sort((a, b) => {
|
|
148
|
+
const severityDiff = (0, types_1.compareSeverity)(a.severity, b.severity);
|
|
149
|
+
if (severityDiff !== 0)
|
|
150
|
+
return severityDiff;
|
|
151
|
+
const categoryDiff = CATEGORY_PRIORITY[a.category] - CATEGORY_PRIORITY[b.category];
|
|
152
|
+
if (categoryDiff !== 0)
|
|
153
|
+
return categoryDiff;
|
|
154
|
+
const fileDiff = a.file.localeCompare(b.file);
|
|
155
|
+
if (fileDiff !== 0)
|
|
156
|
+
return fileDiff;
|
|
157
|
+
return (a.line || 0) - (b.line || 0);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function sortPacksBySeverityAndPriority(packs) {
|
|
161
|
+
return [...packs].sort((a, b) => {
|
|
162
|
+
const severityDiff = (0, types_1.compareSeverity)(a.severity, b.severity);
|
|
163
|
+
if (severityDiff !== 0)
|
|
164
|
+
return severityDiff;
|
|
165
|
+
return CATEGORY_PRIORITY[a.category] - CATEGORY_PRIORITY[b.category];
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// ============================================================================
|
|
169
|
+
// GROUPING
|
|
170
|
+
// ============================================================================
|
|
171
|
+
function groupByCategories(findings) {
|
|
172
|
+
const groups = new Map();
|
|
173
|
+
for (const finding of findings) {
|
|
174
|
+
const key = finding.category;
|
|
175
|
+
if (!groups.has(key)) {
|
|
176
|
+
groups.set(key, []);
|
|
177
|
+
}
|
|
178
|
+
groups.get(key).push(finding);
|
|
179
|
+
}
|
|
180
|
+
return groups;
|
|
181
|
+
}
|
|
182
|
+
function applyFileProximityGrouping(groups, _maxPackSize) {
|
|
183
|
+
const result = new Map();
|
|
184
|
+
for (const [category, findings] of groups) {
|
|
185
|
+
const fileGroups = new Map();
|
|
186
|
+
for (const finding of findings) {
|
|
187
|
+
const dirPath = getDirectoryPath(finding.file, FILE_PROXIMITY_THRESHOLD);
|
|
188
|
+
if (!fileGroups.has(dirPath)) {
|
|
189
|
+
fileGroups.set(dirPath, []);
|
|
190
|
+
}
|
|
191
|
+
fileGroups.get(dirPath).push(finding);
|
|
192
|
+
}
|
|
193
|
+
let subIndex = 0;
|
|
194
|
+
for (const [dirPath, dirFindings] of fileGroups) {
|
|
195
|
+
const key = `${category}:${dirPath}:${subIndex++}`;
|
|
196
|
+
result.set(key, dirFindings);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
function getDirectoryPath(filePath, depth) {
|
|
202
|
+
const parts = filePath.split(/[/\\]/);
|
|
203
|
+
if (parts.length <= depth) {
|
|
204
|
+
return parts.slice(0, -1).join('/') || '/';
|
|
205
|
+
}
|
|
206
|
+
return parts.slice(0, depth).join('/');
|
|
207
|
+
}
|
|
208
|
+
function chunkFindings(findings, maxSize) {
|
|
209
|
+
const chunks = [];
|
|
210
|
+
for (let i = 0; i < findings.length; i += maxSize) {
|
|
211
|
+
chunks.push(findings.slice(i, i + maxSize));
|
|
212
|
+
}
|
|
213
|
+
return chunks;
|
|
214
|
+
}
|
|
215
|
+
// ============================================================================
|
|
216
|
+
// PACK CREATION
|
|
217
|
+
// ============================================================================
|
|
218
|
+
function createFixPack(findings, repoFingerprint, index) {
|
|
219
|
+
const category = findings[0]?.category || 'security';
|
|
220
|
+
const severities = findings.map(f => f.severity);
|
|
221
|
+
const severity = (0, types_1.getHighestSeverity)(severities);
|
|
222
|
+
const files = [...new Set(findings.map(f => f.file))];
|
|
223
|
+
const packHash = generateDeterministicHash(findings, repoFingerprint);
|
|
224
|
+
const id = (0, types_1.generatePackId)(category, index, packHash);
|
|
225
|
+
const estimatedImpact = estimateImpact(findings, files);
|
|
226
|
+
const strategy = CATEGORY_STRATEGY[category];
|
|
227
|
+
const requiresHumanReview = CATEGORY_REQUIRES_REVIEW[category] ||
|
|
228
|
+
severity === 'critical' ||
|
|
229
|
+
estimatedImpact.riskLevel === 'high';
|
|
230
|
+
const title = generatePackTitle(category, findings.length, severity);
|
|
231
|
+
return {
|
|
232
|
+
id,
|
|
233
|
+
title,
|
|
234
|
+
severity,
|
|
235
|
+
findings,
|
|
236
|
+
files,
|
|
237
|
+
strategy,
|
|
238
|
+
estimatedImpact,
|
|
239
|
+
requiresHumanReview,
|
|
240
|
+
category,
|
|
241
|
+
createdAt: new Date().toISOString(),
|
|
242
|
+
metadata: {
|
|
243
|
+
repoFingerprint: repoFingerprint.hash,
|
|
244
|
+
generatedBy: 'guardrail-fix-packs',
|
|
245
|
+
version: '1.0.0',
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function generatePackTitle(category, findingCount, severity) {
|
|
250
|
+
const categoryNames = {
|
|
251
|
+
secrets: 'Secret Exposure',
|
|
252
|
+
auth: 'Authentication Issues',
|
|
253
|
+
security: 'Security Vulnerabilities',
|
|
254
|
+
routes: 'Route Integrity',
|
|
255
|
+
mocks: 'Mock/Demo Code',
|
|
256
|
+
placeholders: 'Placeholder Content',
|
|
257
|
+
deps: 'Dependency Issues',
|
|
258
|
+
types: 'Type Errors',
|
|
259
|
+
tests: 'Test Failures',
|
|
260
|
+
performance: 'Performance Issues',
|
|
261
|
+
};
|
|
262
|
+
const severityPrefix = severity === 'critical' || severity === 'high'
|
|
263
|
+
? `[${severity.toUpperCase()}] `
|
|
264
|
+
: '';
|
|
265
|
+
return `${severityPrefix}${categoryNames[category]} (${findingCount} ${findingCount === 1 ? 'issue' : 'issues'})`;
|
|
266
|
+
}
|
|
267
|
+
function generateDeterministicHash(findings, repoFingerprint) {
|
|
268
|
+
const data = findings.map(f => `${f.id}:${f.file}:${f.line || 0}`).sort().join('|');
|
|
269
|
+
const combined = `${repoFingerprint.hash}:${data}`;
|
|
270
|
+
return crypto.createHash('sha256').update(combined).digest('hex');
|
|
271
|
+
}
|
|
272
|
+
function estimateImpact(findings, files) {
|
|
273
|
+
const filesAffected = files.length;
|
|
274
|
+
const linesChanged = findings.reduce((sum, f) => {
|
|
275
|
+
const lineSpan = (f.endLine || f.line || 1) - (f.line || 1) + 1;
|
|
276
|
+
return sum + Math.max(lineSpan, 1);
|
|
277
|
+
}, 0);
|
|
278
|
+
let riskLevel = 'low';
|
|
279
|
+
const hasCritical = findings.some(f => f.severity === 'critical');
|
|
280
|
+
const hasHigh = findings.some(f => f.severity === 'high');
|
|
281
|
+
if (hasCritical || filesAffected > 10) {
|
|
282
|
+
riskLevel = 'high';
|
|
283
|
+
}
|
|
284
|
+
else if (hasHigh || filesAffected > 5) {
|
|
285
|
+
riskLevel = 'medium';
|
|
286
|
+
}
|
|
287
|
+
const confidence = calculateConfidence(findings);
|
|
288
|
+
const timeEstimateMinutes = Math.ceil(findings.length * 2 + filesAffected * 3);
|
|
289
|
+
return {
|
|
290
|
+
filesAffected,
|
|
291
|
+
linesChanged,
|
|
292
|
+
riskLevel,
|
|
293
|
+
confidence,
|
|
294
|
+
timeEstimateMinutes,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function calculateConfidence(findings) {
|
|
298
|
+
const hasAutoFix = findings.filter(f => f.suggestion).length;
|
|
299
|
+
const autoFixRatio = findings.length > 0 ? hasAutoFix / findings.length : 0;
|
|
300
|
+
const avgSeverityScore = findings.reduce((sum, f) => {
|
|
301
|
+
return sum + (4 - types_1.SEVERITY_ORDER[f.severity]);
|
|
302
|
+
}, 0) / Math.max(findings.length, 1);
|
|
303
|
+
return Math.min(100, Math.round((autoFixRatio * 50) + (avgSeverityScore * 10) + 20));
|
|
304
|
+
}
|
|
305
|
+
// ============================================================================
|
|
306
|
+
// STATS
|
|
307
|
+
// ============================================================================
|
|
308
|
+
function calculateStats(findings, packs) {
|
|
309
|
+
const byCategory = {};
|
|
310
|
+
const bySeverity = {};
|
|
311
|
+
for (const finding of findings) {
|
|
312
|
+
byCategory[finding.category] = (byCategory[finding.category] || 0) + 1;
|
|
313
|
+
bySeverity[finding.severity] = (bySeverity[finding.severity] || 0) + 1;
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
totalFindings: findings.length,
|
|
317
|
+
totalPacks: packs.length,
|
|
318
|
+
byCategory,
|
|
319
|
+
bySeverity,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
// ============================================================================
|
|
323
|
+
// REPO FINGERPRINT GENERATOR
|
|
324
|
+
// ============================================================================
|
|
325
|
+
function generateRepoFingerprint(projectPath, options) {
|
|
326
|
+
const fs = require('fs');
|
|
327
|
+
const path = require('path');
|
|
328
|
+
const name = options?.name || path.basename(projectPath);
|
|
329
|
+
let hasTypeScript = false;
|
|
330
|
+
let hasTests = false;
|
|
331
|
+
let packageManager;
|
|
332
|
+
let gitRemote;
|
|
333
|
+
try {
|
|
334
|
+
hasTypeScript = fs.existsSync(path.join(projectPath, 'tsconfig.json'));
|
|
335
|
+
}
|
|
336
|
+
catch { /* ignore */ }
|
|
337
|
+
try {
|
|
338
|
+
const testDirs = ['tests', 'test', '__tests__', 'spec'];
|
|
339
|
+
hasTests = testDirs.some(dir => fs.existsSync(path.join(projectPath, dir)));
|
|
340
|
+
}
|
|
341
|
+
catch { /* ignore */ }
|
|
342
|
+
try {
|
|
343
|
+
if (fs.existsSync(path.join(projectPath, 'pnpm-lock.yaml'))) {
|
|
344
|
+
packageManager = 'pnpm';
|
|
345
|
+
}
|
|
346
|
+
else if (fs.existsSync(path.join(projectPath, 'yarn.lock'))) {
|
|
347
|
+
packageManager = 'yarn';
|
|
348
|
+
}
|
|
349
|
+
else if (fs.existsSync(path.join(projectPath, 'package-lock.json'))) {
|
|
350
|
+
packageManager = 'npm';
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
catch { /* ignore */ }
|
|
354
|
+
try {
|
|
355
|
+
const { execSync } = require('child_process');
|
|
356
|
+
gitRemote = execSync('git remote get-url origin', {
|
|
357
|
+
cwd: projectPath,
|
|
358
|
+
encoding: 'utf8',
|
|
359
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
360
|
+
}).trim();
|
|
361
|
+
}
|
|
362
|
+
catch { /* ignore */ }
|
|
363
|
+
const fingerprintData = `${name}:${hasTypeScript}:${hasTests}:${packageManager || ''}:${gitRemote || ''}`;
|
|
364
|
+
const hash = crypto.createHash('sha256').update(fingerprintData).digest('hex').slice(0, 12);
|
|
365
|
+
return {
|
|
366
|
+
id: `repo-${hash}`,
|
|
367
|
+
name,
|
|
368
|
+
framework: options?.framework,
|
|
369
|
+
language: options?.language || (hasTypeScript ? 'typescript' : 'javascript'),
|
|
370
|
+
hasTypeScript,
|
|
371
|
+
hasTests,
|
|
372
|
+
packageManager,
|
|
373
|
+
gitRemote,
|
|
374
|
+
hash,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
// ============================================================================
|
|
378
|
+
// FINDING PARSERS
|
|
379
|
+
// ============================================================================
|
|
380
|
+
function parseFindingsFromScanOutput(scanOutput) {
|
|
381
|
+
const findings = [];
|
|
382
|
+
try {
|
|
383
|
+
const json = JSON.parse(scanOutput);
|
|
384
|
+
if (Array.isArray(json.findings)) {
|
|
385
|
+
return json.findings.map((f, i) => normalizeFinding(f, i));
|
|
386
|
+
}
|
|
387
|
+
if (Array.isArray(json.issues)) {
|
|
388
|
+
return json.issues.map((f, i) => normalizeFinding(f, i));
|
|
389
|
+
}
|
|
390
|
+
if (Array.isArray(json)) {
|
|
391
|
+
return json.map((f, i) => normalizeFinding(f, i));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
return parseTextFindings(scanOutput);
|
|
396
|
+
}
|
|
397
|
+
return findings;
|
|
398
|
+
}
|
|
399
|
+
function normalizeFinding(raw, index) {
|
|
400
|
+
return {
|
|
401
|
+
id: raw.id || raw.ruleId || `finding-${index}`,
|
|
402
|
+
category: normalizeCategory(raw.category || raw.type || 'security'),
|
|
403
|
+
severity: normalizeSeverity(raw.severity || raw.level || 'medium'),
|
|
404
|
+
title: raw.title || raw.message || raw.description || 'Unknown issue',
|
|
405
|
+
description: raw.description || raw.message || '',
|
|
406
|
+
file: raw.file || raw.filePath || raw.path || 'unknown',
|
|
407
|
+
line: raw.line || raw.startLine || raw.location?.line,
|
|
408
|
+
column: raw.column || raw.startColumn || raw.location?.column,
|
|
409
|
+
endLine: raw.endLine || raw.location?.endLine,
|
|
410
|
+
endColumn: raw.endColumn || raw.location?.endColumn,
|
|
411
|
+
code: raw.code || raw.source,
|
|
412
|
+
suggestion: raw.suggestion || raw.fix || raw.recommendation,
|
|
413
|
+
rule: raw.rule || raw.ruleId,
|
|
414
|
+
metadata: raw.metadata || {},
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function normalizeCategory(category) {
|
|
418
|
+
const categoryMap = {
|
|
419
|
+
'secret': 'secrets',
|
|
420
|
+
'secrets': 'secrets',
|
|
421
|
+
'credential': 'secrets',
|
|
422
|
+
'api-key': 'secrets',
|
|
423
|
+
'route': 'routes',
|
|
424
|
+
'routes': 'routes',
|
|
425
|
+
'dead-link': 'routes',
|
|
426
|
+
'orphan': 'routes',
|
|
427
|
+
'mock': 'mocks',
|
|
428
|
+
'mocks': 'mocks',
|
|
429
|
+
'demo': 'mocks',
|
|
430
|
+
'fake': 'mocks',
|
|
431
|
+
'auth': 'auth',
|
|
432
|
+
'authentication': 'auth',
|
|
433
|
+
'authorization': 'auth',
|
|
434
|
+
'placeholder': 'placeholders',
|
|
435
|
+
'placeholders': 'placeholders',
|
|
436
|
+
'lorem': 'placeholders',
|
|
437
|
+
'todo': 'placeholders',
|
|
438
|
+
'dep': 'deps',
|
|
439
|
+
'deps': 'deps',
|
|
440
|
+
'dependency': 'deps',
|
|
441
|
+
'dependencies': 'deps',
|
|
442
|
+
'vulnerability': 'deps',
|
|
443
|
+
'type': 'types',
|
|
444
|
+
'types': 'types',
|
|
445
|
+
'typescript': 'types',
|
|
446
|
+
'test': 'tests',
|
|
447
|
+
'tests': 'tests',
|
|
448
|
+
'spec': 'tests',
|
|
449
|
+
'security': 'security',
|
|
450
|
+
'xss': 'security',
|
|
451
|
+
'injection': 'security',
|
|
452
|
+
'performance': 'performance',
|
|
453
|
+
'perf': 'performance',
|
|
454
|
+
};
|
|
455
|
+
const normalized = category.toLowerCase();
|
|
456
|
+
return categoryMap[normalized] || 'security';
|
|
457
|
+
}
|
|
458
|
+
function normalizeSeverity(severity) {
|
|
459
|
+
const severityMap = {
|
|
460
|
+
'critical': 'critical',
|
|
461
|
+
'blocker': 'critical',
|
|
462
|
+
'high': 'high',
|
|
463
|
+
'error': 'high',
|
|
464
|
+
'major': 'high',
|
|
465
|
+
'medium': 'medium',
|
|
466
|
+
'warning': 'medium',
|
|
467
|
+
'moderate': 'medium',
|
|
468
|
+
'low': 'low',
|
|
469
|
+
'minor': 'low',
|
|
470
|
+
'info': 'info',
|
|
471
|
+
'informational': 'info',
|
|
472
|
+
'note': 'info',
|
|
473
|
+
};
|
|
474
|
+
const normalized = severity.toLowerCase();
|
|
475
|
+
return severityMap[normalized] || 'medium';
|
|
476
|
+
}
|
|
477
|
+
function parseTextFindings(text) {
|
|
478
|
+
const findings = [];
|
|
479
|
+
const lines = text.split('\n');
|
|
480
|
+
const patterns = [
|
|
481
|
+
/^(.+):(\d+):(\d+):\s*(error|warning|info):\s*(.+)$/i,
|
|
482
|
+
/^(.+)\((\d+),(\d+)\):\s*(error|warning|info)\s+\w+:\s*(.+)$/i,
|
|
483
|
+
/^\s*(error|warning|info)\s+(.+)\s+in\s+(.+):(\d+)/i,
|
|
484
|
+
];
|
|
485
|
+
let index = 0;
|
|
486
|
+
for (const line of lines) {
|
|
487
|
+
for (const pattern of patterns) {
|
|
488
|
+
const match = line.match(pattern);
|
|
489
|
+
if (match) {
|
|
490
|
+
findings.push({
|
|
491
|
+
id: `text-finding-${index++}`,
|
|
492
|
+
category: 'security',
|
|
493
|
+
severity: normalizeSeverity(match[4] || 'medium'),
|
|
494
|
+
title: match[5] || match[2] || 'Unknown issue',
|
|
495
|
+
description: line,
|
|
496
|
+
file: match[1] || match[3] || 'unknown',
|
|
497
|
+
line: parseInt(match[2] || match[4] || '0', 10) || undefined,
|
|
498
|
+
column: parseInt(match[3] || '0', 10) || undefined,
|
|
499
|
+
});
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return findings;
|
|
505
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fix-packs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Fix Packs Module
|
|
4
|
+
*
|
|
5
|
+
* First-class objects that group findings into actionable batches.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
__exportStar(require("./generate-fix-packs"), exports);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix Packs Types
|
|
3
|
+
*
|
|
4
|
+
* First-class objects that group findings into actionable batches.
|
|
5
|
+
* Used by CLI, Autopilot, and Verified AutoFix.
|
|
6
|
+
*/
|
|
7
|
+
import { Tier } from '../tier-config';
|
|
8
|
+
export declare const FINDING_CATEGORIES: readonly ["secrets", "routes", "mocks", "auth", "placeholders", "deps", "types", "tests", "security", "performance"];
|
|
9
|
+
export type FindingCategory = typeof FINDING_CATEGORIES[number];
|
|
10
|
+
export declare const SEVERITY_LEVELS: readonly ["critical", "high", "medium", "low", "info"];
|
|
11
|
+
export type SeverityLevel = typeof SEVERITY_LEVELS[number];
|
|
12
|
+
export declare const SEVERITY_ORDER: Record<SeverityLevel, number>;
|
|
13
|
+
export declare const FIX_STRATEGIES: readonly ["auto", "guided", "manual", "ai-assisted"];
|
|
14
|
+
export type FixStrategy = typeof FIX_STRATEGIES[number];
|
|
15
|
+
export interface Finding {
|
|
16
|
+
id: string;
|
|
17
|
+
category: FindingCategory;
|
|
18
|
+
severity: SeverityLevel;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
file: string;
|
|
22
|
+
line?: number;
|
|
23
|
+
column?: number;
|
|
24
|
+
endLine?: number;
|
|
25
|
+
endColumn?: number;
|
|
26
|
+
code?: string;
|
|
27
|
+
suggestion?: string;
|
|
28
|
+
rule?: string;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface FixPack {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
severity: SeverityLevel;
|
|
35
|
+
findings: Finding[];
|
|
36
|
+
files: string[];
|
|
37
|
+
strategy: FixStrategy;
|
|
38
|
+
estimatedImpact: EstimatedImpact;
|
|
39
|
+
requiresHumanReview: boolean;
|
|
40
|
+
category: FindingCategory;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
metadata?: FixPackMetadata;
|
|
43
|
+
}
|
|
44
|
+
export interface EstimatedImpact {
|
|
45
|
+
filesAffected: number;
|
|
46
|
+
linesChanged: number;
|
|
47
|
+
riskLevel: 'low' | 'medium' | 'high';
|
|
48
|
+
confidence: number;
|
|
49
|
+
timeEstimateMinutes: number;
|
|
50
|
+
}
|
|
51
|
+
export interface FixPackMetadata {
|
|
52
|
+
repoFingerprint?: string;
|
|
53
|
+
generatedBy?: string;
|
|
54
|
+
version?: string;
|
|
55
|
+
tags?: string[];
|
|
56
|
+
}
|
|
57
|
+
export interface RepoFingerprint {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
framework?: string;
|
|
61
|
+
language?: string;
|
|
62
|
+
hasTypeScript: boolean;
|
|
63
|
+
hasTests: boolean;
|
|
64
|
+
packageManager?: 'npm' | 'yarn' | 'pnpm';
|
|
65
|
+
gitRemote?: string;
|
|
66
|
+
hash: string;
|
|
67
|
+
}
|
|
68
|
+
export interface GenerateFixPacksOptions {
|
|
69
|
+
findings: Finding[];
|
|
70
|
+
repoFingerprint: RepoFingerprint;
|
|
71
|
+
groupByCategory?: boolean;
|
|
72
|
+
groupByFileProximity?: boolean;
|
|
73
|
+
maxPackSize?: number;
|
|
74
|
+
minPackSize?: number;
|
|
75
|
+
requiredTier?: Tier;
|
|
76
|
+
}
|
|
77
|
+
export interface GenerateFixPacksResult {
|
|
78
|
+
packs: FixPack[];
|
|
79
|
+
ungrouped: Finding[];
|
|
80
|
+
stats: {
|
|
81
|
+
totalFindings: number;
|
|
82
|
+
totalPacks: number;
|
|
83
|
+
byCategory: Record<FindingCategory, number>;
|
|
84
|
+
bySeverity: Record<SeverityLevel, number>;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface FixPackExecutionOptions {
|
|
88
|
+
pack: FixPack;
|
|
89
|
+
projectPath: string;
|
|
90
|
+
dryRun?: boolean;
|
|
91
|
+
autoApply?: boolean;
|
|
92
|
+
maxAttempts?: number;
|
|
93
|
+
onProgress?: (stage: string, message: string) => void;
|
|
94
|
+
}
|
|
95
|
+
export interface FixPackExecutionResult {
|
|
96
|
+
success: boolean;
|
|
97
|
+
packId: string;
|
|
98
|
+
appliedFixes: number;
|
|
99
|
+
skippedFixes: number;
|
|
100
|
+
errors: string[];
|
|
101
|
+
duration: number;
|
|
102
|
+
filesModified: string[];
|
|
103
|
+
diffs: Array<{
|
|
104
|
+
file: string;
|
|
105
|
+
content: string;
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
108
|
+
export declare function compareSeverity(a: SeverityLevel, b: SeverityLevel): number;
|
|
109
|
+
export declare function isHigherSeverity(a: SeverityLevel, b: SeverityLevel): boolean;
|
|
110
|
+
export declare function getHighestSeverity(severities: SeverityLevel[]): SeverityLevel;
|
|
111
|
+
export declare function generatePackId(category: FindingCategory, index: number, hash: string): string;
|
|
112
|
+
export declare function sortPacksBySeverity(packs: FixPack[]): FixPack[];
|
|
113
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fix-packs/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAMtC,eAAO,MAAM,kBAAkB,sHAWrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAMhE,eAAO,MAAM,eAAe,wDAAyD,CAAC;AACtF,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE3D,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAMxD,CAAC;AAMF,eAAO,MAAM,cAAc,sDAKjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAMxD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,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