@code-sentinel-cli/code-sentinel-cli 4.0.6 → 4.0.7

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.
Files changed (27) hide show
  1. package/dist/bin.js +16204 -9882
  2. package/dist/builtin-rules/static/general/dockerfile-dependency-confusion.rule.js +27 -2
  3. package/dist/builtin-rules/static/general/java-weak-randomness.rule.js +41 -0
  4. package/dist/builtin-rules/static/general/kubernetes-pod-security.rule.js +90 -0
  5. package/dist/builtin-rules/static/general/no-dynamic-code-eval.rule.js +84 -0
  6. package/dist/builtin-rules/static/general/no-hardcoded-secret.rule.js +179 -13
  7. package/dist/builtin-rules/static/general/no-reflective-access-override.rule.js +6 -23
  8. package/dist/builtin-rules/static/general/no-unsafe-html-sink.rule.js +50 -7
  9. package/dist/builtin-rules/static/general/openapi-https-credentials.rule.js +90 -0
  10. package/dist/builtin-rules/static/general/sensitive-exception-response.rule.js +44 -0
  11. package/dist/builtin-rules/static/general/sensitive-output-exposure.rule.js +1 -1
  12. package/dist/builtin-rules/static/spring-boot/explicit-csp-required.rule.js +37 -0
  13. package/dist/builtin-rules/static/spring-boot/no-command-injection.rule.js +7 -1
  14. package/dist/builtin-rules/static/spring-boot/no-devtools-in-production.rule.js +13 -16
  15. package/dist/builtin-rules/static/spring-boot/no-global-permit-all.rule.js +50 -0
  16. package/dist/builtin-rules/static/spring-boot/no-negative-sensitive-input.rule.js +91 -0
  17. package/dist/builtin-rules/static/spring-boot/no-path-traversal.rule.js +7 -1
  18. package/dist/builtin-rules/static/spring-boot/no-servlet-xss.rule.js +7 -1
  19. package/dist/builtin-rules/static/spring-boot/no-spel-injection.rule.js +7 -1
  20. package/dist/builtin-rules/static/spring-boot/no-sql-string-concat.rule.js +7 -1
  21. package/dist/builtin-rules/static/spring-boot/no-ssrf.rule.js +23 -3
  22. package/dist/builtin-rules/static/spring-boot/password-reset-without-proof.rule.js +84 -0
  23. package/dist/builtin-rules/static/spring-boot/stored-content-without-sanitization.rule.js +93 -0
  24. package/dist/index.d.ts +154 -18
  25. package/dist/index.js +16204 -9882
  26. package/node_modules/@code-sentinel/parsers/index.js +330 -198
  27. package/package.json +1 -1
@@ -0,0 +1,84 @@
1
+ import { maskJavaFiles } from '@code-sentinel/parsers';
2
+
3
+ // builtin-rules/static/spring-boot/password-reset-without-proof.rule.ts
4
+ var RESET_MAPPING_RE = /@(?:Post|Put|Patch|Request)Mapping\s*\(\s*(?:value\s*=\s*)?["'][^"']*(?:(?:reset|forgot|recover)[^"']*(?:password|credential)|(?:password|credential)[^"']*(?:reset|forgot|recover))[^"']*["'][^)]*\)/gi;
5
+ var METHOD_HEAD_RE = /(?:public|protected)\s+(?:[\w$.[\]?,<>]+\s+)+([A-Za-z_$][\w$]*)\s*\(([\s\S]{0,1200}?)\)\s*(?:throws\s+[^\{]+)?\{/;
6
+ var AUTHENTICATED_CONTEXT_RE = /@(?:PreAuthorize|PostAuthorize|Secured|RolesAllowed|DenyAll)\b|\b(?:Authentication|Principal)\s+[A-Za-z_$][\w$]*/i;
7
+ var PROOF_INPUT_RE = /\b(?:reset|recovery|verification|oneTime|one_time|otp|nonce|challenge)?(?:Token|Code)\b|\b(?:otp|nonce|challenge)\b/i;
8
+ var PROOF_USE_RE = /\b(?:verify|validate|consume|redeem|decode|authenticate|check)[A-Za-z0-9_$]*(?:Token|Code|Otp|Nonce|Challenge|Reset)[A-Za-z0-9_$]*\s*\(|\b(?:token|code|otp|nonce|challenge)\s*\.\s*(?:verify|validate|consume|redeem)\s*\(/i;
9
+ var isTestPath = (path) => /(?:^|[/\\])(?:test|tests|fixtures|mock)(?:[/\\]|$)/i.test(path) || /[._-](?:test|tests|spec)\.java$/i.test(path);
10
+ var closingBrace = (source, open) => {
11
+ let depth = 0;
12
+ let quote = null;
13
+ let escaped = false;
14
+ for (let i = open; i < source.length; i++) {
15
+ const ch = source[i];
16
+ if (quote) {
17
+ if (escaped) escaped = false;
18
+ else if (ch === "\\") escaped = true;
19
+ else if (ch === quote) quote = null;
20
+ continue;
21
+ }
22
+ if (ch === '"' || ch === "'") {
23
+ quote = ch;
24
+ continue;
25
+ }
26
+ if (ch === "{") depth++;
27
+ else if (ch === "}" && --depth === 0) return i;
28
+ }
29
+ return source.length;
30
+ };
31
+ var lineOf = (content, index) => content.slice(0, index).split("\n").length;
32
+ var rule = {
33
+ id: "spring-boot/password-reset-without-proof",
34
+ version: 1,
35
+ kind: "static-ts",
36
+ title: "Reset m\u1EADt kh\u1EA9u ph\u1EA3i ti\xEAu th\u1EE5 recovery proof",
37
+ description: "Ph\xE1t hi\u1EC7n endpoint reset/forgot/recover password kh\xF4ng nh\u1EADn ho\u1EB7c kh\xF4ng verify token, OTP, code, nonce hay challenge trong HTTP handler. Finding l\xE0 \u0111i\u1EC3m review li\xEAn file; service \u0111\u01B0\u1EE3c g\u1ECDi c\xF3 th\u1EC3 th\u1EF1c hi\u1EC7n ki\u1EC3m tra m\xE0 file controller kh\xF4ng th\u1EC3 hi\u1EC7n.",
38
+ severity: "warning",
39
+ category: "security",
40
+ languages: ["java"],
41
+ scope: "spring-boot",
42
+ requires: "text",
43
+ usesParser: false,
44
+ baseConfidence: 82,
45
+ check(ctx) {
46
+ if (isTestPath(ctx.file.path)) return [];
47
+ const source = maskJavaFiles([ctx.file])[0]?.content ?? ctx.file.content;
48
+ if (!/@(?:RestController|Controller)\b/.test(source)) return [];
49
+ const findings = [];
50
+ RESET_MAPPING_RE.lastIndex = 0;
51
+ for (const mapping of source.matchAll(RESET_MAPPING_RE)) {
52
+ const mappingIndex = mapping.index ?? 0;
53
+ const tail = source.slice(mappingIndex + mapping[0].length, mappingIndex + 4e3);
54
+ const method = METHOD_HEAD_RE.exec(tail);
55
+ if (!method || method.index > 900) continue;
56
+ const methodName = method[1] ?? "";
57
+ if (/verify|validate|check/i.test(`${mapping[0]} ${methodName}`)) continue;
58
+ const open = mappingIndex + mapping[0].length + method.index + method[0].length - 1;
59
+ const end = closingBrace(source, open);
60
+ const previousClose = source.lastIndexOf("}", mappingIndex);
61
+ const previousOpen = source.lastIndexOf("{", mappingIndex);
62
+ const annotationStart = Math.max(previousClose, previousOpen) + 1;
63
+ const annotationAndHead = source.slice(annotationStart, open);
64
+ const parameters = method[2] ?? "";
65
+ const body = source.slice(open + 1, end);
66
+ const hasAuthenticatedContext = AUTHENTICATED_CONTEXT_RE.test(annotationAndHead);
67
+ const hasProofInput = PROOF_INPUT_RE.test(parameters) || PROOF_INPUT_RE.test(body);
68
+ const verifiesProof = PROOF_USE_RE.test(body);
69
+ if (hasAuthenticatedContext || hasProofInput && verifiesProof) continue;
70
+ findings.push({
71
+ file: ctx.file.path,
72
+ range: { line: lineOf(source, mappingIndex), column: 1 },
73
+ confidence: hasProofInput ? 72 : 82,
74
+ message: "Endpoint kh\xF4i ph\u1EE5c m\u1EADt kh\u1EA9u kh\xF4ng ti\xEAu th\u1EE5 v\xE0 verify recovery proof trong handler; c\u1EA7n l\u1EA7n theo service \u0111\u1EC3 lo\u1EA1i tr\u1EEB reset ch\u1EC9 b\u1EB1ng \u0111\u1ECBnh danh ng\u01B0\u1EDDi d\xF9ng. [control=password-reset-proof-review]",
75
+ suggestion: "Y\xEAu c\u1EA7u token/OTP m\u1ED9t l\u1EA7n, c\xF3 h\u1EA1n d\xF9ng v\xE0 r\xE0ng bu\u1ED9c \u0111\xFAng user; consume token atomically tr\u01B0\u1EDBc khi \u0111\u1ED5i m\u1EADt kh\u1EA9u. Kh\xF4ng t\xE1ch endpoint \u201Cverify token\u201D kh\u1ECFi endpoint reset n\u1EBFu reset kh\xF4ng bu\u1ED9c tr\xECnh l\u1EA1i proof."
76
+ });
77
+ }
78
+ return findings;
79
+ }
80
+ };
81
+
82
+ export { rule };
83
+ //# sourceMappingURL=password-reset-without-proof.rule.js.map
84
+ //# sourceMappingURL=password-reset-without-proof.rule.js.map
@@ -0,0 +1,93 @@
1
+ import { maskJavaFiles } from '@code-sentinel/parsers';
2
+
3
+ // builtin-rules/static/spring-boot/stored-content-without-sanitization.rule.ts
4
+ var MUTATING_MAPPING_RE = /@(?:Post|Put|Patch)Mapping\s*\([^)]*\)/g;
5
+ var METHOD_HEAD_RE = /(?:public|protected)\s+(?:[\w$.[\]?,<>]+\s+)+([A-Za-z_$][\w$]*)\s*\(([\s\S]{0,1600}?)\)\s*(?:throws\s+[^\{]+)?\{/;
6
+ var REQUEST_BODY_RE = /@RequestBody(?:\s*\([^)]*\))?\s+(?:final\s+)?([\w$.<>?,]+)\s+([A-Za-z_$][\w$]*)/i;
7
+ var CONTENT_SURFACE_RE = /(?:notification|announcement|message|template|article|content|rich.?text|html|email|mail|page|post|description|reason)/i;
8
+ var SANITIZER_RE = /\b(?:sanitize|sanitise|cleanHtml|stripTags|escapeHtml|htmlEscape|encodeForHTML|encodeForHtml|Jsoup\s*\.\s*clean)\s*\(/i;
9
+ var isTestPath = (path) => /(?:^|[/\\])(?:test|tests|fixtures|mock)(?:[/\\]|$)/i.test(path) || /[._-](?:test|tests|spec)\.java$/i.test(path);
10
+ var closingBrace = (source, open) => {
11
+ let depth = 0;
12
+ let quote = null;
13
+ let escaped = false;
14
+ for (let i = open; i < source.length; i++) {
15
+ const ch = source[i];
16
+ if (quote) {
17
+ if (escaped) escaped = false;
18
+ else if (ch === "\\") escaped = true;
19
+ else if (ch === quote) quote = null;
20
+ continue;
21
+ }
22
+ if (ch === '"' || ch === "'") {
23
+ quote = ch;
24
+ continue;
25
+ }
26
+ if (ch === "{") depth++;
27
+ else if (ch === "}" && --depth === 0) return i;
28
+ }
29
+ return source.length;
30
+ };
31
+ var escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
32
+ var lineOf = (content, index) => content.slice(0, index).split("\n").length;
33
+ var hasSanitizedRequestBody = (body, variable) => new RegExp(
34
+ `${SANITIZER_RE.source.slice(0, -2)}\\s*\\([^;)]{0,300}\\b${escapeRegex(variable)}\\b`,
35
+ "i"
36
+ ).test(body);
37
+ var rule = {
38
+ id: "spring-boot/stored-content-without-sanitization",
39
+ version: 1,
40
+ kind: "static-ts",
41
+ title: "Review n\u1ED9i dung c\xF3 th\u1EC3 ch\u1EE9a HTML tr\u01B0\u1EDBc khi l\u01B0u",
42
+ description: "Ph\xE1t hi\u1EC7n endpoint qu\u1EA3n l\xFD notification/message/template/article/content nh\u1EADn @RequestBody r\u1ED3i save/update/persist m\xE0 kh\xF4ng c\xF3 sanitizer/encoder r\xF5 r\xE0ng. \u0110\xE2y l\xE0 candidate Stored XSS/HTML Injection; c\u1EA7n n\u1ED1i ti\u1EBFp t\u1EDBi sink render \u0111\u1EC3 x\xE1c nh\u1EADn.",
43
+ severity: "warning",
44
+ category: "security",
45
+ languages: ["java"],
46
+ scope: "spring-boot",
47
+ requires: "text",
48
+ usesParser: false,
49
+ baseConfidence: 72,
50
+ check(ctx) {
51
+ if (isTestPath(ctx.file.path)) return [];
52
+ const source = maskJavaFiles([ctx.file])[0]?.content ?? ctx.file.content;
53
+ if (!/@RestController\b/.test(source)) return [];
54
+ const className = /\bclass\s+([A-Za-z_$][\w$]*)/.exec(source)?.[1] ?? "";
55
+ const findings = [];
56
+ MUTATING_MAPPING_RE.lastIndex = 0;
57
+ for (const mapping of source.matchAll(MUTATING_MAPPING_RE)) {
58
+ const mappingIndex = mapping.index ?? 0;
59
+ const tail = source.slice(mappingIndex + mapping[0].length, mappingIndex + 5e3);
60
+ const method = METHOD_HEAD_RE.exec(tail);
61
+ if (!method || method.index > 1200) continue;
62
+ const parameters = method[2] ?? "";
63
+ const requestBody = REQUEST_BODY_RE.exec(parameters);
64
+ if (!requestBody) continue;
65
+ const dtoType = requestBody[1] ?? "";
66
+ const variable = requestBody[2] ?? "";
67
+ const methodName = method[1] ?? "";
68
+ const mappingPath = mapping[0].replace(/^@(?:Post|Put|Patch)Mapping/i, "");
69
+ const surface = `${className} ${methodName} ${dtoType} ${mappingPath}`;
70
+ if (!CONTENT_SURFACE_RE.test(surface)) continue;
71
+ const open = mappingIndex + mapping[0].length + method.index + method[0].length - 1;
72
+ const end = closingBrace(source, open);
73
+ const body = source.slice(open + 1, end);
74
+ const persisted = new RegExp(
75
+ `\\.\\s*(?:save|update|persist|upsert|store|create)\\s*\\([^;)]{0,300}\\b${escapeRegex(variable)}\\b[^;)]*\\)`,
76
+ "i"
77
+ ).test(body);
78
+ if (!persisted || hasSanitizedRequestBody(body, variable)) continue;
79
+ findings.push({
80
+ file: ctx.file.path,
81
+ range: { line: lineOf(source, mappingIndex), column: 1 },
82
+ confidence: 72,
83
+ message: "Request body c\u1EE7a b\u1EC1 m\u1EB7t qu\u1EA3n l\xFD n\u1ED9i dung \u0111\u01B0\u1EE3c l\u01B0u khi ch\u01B0a th\u1EA5y HTML sanitization/encoding; \u0111\xE2y l\xE0 candidate Stored XSS/HTML Injection c\u1EA7n n\u1ED1i t\u1EDBi sink render. [control=stored-html-review]",
84
+ suggestion: "X\xE1c \u0111\u1ECBnh field cho ph\xE9p rich text. N\u1EBFu kh\xF4ng c\u1EA7n HTML, reject tag/markup; n\u1EBFu c\u1EA7n, sanitize b\u1EB1ng allowlist \u1EDF server tr\u01B0\u1EDBc khi l\u01B0u v\xE0 output-encode \u0111\xFAng context khi render. Th\xEAm test payload qua c\u1EA3 create v\xE0 update."
85
+ });
86
+ }
87
+ return findings;
88
+ }
89
+ };
90
+
91
+ export { rule };
92
+ //# sourceMappingURL=stored-content-without-sanitization.rule.js.map
93
+ //# sourceMappingURL=stored-content-without-sanitization.rule.js.map
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Command } from 'commander';
2
2
  import { z } from 'zod';
3
3
  import { CliApiClient } from '@code-sentinel/contracts';
4
- import { AiGatePolicy, AiSkipGatePolicy, IParser, IRuleLoader, IAIClient, IAiExecutionTracker, IClusterAssembler, IClusterTreeBuilder, SourceFile, IAstDependencyGraphBuilder, ITaintAnalyzer, ITemplateComponentLinker, IReviewStore, ICacheStore, IReporter } from '@code-sentinel/core';
4
+ import { AiGatePolicy, AiSkipGatePolicy, SourceFile, IParser, IRuleLoader, IAIClient, IAiExecutionTracker, IClusterAssembler, IClusterTreeBuilder, IAstDependencyGraphBuilder, ITaintAnalyzer, ITemplateComponentLinker, IReviewStore, ICacheStore, IReporter } from '@code-sentinel/core';
5
5
  import { Instance } from 'ink';
6
6
  import { TransactionBoundaryFact } from '@code-sentinel/ai-engine';
7
- import { AiRuleExecutorCallback } from '@code-sentinel/rule-engine';
7
+ import { AuthorizationGuardContextLike, AiRuleExecutorCallback } from '@code-sentinel/rule-engine';
8
8
  import { Logger, Clock, Result, ConfigInvalidError, IOError } from '@code-sentinel/shared';
9
9
  import { DbHandle } from '@code-sentinel/storage';
10
10
 
@@ -233,6 +233,72 @@ declare const runInit: (options?: InitOptions) => Promise<number>;
233
233
 
234
234
  declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
235
235
  mode: z.ZodDefault<z.ZodEnum<["auto", "economy", "balanced", "performance"]>>;
236
+ packaging: z.ZodDefault<z.ZodEffects<z.ZodObject<{
237
+ defaultTarget: z.ZodOptional<z.ZodString>;
238
+ targets: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
239
+ entry: z.ZodEffects<z.ZodString, string, string>;
240
+ buildTool: z.ZodDefault<z.ZodEnum<["auto", "maven", "gradle"]>>;
241
+ include: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
242
+ exclude: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
243
+ }, "strip", z.ZodTypeAny, {
244
+ entry: string;
245
+ buildTool: "auto" | "maven" | "gradle";
246
+ include: string[];
247
+ exclude: string[];
248
+ }, {
249
+ entry: string;
250
+ buildTool?: "auto" | "maven" | "gradle" | undefined;
251
+ include?: string[] | undefined;
252
+ exclude?: string[] | undefined;
253
+ }>>>;
254
+ exclude: z.ZodEffects<z.ZodDefault<z.ZodArray<z.ZodString, "many">>, string[], string[] | undefined>;
255
+ maxFileBytes: z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]> | z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
256
+ maxArchiveBytes: z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]> | z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
257
+ }, "strip", z.ZodTypeAny, {
258
+ exclude: string[];
259
+ targets: Record<string, {
260
+ entry: string;
261
+ buildTool: "auto" | "maven" | "gradle";
262
+ include: string[];
263
+ exclude: string[];
264
+ }>;
265
+ maxFileBytes: number;
266
+ maxArchiveBytes: number;
267
+ defaultTarget?: string | undefined;
268
+ }, {
269
+ exclude?: string[] | undefined;
270
+ defaultTarget?: string | undefined;
271
+ targets?: Record<string, {
272
+ entry: string;
273
+ buildTool?: "auto" | "maven" | "gradle" | undefined;
274
+ include?: string[] | undefined;
275
+ exclude?: string[] | undefined;
276
+ }> | undefined;
277
+ maxFileBytes?: string | number | undefined;
278
+ maxArchiveBytes?: string | number | undefined;
279
+ }>, {
280
+ exclude: string[];
281
+ targets: Record<string, {
282
+ entry: string;
283
+ buildTool: "auto" | "maven" | "gradle";
284
+ include: string[];
285
+ exclude: string[];
286
+ }>;
287
+ maxFileBytes: number;
288
+ maxArchiveBytes: number;
289
+ defaultTarget?: string | undefined;
290
+ }, {
291
+ exclude?: string[] | undefined;
292
+ defaultTarget?: string | undefined;
293
+ targets?: Record<string, {
294
+ entry: string;
295
+ buildTool?: "auto" | "maven" | "gradle" | undefined;
296
+ include?: string[] | undefined;
297
+ exclude?: string[] | undefined;
298
+ }> | undefined;
299
+ maxFileBytes?: string | number | undefined;
300
+ maxArchiveBytes?: string | number | undefined;
301
+ }>>;
236
302
  include: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
237
303
  exclude: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
238
304
  rules: z.ZodDefault<z.ZodObject<{
@@ -274,7 +340,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
274
340
  overrides: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
275
341
  enabled: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>;
276
342
  severity: z.ZodOptional<z.ZodEnum<["info", "warning", "error", "blocker"]>>;
277
- confidence: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
343
+ confidence: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
278
344
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
279
345
  }, "strip", z.ZodTypeAny, {
280
346
  options?: Record<string, unknown> | undefined;
@@ -312,7 +378,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
312
378
  overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
313
379
  enabled: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>;
314
380
  severity: z.ZodOptional<z.ZodEnum<["info", "warning", "error", "blocker"]>>;
315
- confidence: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
381
+ confidence: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
316
382
  }, "strip", z.ZodTypeAny, {
317
383
  enabled?: boolean | undefined;
318
384
  severity?: "info" | "warning" | "error" | "blocker" | undefined;
@@ -690,7 +756,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
690
756
  profile: z.ZodDefault<z.ZodEffects<z.ZodObject<{
691
757
  name: z.ZodDefault<z.ZodEffects<z.ZodEnum<["fast", "deep", "balanced"]>, "deep" | "fast", "deep" | "balanced" | "fast">>;
692
758
  ai: z.ZodDefault<z.ZodEnum<["disabled", "advisory", "blocking"]>>;
693
- maxBudgetMs: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
759
+ maxBudgetMs: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
694
760
  }, "strip", z.ZodTypeAny, {
695
761
  name: "deep" | "fast";
696
762
  ai: "disabled" | "advisory" | "blocking";
@@ -1069,9 +1135,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1069
1135
  pentest: z.ZodDefault<z.ZodObject<{
1070
1136
  policy: z.ZodDefault<z.ZodObject<{
1071
1137
  password: z.ZodOptional<z.ZodObject<{
1072
- minLength: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1073
- maxAgeDays: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1074
- historyCount: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1138
+ minLength: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1139
+ maxAgeDays: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1140
+ historyCount: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1075
1141
  }, "strip", z.ZodTypeAny, {
1076
1142
  minLength?: number | undefined;
1077
1143
  maxAgeDays?: number | undefined;
@@ -1082,15 +1148,15 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1082
1148
  historyCount?: string | number | undefined;
1083
1149
  }>>;
1084
1150
  lockout: z.ZodOptional<z.ZodObject<{
1085
- captchaAfterFailures: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1151
+ captchaAfterFailures: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1086
1152
  }, "strip", z.ZodTypeAny, {
1087
1153
  captchaAfterFailures?: number | undefined;
1088
1154
  }, {
1089
1155
  captchaAfterFailures?: string | number | undefined;
1090
1156
  }>>;
1091
1157
  otp: z.ZodOptional<z.ZodObject<{
1092
- ttlSeconds: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1093
- maxWrongPerDay: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1158
+ ttlSeconds: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1159
+ maxWrongPerDay: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1094
1160
  singleValidAtATime: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>;
1095
1161
  }, "strip", z.ZodTypeAny, {
1096
1162
  ttlSeconds?: number | undefined;
@@ -1102,9 +1168,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1102
1168
  singleValidAtATime?: string | boolean | undefined;
1103
1169
  }>>;
1104
1170
  session: z.ZodOptional<z.ZodObject<{
1105
- idleTimeoutMinutes: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1106
- absoluteTimeoutHours: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1107
- tokenBits: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1171
+ idleTimeoutMinutes: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1172
+ absoluteTimeoutHours: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1173
+ tokenBits: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1108
1174
  }, "strip", z.ZodTypeAny, {
1109
1175
  idleTimeoutMinutes?: number | undefined;
1110
1176
  absoluteTimeoutHours?: number | undefined;
@@ -1115,7 +1181,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1115
1181
  tokenBits?: string | number | undefined;
1116
1182
  }>>;
1117
1183
  dependency: z.ZodOptional<z.ZodObject<{
1118
- minCvssScore: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>> | z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
1184
+ minCvssScore: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>> | z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>>;
1119
1185
  }, "strip", z.ZodTypeAny, {
1120
1186
  minCvssScore?: number | undefined;
1121
1187
  }, {
@@ -1166,6 +1232,21 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1166
1232
  minCvssScore?: string | number | undefined;
1167
1233
  } | undefined;
1168
1234
  }>>;
1235
+ /**
1236
+ * [ADR-0091] §10 — paths the AI checklist fold rules are NOT called on. Generated code is the
1237
+ * motivating case (MEASURED on `mcdt_bqp`: 1 153 of 1 487 service-tier files are Liferay
1238
+ * Service Builder output), and it stays CONFIG rather than a built-in list because a
1239
+ * framework's generated-code layout is a property of the project, not of the detector.
1240
+ * Matching is the same glob syntax `rules.pathOverrides` uses. Static rules are unaffected —
1241
+ * they are cheap, and narrowing THEM would silently narrow the deterministic verdicts.
1242
+ */
1243
+ aiScope: z.ZodDefault<z.ZodObject<{
1244
+ exclude: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1245
+ }, "strip", z.ZodTypeAny, {
1246
+ exclude: string[];
1247
+ }, {
1248
+ exclude?: string[] | undefined;
1249
+ }>>;
1169
1250
  }, "strip", z.ZodTypeAny, {
1170
1251
  policy: {
1171
1252
  password?: {
@@ -1190,6 +1271,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1190
1271
  minCvssScore?: number | undefined;
1191
1272
  } | undefined;
1192
1273
  };
1274
+ aiScope: {
1275
+ exclude: string[];
1276
+ };
1193
1277
  }, {
1194
1278
  policy?: {
1195
1279
  password?: {
@@ -1214,6 +1298,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1214
1298
  minCvssScore?: string | number | undefined;
1215
1299
  } | undefined;
1216
1300
  } | undefined;
1301
+ aiScope?: {
1302
+ exclude?: string[] | undefined;
1303
+ } | undefined;
1217
1304
  }>>;
1218
1305
  }, "strip", z.ZodTypeAny, {
1219
1306
  rules: {
@@ -1237,9 +1324,21 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1237
1324
  }> | undefined;
1238
1325
  }[];
1239
1326
  };
1240
- mode: "auto" | "economy" | "balanced" | "performance";
1241
1327
  include: string[];
1242
1328
  exclude: string[];
1329
+ mode: "auto" | "economy" | "balanced" | "performance";
1330
+ packaging: {
1331
+ exclude: string[];
1332
+ targets: Record<string, {
1333
+ entry: string;
1334
+ buildTool: "auto" | "maven" | "gradle";
1335
+ include: string[];
1336
+ exclude: string[];
1337
+ }>;
1338
+ maxFileBytes: number;
1339
+ maxArchiveBytes: number;
1340
+ defaultTarget?: string | undefined;
1341
+ };
1243
1342
  ai: {
1244
1343
  ollama: {
1245
1344
  model: string;
@@ -1400,6 +1499,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1400
1499
  minCvssScore?: number | undefined;
1401
1500
  } | undefined;
1402
1501
  };
1502
+ aiScope: {
1503
+ exclude: string[];
1504
+ };
1403
1505
  };
1404
1506
  }, {
1405
1507
  rules?: {
@@ -1423,9 +1525,21 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1423
1525
  }> | undefined;
1424
1526
  }[] | undefined;
1425
1527
  } | undefined;
1426
- mode?: "auto" | "economy" | "balanced" | "performance" | undefined;
1427
1528
  include?: string[] | undefined;
1428
1529
  exclude?: string[] | undefined;
1530
+ mode?: "auto" | "economy" | "balanced" | "performance" | undefined;
1531
+ packaging?: {
1532
+ exclude?: string[] | undefined;
1533
+ defaultTarget?: string | undefined;
1534
+ targets?: Record<string, {
1535
+ entry: string;
1536
+ buildTool?: "auto" | "maven" | "gradle" | undefined;
1537
+ include?: string[] | undefined;
1538
+ exclude?: string[] | undefined;
1539
+ }> | undefined;
1540
+ maxFileBytes?: string | number | undefined;
1541
+ maxArchiveBytes?: string | number | undefined;
1542
+ } | undefined;
1429
1543
  ai?: {
1430
1544
  ollama?: {
1431
1545
  model?: string | undefined;
@@ -1586,6 +1700,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1586
1700
  minCvssScore?: string | number | undefined;
1587
1701
  } | undefined;
1588
1702
  } | undefined;
1703
+ aiScope?: {
1704
+ exclude?: string[] | undefined;
1705
+ } | undefined;
1589
1706
  } | undefined;
1590
1707
  }>, {
1591
1708
  rules: {
@@ -1609,9 +1726,21 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1609
1726
  }> | undefined;
1610
1727
  }[];
1611
1728
  };
1612
- mode: "auto" | "economy" | "balanced" | "performance";
1613
1729
  include: string[];
1614
1730
  exclude: string[];
1731
+ mode: "auto" | "economy" | "balanced" | "performance";
1732
+ packaging: {
1733
+ exclude: string[];
1734
+ targets: Record<string, {
1735
+ entry: string;
1736
+ buildTool: "auto" | "maven" | "gradle";
1737
+ include: string[];
1738
+ exclude: string[];
1739
+ }>;
1740
+ maxFileBytes: number;
1741
+ maxArchiveBytes: number;
1742
+ defaultTarget?: string | undefined;
1743
+ };
1615
1744
  ai: {
1616
1745
  ollama: {
1617
1746
  model: string;
@@ -1772,6 +1901,9 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
1772
1901
  minCvssScore?: number | undefined;
1773
1902
  } | undefined;
1774
1903
  };
1904
+ aiScope: {
1905
+ exclude: string[];
1906
+ };
1775
1907
  };
1776
1908
  }, unknown>;
1777
1909
  type CodeReviewConfig = z.infer<typeof codeReviewConfigSchema>;
@@ -2475,6 +2607,8 @@ interface HistoryDiffOptions {
2475
2607
  declare const runHistoryList: (options?: HistoryListOptions) => Promise<number>;
2476
2608
  declare const runHistoryDiff: (options: HistoryDiffOptions) => Promise<number>;
2477
2609
 
2610
+ declare const scanAuthorizationGuardContext: (files: readonly SourceFile[]) => ((primaryPath: string) => AuthorizationGuardContextLike | undefined);
2611
+
2478
2612
  /**
2479
2613
  * Composition root — the ONLY place that imports from every package.
2480
2614
  *
@@ -2518,6 +2652,8 @@ interface Container {
2518
2652
  * pack. Always non-null (the function is stateless).
2519
2653
  */
2520
2654
  readonly transactionBoundaryExtractor: (files: readonly SourceFile[]) => readonly TransactionBoundaryFact[];
2655
+ /** [ADR-0092] step 3 — guard inventory for rules with `usesAuthorizationGuards: true`. */
2656
+ readonly authorizationGuardScanner: typeof scanAuthorizationGuardContext;
2521
2657
  readonly astGraphBuilder: IAstDependencyGraphBuilder;
2522
2658
  /**
2523
2659
  * Phase 15.4 — Tier-1 TS intra-procedural taint analyzer (ADR-0019).