xploitscan-shared-rules 2.4.23 → 2.4.24

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/index.d.cts CHANGED
@@ -169,7 +169,7 @@ interface CustomRule {
169
169
  * before a scan can be saved without enough provenance to explain a changed
170
170
  * grade.
171
171
  */
172
- declare const SCANNER_VERSION = "2.4.23";
172
+ declare const SCANNER_VERSION = "2.4.24";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
@@ -198,14 +198,6 @@ declare function lineNumberAt(content: string, index: number): number;
198
198
  */
199
199
  declare function getSnippet(content: string, line: number, contextLines?: number): string;
200
200
 
201
- /**
202
- * Remove repeated reports of the same finding while preserving distinct
203
- * problems that happen to share a line.
204
- *
205
- * Multiple engines can surface the same custom-rule match, and some rules use
206
- * overlapping patterns. The title remains part of the key because one rule
207
- * may intentionally report two different problems at one location.
208
- */
209
201
  declare function deduplicateFindings<T extends Finding>(findings: readonly T[]): T[];
210
202
 
211
203
  /**
@@ -1270,6 +1262,21 @@ declare function runCustomRules(content: string, filePath: string, disabledRules
1270
1262
  */
1271
1263
  project?: ProjectContext): Finding[];
1272
1264
 
1265
+ /**
1266
+ * Per-handler auth exemptions shared by VC003 and VC065.
1267
+ *
1268
+ * A guard name only counts when it is called before the first side effect, or
1269
+ * sits in that route's own argument list, or a `.use(guard)` on the same
1270
+ * receiver registered earlier covers the path. A local guard counts only when
1271
+ * its body rejects (throw, redirect, session check, 401/403). An empty body or
1272
+ * `next()` alone does not. Fail closed: no handler slice means no exemption.
1273
+ */
1274
+ declare function authPrefixCovers(prefix: string, path: string): boolean;
1275
+ declare function isAnchoredPublicAuthPath(routePath: string): boolean;
1276
+ declare function isOgRoutePath(routePath: string): boolean;
1277
+ declare function routePathFromFile(filePath: string): string | null;
1278
+ declare function widenedAuthSuppresses(content: string, filePath: string, index: number, handler: string | null): boolean;
1279
+
1273
1280
  /**
1274
1281
  * Rule-set sizes as plain numbers, importable without dragging the rules in.
1275
1282
  *
@@ -1416,12 +1423,16 @@ interface AIFilterResult {
1416
1423
  reviewedCount: number;
1417
1424
  /** Every finding without a valid verdict, whatever the reason. */
1418
1425
  unreviewedCount: number;
1419
- /** Findings intentionally left outside the configured AI review cap. */
1426
+ /** Findings left unreviewed on purpose: past the cap, past the call ceiling, or dropped on a fence collision. */
1420
1427
  cappedCount: number;
1421
1428
  /** Findings that could not be reviewed because their source was unavailable. */
1422
1429
  missingContentCount: number;
1423
1430
  /** True only when the deadline or an individual model-call timeout elapsed. */
1424
1431
  timedOut: boolean;
1432
+ /** Findings left unreviewed because the deadline or a model call timed out. */
1433
+ timedOutCount: number;
1434
+ /** Findings left unreviewed because a call failed or the response did not contain exactly one verdict. */
1435
+ failedCount: number;
1425
1436
  /** #945 proof. Logged by the API as the fixed-shape ai_fp_mask line only. */
1426
1437
  maskStats: MaskStats;
1427
1438
  /** Present on every return, including the early exits. */
@@ -1838,4 +1849,4 @@ input: {
1838
1849
  content: string;
1839
1850
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1840
1851
 
1841
- export { type AIFilterResult, type AiDegraded, AiReason, AiStatus, AiSurface, type AppRoute, BILLING_WEBHOOK_UNMATCHED_KEYS, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, KEEP_SEVERITY_IN_TESTS, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PLAN_UNVERIFIED_NOTICE, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, PlanCause, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SCAN_AI_DEGRADED_KEYS, SCAN_TOKEN_NULL_KEYS, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, aiStatusLine, allRules, applyTestPathSeverity, assessHeaders, astMatch, billingWebhookUnmatchedProps, bucketFiles, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecretValues, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, maskSecretValue, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, perCallTimeoutMs, planCause, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, testPathHold, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
1852
+ export { type AIFilterResult, type AiDegraded, AiReason, AiStatus, AiSurface, type AppRoute, BILLING_WEBHOOK_UNMATCHED_KEYS, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, KEEP_SEVERITY_IN_TESTS, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PLAN_UNVERIFIED_NOTICE, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, PlanCause, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SCAN_AI_DEGRADED_KEYS, SCAN_TOKEN_NULL_KEYS, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, aiStatusLine, allRules, applyTestPathSeverity, assessHeaders, astMatch, authPrefixCovers, billingWebhookUnmatchedProps, bucketFiles, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecretValues, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isAnchoredPublicAuthPath, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isOgRoutePath, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, maskSecretValue, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, perCallTimeoutMs, planCause, qualityRules, replaceBlockComments, routeForFile, routePathFromFile, runCustomRules, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, testPathHold, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, widenedAuthSuppresses, xssVulnerability };
package/dist/index.d.ts CHANGED
@@ -169,7 +169,7 @@ interface CustomRule {
169
169
  * before a scan can be saved without enough provenance to explain a changed
170
170
  * grade.
171
171
  */
172
- declare const SCANNER_VERSION = "2.4.23";
172
+ declare const SCANNER_VERSION = "2.4.24";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
@@ -198,14 +198,6 @@ declare function lineNumberAt(content: string, index: number): number;
198
198
  */
199
199
  declare function getSnippet(content: string, line: number, contextLines?: number): string;
200
200
 
201
- /**
202
- * Remove repeated reports of the same finding while preserving distinct
203
- * problems that happen to share a line.
204
- *
205
- * Multiple engines can surface the same custom-rule match, and some rules use
206
- * overlapping patterns. The title remains part of the key because one rule
207
- * may intentionally report two different problems at one location.
208
- */
209
201
  declare function deduplicateFindings<T extends Finding>(findings: readonly T[]): T[];
210
202
 
211
203
  /**
@@ -1270,6 +1262,21 @@ declare function runCustomRules(content: string, filePath: string, disabledRules
1270
1262
  */
1271
1263
  project?: ProjectContext): Finding[];
1272
1264
 
1265
+ /**
1266
+ * Per-handler auth exemptions shared by VC003 and VC065.
1267
+ *
1268
+ * A guard name only counts when it is called before the first side effect, or
1269
+ * sits in that route's own argument list, or a `.use(guard)` on the same
1270
+ * receiver registered earlier covers the path. A local guard counts only when
1271
+ * its body rejects (throw, redirect, session check, 401/403). An empty body or
1272
+ * `next()` alone does not. Fail closed: no handler slice means no exemption.
1273
+ */
1274
+ declare function authPrefixCovers(prefix: string, path: string): boolean;
1275
+ declare function isAnchoredPublicAuthPath(routePath: string): boolean;
1276
+ declare function isOgRoutePath(routePath: string): boolean;
1277
+ declare function routePathFromFile(filePath: string): string | null;
1278
+ declare function widenedAuthSuppresses(content: string, filePath: string, index: number, handler: string | null): boolean;
1279
+
1273
1280
  /**
1274
1281
  * Rule-set sizes as plain numbers, importable without dragging the rules in.
1275
1282
  *
@@ -1416,12 +1423,16 @@ interface AIFilterResult {
1416
1423
  reviewedCount: number;
1417
1424
  /** Every finding without a valid verdict, whatever the reason. */
1418
1425
  unreviewedCount: number;
1419
- /** Findings intentionally left outside the configured AI review cap. */
1426
+ /** Findings left unreviewed on purpose: past the cap, past the call ceiling, or dropped on a fence collision. */
1420
1427
  cappedCount: number;
1421
1428
  /** Findings that could not be reviewed because their source was unavailable. */
1422
1429
  missingContentCount: number;
1423
1430
  /** True only when the deadline or an individual model-call timeout elapsed. */
1424
1431
  timedOut: boolean;
1432
+ /** Findings left unreviewed because the deadline or a model call timed out. */
1433
+ timedOutCount: number;
1434
+ /** Findings left unreviewed because a call failed or the response did not contain exactly one verdict. */
1435
+ failedCount: number;
1425
1436
  /** #945 proof. Logged by the API as the fixed-shape ai_fp_mask line only. */
1426
1437
  maskStats: MaskStats;
1427
1438
  /** Present on every return, including the early exits. */
@@ -1838,4 +1849,4 @@ input: {
1838
1849
  content: string;
1839
1850
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1840
1851
 
1841
- export { type AIFilterResult, type AiDegraded, AiReason, AiStatus, AiSurface, type AppRoute, BILLING_WEBHOOK_UNMATCHED_KEYS, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, KEEP_SEVERITY_IN_TESTS, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PLAN_UNVERIFIED_NOTICE, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, PlanCause, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SCAN_AI_DEGRADED_KEYS, SCAN_TOKEN_NULL_KEYS, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, aiStatusLine, allRules, applyTestPathSeverity, assessHeaders, astMatch, billingWebhookUnmatchedProps, bucketFiles, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecretValues, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, maskSecretValue, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, perCallTimeoutMs, planCause, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, testPathHold, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
1852
+ export { type AIFilterResult, type AiDegraded, AiReason, AiStatus, AiSurface, type AppRoute, BILLING_WEBHOOK_UNMATCHED_KEYS, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, KEEP_SEVERITY_IN_TESTS, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PLAN_UNVERIFIED_NOTICE, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, PlanCause, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SCAN_AI_DEGRADED_KEYS, SCAN_TOKEN_NULL_KEYS, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, aiStatusLine, allRules, applyTestPathSeverity, assessHeaders, astMatch, authPrefixCovers, billingWebhookUnmatchedProps, bucketFiles, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecretValues, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isAnchoredPublicAuthPath, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isOgRoutePath, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, maskSecretValue, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, perCallTimeoutMs, planCause, qualityRules, replaceBlockComments, routeForFile, routePathFromFile, runCustomRules, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, testPathHold, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, widenedAuthSuppresses, xssVulnerability };