@kevinrabun/judges 3.56.0 → 3.57.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 +12 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/cache-audit.d.ts +5 -0
- package/dist/commands/cache-audit.d.ts.map +1 -0
- package/dist/commands/cache-audit.js +220 -0
- package/dist/commands/cache-audit.js.map +1 -0
- package/dist/commands/comment-drift.d.ts +5 -0
- package/dist/commands/comment-drift.d.ts.map +1 -0
- package/dist/commands/comment-drift.js +229 -0
- package/dist/commands/comment-drift.js.map +1 -0
- package/dist/commands/error-ux.d.ts +5 -0
- package/dist/commands/error-ux.d.ts.map +1 -0
- package/dist/commands/error-ux.js +253 -0
- package/dist/commands/error-ux.js.map +1 -0
- package/dist/commands/event-leak.d.ts +5 -0
- package/dist/commands/event-leak.d.ts.map +1 -0
- package/dist/commands/event-leak.js +263 -0
- package/dist/commands/event-leak.js.map +1 -0
- package/dist/commands/idempotency-audit.d.ts +5 -0
- package/dist/commands/idempotency-audit.d.ts.map +1 -0
- package/dist/commands/idempotency-audit.js +223 -0
- package/dist/commands/idempotency-audit.js.map +1 -0
- package/dist/commands/privilege-path.d.ts +5 -0
- package/dist/commands/privilege-path.d.ts.map +1 -0
- package/dist/commands/privilege-path.js +234 -0
- package/dist/commands/privilege-path.js.map +1 -0
- package/dist/commands/timeout-audit.d.ts +5 -0
- package/dist/commands/timeout-audit.d.ts.map +1 -0
- package/dist/commands/timeout-audit.js +211 -0
- package/dist/commands/timeout-audit.js.map +1 -0
- package/dist/commands/type-boundary.d.ts +5 -0
- package/dist/commands/type-boundary.d.ts.map +1 -0
- package/dist/commands/type-boundary.js +236 -0
- package/dist/commands/type-boundary.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idempotency audit — verify retried/webhook operations are safely idempotent.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, extname } from "path";
|
|
6
|
+
// ─── File Collection ────────────────────────────────────────────────────────
|
|
7
|
+
const CODE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".java", ".go", ".rs"]);
|
|
8
|
+
function collectFiles(dir, max = 300) {
|
|
9
|
+
const files = [];
|
|
10
|
+
function walk(d) {
|
|
11
|
+
if (files.length >= max)
|
|
12
|
+
return;
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = readdirSync(d);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const e of entries) {
|
|
21
|
+
if (files.length >= max)
|
|
22
|
+
return;
|
|
23
|
+
if (e.startsWith(".") || e === "node_modules" || e === "dist" || e === "build")
|
|
24
|
+
continue;
|
|
25
|
+
const full = join(d, e);
|
|
26
|
+
try {
|
|
27
|
+
if (statSync(full).isDirectory())
|
|
28
|
+
walk(full);
|
|
29
|
+
else if (CODE_EXTS.has(extname(full)))
|
|
30
|
+
files.push(full);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* skip */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(dir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
41
|
+
function analyzeFile(filepath) {
|
|
42
|
+
const issues = [];
|
|
43
|
+
let content;
|
|
44
|
+
try {
|
|
45
|
+
content = readFileSync(filepath, "utf-8");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return issues;
|
|
49
|
+
}
|
|
50
|
+
const lines = content.split("\n");
|
|
51
|
+
const fullText = content;
|
|
52
|
+
const isRetryContext = /retry|webhook|queue|worker|consumer|handler|idempoten/i.test(fullText);
|
|
53
|
+
for (let i = 0; i < lines.length; i++) {
|
|
54
|
+
const line = lines[i];
|
|
55
|
+
// INSERT without ON CONFLICT / upsert in retry context
|
|
56
|
+
if (/INSERT\s+INTO/i.test(line) && isRetryContext) {
|
|
57
|
+
const block = lines.slice(i, Math.min(i + 3, lines.length)).join("\n");
|
|
58
|
+
if (!/ON\s+CONFLICT|ON\s+DUPLICATE|UPSERT|IF\s+NOT\s+EXISTS|MERGE/i.test(block)) {
|
|
59
|
+
issues.push({
|
|
60
|
+
file: filepath,
|
|
61
|
+
line: i + 1,
|
|
62
|
+
issue: "INSERT without conflict handling in retry path",
|
|
63
|
+
severity: "high",
|
|
64
|
+
detail: "Retry can cause duplicate rows — use INSERT ... ON CONFLICT or UPSERT",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Auto-increment counter mutation in handler
|
|
69
|
+
if (/\+\+|\+=\s*1|\.increment|\.incr\b/i.test(line)) {
|
|
70
|
+
if (/handler|webhook|consumer|worker|queue|retry/i.test(fullText)) {
|
|
71
|
+
const block = lines.slice(Math.max(0, i - 5), Math.min(i + 5, lines.length)).join("\n");
|
|
72
|
+
if (!/idempotency|dedup|idempotent|already.*processed/i.test(block)) {
|
|
73
|
+
issues.push({
|
|
74
|
+
file: filepath,
|
|
75
|
+
line: i + 1,
|
|
76
|
+
issue: "Counter increment in retry-able path",
|
|
77
|
+
severity: "high",
|
|
78
|
+
detail: "Counter mutation is not idempotent — repeated execution will over-count",
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Email/SMS/notification send without dedup
|
|
84
|
+
if (/sendEmail|sendSMS|sendNotification|notify|\.send\s*\(/i.test(line)) {
|
|
85
|
+
if (isRetryContext) {
|
|
86
|
+
const block = lines.slice(Math.max(0, i - 8), Math.min(i + 5, lines.length)).join("\n");
|
|
87
|
+
if (!/idempotency|dedup|already.*sent|sentIds|processed/i.test(block)) {
|
|
88
|
+
issues.push({
|
|
89
|
+
file: filepath,
|
|
90
|
+
line: i + 1,
|
|
91
|
+
issue: "Notification send without dedup in retry path",
|
|
92
|
+
severity: "high",
|
|
93
|
+
detail: "Retry will send duplicate notifications — track sent IDs or use idempotency key",
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Payment/charge without idempotency key
|
|
99
|
+
if (/charge|payment|transfer|payout|refund/i.test(line) && /\.(?:create|post|execute)\s*\(/i.test(line)) {
|
|
100
|
+
const block = lines.slice(i, Math.min(i + 5, lines.length)).join("\n");
|
|
101
|
+
if (!/idempotency|idempotent|dedup|Idempotency-Key/i.test(block)) {
|
|
102
|
+
issues.push({
|
|
103
|
+
file: filepath,
|
|
104
|
+
line: i + 1,
|
|
105
|
+
issue: "Financial operation without idempotency key",
|
|
106
|
+
severity: "high",
|
|
107
|
+
detail: "Payment operation lacks idempotency key — retry can cause double-charge",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Webhook handler without idempotency check
|
|
112
|
+
if (/webhook|eventHandler|onEvent|handleEvent/i.test(line) && /function|=>|async/.test(line)) {
|
|
113
|
+
const funcBlock = lines.slice(i, Math.min(i + 20, lines.length)).join("\n");
|
|
114
|
+
if (!/idempotency|dedup|already.*processed|processedIds|eventId/i.test(funcBlock)) {
|
|
115
|
+
issues.push({
|
|
116
|
+
file: filepath,
|
|
117
|
+
line: i + 1,
|
|
118
|
+
issue: "Webhook handler without idempotency guard",
|
|
119
|
+
severity: "medium",
|
|
120
|
+
detail: "Webhook providers may deliver events multiple times — check for prior processing",
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Queue consumer ACK before processing completes
|
|
125
|
+
if (/\.ack\s*\(|\.acknowledge/i.test(line)) {
|
|
126
|
+
const beforeBlock = lines.slice(Math.max(0, i - 3), i + 1).join("\n");
|
|
127
|
+
if (!/await|then|\.catch|try/i.test(beforeBlock)) {
|
|
128
|
+
issues.push({
|
|
129
|
+
file: filepath,
|
|
130
|
+
line: i + 1,
|
|
131
|
+
issue: "Queue ACK before processing completion",
|
|
132
|
+
severity: "high",
|
|
133
|
+
detail: "Acknowledging message before processing finishes — crash loses the message",
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// File write without atomic rename pattern
|
|
138
|
+
if (/writeFileSync|writeFile\s*\(|fs\.write/i.test(line)) {
|
|
139
|
+
if (isRetryContext) {
|
|
140
|
+
const block = lines.slice(i, Math.min(i + 5, lines.length)).join("\n");
|
|
141
|
+
if (!/rename|\.tmp|\.temp|atomic|swap/i.test(block)) {
|
|
142
|
+
issues.push({
|
|
143
|
+
file: filepath,
|
|
144
|
+
line: i + 1,
|
|
145
|
+
issue: "File write without atomic rename",
|
|
146
|
+
severity: "low",
|
|
147
|
+
detail: "Non-atomic write in retry path — crash during write corrupts the file",
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// DELETE without WHERE in retry context
|
|
153
|
+
if (/DELETE\s+FROM/i.test(line) && isRetryContext) {
|
|
154
|
+
const block = lines.slice(i, Math.min(i + 3, lines.length)).join("\n");
|
|
155
|
+
if (!/WHERE/i.test(block)) {
|
|
156
|
+
issues.push({
|
|
157
|
+
file: filepath,
|
|
158
|
+
line: i + 1,
|
|
159
|
+
issue: "DELETE without WHERE in retry path",
|
|
160
|
+
severity: "high",
|
|
161
|
+
detail: "Unbounded DELETE is dangerous in retry context — could wipe entire table",
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return issues;
|
|
167
|
+
}
|
|
168
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
169
|
+
export function runIdempotencyAudit(argv) {
|
|
170
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
171
|
+
console.log(`
|
|
172
|
+
judges idempotency-audit — Verify retry/webhook operations are safely idempotent
|
|
173
|
+
|
|
174
|
+
Usage:
|
|
175
|
+
judges idempotency-audit [dir]
|
|
176
|
+
judges idempotency-audit src/ --format json
|
|
177
|
+
|
|
178
|
+
Options:
|
|
179
|
+
[dir] Directory to scan (default: .)
|
|
180
|
+
--format json JSON output
|
|
181
|
+
--help, -h Show this help
|
|
182
|
+
|
|
183
|
+
Checks: INSERT without conflict handling, counter mutation in retries, notification dedup,
|
|
184
|
+
payment idempotency keys, webhook handler guards, queue ACK ordering, atomic file writes.
|
|
185
|
+
`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
189
|
+
const dir = argv.find((a) => !a.startsWith("-") && argv.indexOf(a) > 0) || ".";
|
|
190
|
+
const files = collectFiles(dir);
|
|
191
|
+
const allIssues = [];
|
|
192
|
+
for (const f of files)
|
|
193
|
+
allIssues.push(...analyzeFile(f));
|
|
194
|
+
const highCount = allIssues.filter((i) => i.severity === "high").length;
|
|
195
|
+
const medCount = allIssues.filter((i) => i.severity === "medium").length;
|
|
196
|
+
const score = Math.max(0, 100 - highCount * 10 - medCount * 4);
|
|
197
|
+
if (format === "json") {
|
|
198
|
+
console.log(JSON.stringify({
|
|
199
|
+
issues: allIssues,
|
|
200
|
+
score,
|
|
201
|
+
summary: { high: highCount, medium: medCount, total: allIssues.length },
|
|
202
|
+
timestamp: new Date().toISOString(),
|
|
203
|
+
}, null, 2));
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const badge = score >= 80 ? "✅ SAFE" : score >= 50 ? "⚠️ RISKY" : "❌ UNSAFE";
|
|
207
|
+
console.log(`\n Idempotency: ${badge} (${score}/100)\n ─────────────────────────────`);
|
|
208
|
+
if (allIssues.length === 0) {
|
|
209
|
+
console.log(" No idempotency issues detected.\n");
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
for (const issue of allIssues.slice(0, 25)) {
|
|
213
|
+
const icon = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
|
|
214
|
+
console.log(` ${icon} ${issue.issue}`);
|
|
215
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
216
|
+
console.log(` ${issue.detail}`);
|
|
217
|
+
}
|
|
218
|
+
if (allIssues.length > 25)
|
|
219
|
+
console.log(` ... and ${allIssues.length - 25} more`);
|
|
220
|
+
console.log(`\n Total: ${allIssues.length} | High: ${highCount} | Medium: ${medCount} | Score: ${score}/100\n`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=idempotency-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idempotency-audit.js","sourceRoot":"","sources":["../../src/commands/idempotency-audit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAYrC,+EAA+E;AAE/E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAExF,SAAS,YAAY,CAAC,GAAW,EAAE,GAAG,GAAG,GAAG;IAC1C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,SAAS,IAAI,CAAC,CAAS;QACrB,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG;YAAE,OAAO;QAChC,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,CAAC,CAAwB,CAAC;QAClD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG;gBAAE,OAAO;YAChC,I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
|
1
|
+
{"version":3,"file":"privilege-path.d.ts","sourceRoot":"","sources":["../../src/commands/privilege-path.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgNH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA+DrD"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privilege path — model authorization flows to find privilege-escalation paths.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, extname } from "path";
|
|
6
|
+
// ─── File Collection ────────────────────────────────────────────────────────
|
|
7
|
+
const CODE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".java", ".go", ".rs"]);
|
|
8
|
+
function collectFiles(dir, max = 300) {
|
|
9
|
+
const files = [];
|
|
10
|
+
function walk(d) {
|
|
11
|
+
if (files.length >= max)
|
|
12
|
+
return;
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = readdirSync(d);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const e of entries) {
|
|
21
|
+
if (files.length >= max)
|
|
22
|
+
return;
|
|
23
|
+
if (e.startsWith(".") || e === "node_modules" || e === "dist" || e === "build")
|
|
24
|
+
continue;
|
|
25
|
+
const full = join(d, e);
|
|
26
|
+
try {
|
|
27
|
+
if (statSync(full).isDirectory())
|
|
28
|
+
walk(full);
|
|
29
|
+
else if (CODE_EXTS.has(extname(full)))
|
|
30
|
+
files.push(full);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* skip */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(dir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
41
|
+
function analyzeFile(filepath) {
|
|
42
|
+
const issues = [];
|
|
43
|
+
let content;
|
|
44
|
+
try {
|
|
45
|
+
content = readFileSync(filepath, "utf-8");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return issues;
|
|
49
|
+
}
|
|
50
|
+
const lines = content.split("\n");
|
|
51
|
+
const fullText = content;
|
|
52
|
+
// Detect route/endpoint definitions
|
|
53
|
+
const isRouteFile = /(?:router|app)\.\s*(?:get|post|put|delete|patch|all)\s*\(|@(?:GET|POST|PUT|DELETE|PATCH|Controller|RequestMapping)/i.test(fullText);
|
|
54
|
+
for (let i = 0; i < lines.length; i++) {
|
|
55
|
+
const line = lines[i];
|
|
56
|
+
// Route without auth middleware
|
|
57
|
+
if (/(?:router|app)\.\s*(?:get|post|put|delete|patch)\s*\(\s*['"]([^'"]+)['"]/.test(line)) {
|
|
58
|
+
const routeMatch = line.match(/(?:router|app)\.\s*(?:get|post|put|delete|patch)\s*\(\s*['"]([^'"]+)['"]/);
|
|
59
|
+
if (routeMatch) {
|
|
60
|
+
const route = routeMatch[1];
|
|
61
|
+
const block = lines.slice(i, Math.min(i + 3, lines.length)).join("\n");
|
|
62
|
+
// Skip public routes
|
|
63
|
+
if (!/(?:health|status|ping|public|login|register|signup|webhook|callback)/i.test(route)) {
|
|
64
|
+
if (!/auth|authenticate|authorize|requireAuth|isAuthenticated|passport|guard|protect|jwt|token|session/i.test(block)) {
|
|
65
|
+
issues.push({
|
|
66
|
+
file: filepath,
|
|
67
|
+
line: i + 1,
|
|
68
|
+
issue: "Route without authentication middleware",
|
|
69
|
+
severity: "high",
|
|
70
|
+
detail: `${route} — no auth middleware detected; endpoint may be publicly accessible`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// IDOR: user ID from request used directly in query
|
|
77
|
+
if (/(?:req\.params|req\.query|req\.body|request\.\w+)\.\s*(?:id|userId|user_id)/i.test(line)) {
|
|
78
|
+
const block = lines.slice(i, Math.min(i + 8, lines.length)).join("\n");
|
|
79
|
+
if (/(?:findById|findOne|where|SELECT|DELETE|UPDATE)\s*\(/i.test(block)) {
|
|
80
|
+
if (!/req\.user|currentUser|session\.user|token\.sub|auth\.user/i.test(block)) {
|
|
81
|
+
issues.push({
|
|
82
|
+
file: filepath,
|
|
83
|
+
line: i + 1,
|
|
84
|
+
issue: "Potential IDOR — user ID from request without ownership check",
|
|
85
|
+
severity: "high",
|
|
86
|
+
detail: "User-supplied ID used in query without verifying ownership — attacker can access other users' data",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Role check using string comparison (fragile)
|
|
92
|
+
if (/role\s*===?\s*['"]admin['"]|role\s*===?\s*['"]superadmin['"]/i.test(line)) {
|
|
93
|
+
if (!/enum|const\s+ROLES|Role\./i.test(fullText)) {
|
|
94
|
+
issues.push({
|
|
95
|
+
file: filepath,
|
|
96
|
+
line: i + 1,
|
|
97
|
+
issue: "Role check with magic string",
|
|
98
|
+
severity: "medium",
|
|
99
|
+
detail: "Role comparison uses magic string — use enum/constant to prevent typo-based bypass",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Privilege escalation: self-assign role
|
|
104
|
+
if (/role|isAdmin|is_admin|permissions/i.test(line) && /req\.body|request\.body/i.test(line)) {
|
|
105
|
+
issues.push({
|
|
106
|
+
file: filepath,
|
|
107
|
+
line: i + 1,
|
|
108
|
+
issue: "Role/permission from user input",
|
|
109
|
+
severity: "high",
|
|
110
|
+
detail: "Role or permission value taken from request body — user can self-escalate privileges",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// Missing authorization on destructive operations
|
|
114
|
+
if (/\.(?:delete|destroy|remove|drop|truncate)\s*\(/i.test(line) && isRouteFile) {
|
|
115
|
+
const contextBlock = lines.slice(Math.max(0, i - 10), i + 1).join("\n");
|
|
116
|
+
if (!/authorize|permission|role|isAdmin|canDelete|allowed/i.test(contextBlock)) {
|
|
117
|
+
issues.push({
|
|
118
|
+
file: filepath,
|
|
119
|
+
line: i + 1,
|
|
120
|
+
issue: "Destructive operation without authorization check",
|
|
121
|
+
severity: "high",
|
|
122
|
+
detail: "Delete/destroy called without prior authorization — any authenticated user may execute it",
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// JWT token without signature verification
|
|
127
|
+
if (/jwt\.decode\s*\(/.test(line)) {
|
|
128
|
+
if (!/jwt\.verify|jsonwebtoken.*verify/i.test(fullText)) {
|
|
129
|
+
issues.push({
|
|
130
|
+
file: filepath,
|
|
131
|
+
line: i + 1,
|
|
132
|
+
issue: "JWT decoded without verification",
|
|
133
|
+
severity: "high",
|
|
134
|
+
detail: "jwt.decode() does NOT verify signature — use jwt.verify() to prevent token forgery",
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Hardcoded secrets/tokens in auth logic
|
|
139
|
+
if (/(?:secret|password|token|apiKey|api_key)\s*[:=]\s*['"][^'"]{8,}['"]/i.test(line)) {
|
|
140
|
+
if (!/test|spec|mock|fixture|example|sample/i.test(filepath)) {
|
|
141
|
+
issues.push({
|
|
142
|
+
file: filepath,
|
|
143
|
+
line: i + 1,
|
|
144
|
+
issue: "Hardcoded credential in auth logic",
|
|
145
|
+
severity: "high",
|
|
146
|
+
detail: "Secret/token hardcoded in source — extract to environment variable or secret manager",
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Session fixation: session ID not regenerated after login
|
|
151
|
+
if (/login|authenticate|signIn/i.test(line) && /function|=>|async/.test(line)) {
|
|
152
|
+
const funcBlock = lines.slice(i, Math.min(i + 30, lines.length)).join("\n");
|
|
153
|
+
if (/session/i.test(funcBlock) && !/regenerate|destroy.*session|req\.session\s*=\s*null/i.test(funcBlock)) {
|
|
154
|
+
issues.push({
|
|
155
|
+
file: filepath,
|
|
156
|
+
line: i + 1,
|
|
157
|
+
issue: "Session not regenerated after login",
|
|
158
|
+
severity: "medium",
|
|
159
|
+
detail: "Session ID persists across auth boundary — regenerate to prevent session fixation",
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// CORS: wildcard origin with credentials
|
|
164
|
+
if (/origin\s*:\s*['"]\*['"]|origin\s*:\s*true/.test(line)) {
|
|
165
|
+
const block = lines.slice(i, Math.min(i + 5, lines.length)).join("\n");
|
|
166
|
+
if (/credentials\s*:\s*true/i.test(block)) {
|
|
167
|
+
issues.push({
|
|
168
|
+
file: filepath,
|
|
169
|
+
line: i + 1,
|
|
170
|
+
issue: "CORS wildcard with credentials",
|
|
171
|
+
severity: "high",
|
|
172
|
+
detail: "Wildcard origin with credentials allows any site to make authenticated requests",
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return issues;
|
|
178
|
+
}
|
|
179
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
180
|
+
export function runPrivilegePath(argv) {
|
|
181
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
182
|
+
console.log(`
|
|
183
|
+
judges privilege-path — Model authorization flows to find escalation paths
|
|
184
|
+
|
|
185
|
+
Usage:
|
|
186
|
+
judges privilege-path [dir]
|
|
187
|
+
judges privilege-path src/ --format json
|
|
188
|
+
|
|
189
|
+
Options:
|
|
190
|
+
[dir] Directory to scan (default: .)
|
|
191
|
+
--format json JSON output
|
|
192
|
+
--help, -h Show this help
|
|
193
|
+
|
|
194
|
+
Checks: routes without auth, IDOR patterns, magic-string role checks, self-assigned roles,
|
|
195
|
+
unprotected destructive ops, JWT decode without verify, hardcoded secrets, session fixation, CORS.
|
|
196
|
+
`);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
200
|
+
const dir = argv.find((a) => !a.startsWith("-") && argv.indexOf(a) > 0) || ".";
|
|
201
|
+
const files = collectFiles(dir);
|
|
202
|
+
const allIssues = [];
|
|
203
|
+
for (const f of files)
|
|
204
|
+
allIssues.push(...analyzeFile(f));
|
|
205
|
+
const highCount = allIssues.filter((i) => i.severity === "high").length;
|
|
206
|
+
const medCount = allIssues.filter((i) => i.severity === "medium").length;
|
|
207
|
+
const score = Math.max(0, 100 - highCount * 10 - medCount * 4);
|
|
208
|
+
if (format === "json") {
|
|
209
|
+
console.log(JSON.stringify({
|
|
210
|
+
issues: allIssues,
|
|
211
|
+
score,
|
|
212
|
+
summary: { high: highCount, medium: medCount, total: allIssues.length },
|
|
213
|
+
timestamp: new Date().toISOString(),
|
|
214
|
+
}, null, 2));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
const badge = score >= 80 ? "✅ SECURE" : score >= 50 ? "⚠️ GAPS" : "❌ EXPOSED";
|
|
218
|
+
console.log(`\n Privilege Safety: ${badge} (${score}/100)\n ─────────────────────────────`);
|
|
219
|
+
if (allIssues.length === 0) {
|
|
220
|
+
console.log(" No privilege escalation paths detected.\n");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
for (const issue of allIssues.slice(0, 25)) {
|
|
224
|
+
const icon = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
|
|
225
|
+
console.log(` ${icon} ${issue.issue}`);
|
|
226
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
227
|
+
console.log(` ${issue.detail}`);
|
|
228
|
+
}
|
|
229
|
+
if (allIssues.length > 25)
|
|
230
|
+
console.log(` ... and ${allIssues.length - 25} more`);
|
|
231
|
+
console.log(`\n Total: ${allIssues.length} | High: ${highCount} | Medium: ${medCount} | Score: ${score}/100\n`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=privilege-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privilege-path.js","sourceRoot":"","sources":["../../src/commands/privilege-path.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,W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