xploitscan-shared-rules 2.4.25 → 2.4.27

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.25";
172
+ declare const SCANNER_VERSION = "2.4.27";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
@@ -1266,7 +1266,16 @@ declare function authPrefixCovers(prefix: string, path: string): boolean;
1266
1266
  declare function isAnchoredPublicAuthPath(routePath: string): boolean;
1267
1267
  declare function isOgRoutePath(routePath: string): boolean;
1268
1268
  declare function routePathFromFile(filePath: string): string | null;
1269
- declare function widenedAuthSuppresses(content: string, filePath: string, index: number, handler: string | null): boolean;
1269
+ declare function widenedAuthSuppresses(content: string, filePath: string, index: number, handler: string | null, rawContent?: string, capability?: boolean, strictApp?: boolean): boolean;
1270
+
1271
+ declare function setStructuralFaultForTest(name: string | null): void;
1272
+ declare function structuralParseCount(): number;
1273
+ declare function resetStructuralState(): void;
1274
+ declare function publicHttpsUrl(value: string): boolean;
1275
+ declare function publicReadOnlyHandler(content: string, filePath: string, index: number, strictApp?: boolean): boolean;
1276
+ declare function capabilityTokenHandler(content: string, filePath: string, index: number): boolean;
1277
+ declare function bearerProvenanceSafe(content: string, filePath: string, index: number): boolean;
1278
+ declare function refineDirectObjectFindings(content: string, filePath: string, legacyLines: number[]): number[] | null;
1270
1279
 
1271
1280
  /**
1272
1281
  * Rule-set sizes as plain numbers, importable without dragging the rules in.
@@ -1459,6 +1468,25 @@ declare function filterFalsePositives(findings: Finding[], fileContents: Map<str
1459
1468
  surface?: AiSurface;
1460
1469
  }): Promise<AIFilterResult>;
1461
1470
 
1471
+ /**
1472
+ * Untrusted code and file text that will be placed in a model prompt.
1473
+ * Invisible characters are removed first, so a token split by them is
1474
+ * contiguous before the fence check.
1475
+ */
1476
+ declare function hardenUntrustedPromptText(text: string): string;
1477
+ /**
1478
+ * One line outside a data fence. Drops controls and invisible characters,
1479
+ * then caps the length the same way the review prompt always has.
1480
+ */
1481
+ declare function sanitizePromptField(text: string, max: number): string;
1482
+ /**
1483
+ * Text that will sit between a fence pair. Invisible characters are already
1484
+ * gone. A scanner fence that appears in the text is broken with a space so
1485
+ * it cannot match the closing delimiter. A short fence is only broken when
1486
+ * the text contains the delimiter itself, so ordinary source is unchanged.
1487
+ */
1488
+ declare function prepareUntrustedSpan(text: string, fence: string): string;
1489
+
1462
1490
  /**
1463
1491
  * Shannon-entropy based secret detection.
1464
1492
  *
@@ -1840,4 +1868,4 @@ input: {
1840
1868
  content: string;
1841
1869
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1842
1870
 
1843
- 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 };
1871
+ 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, bearerProvenanceSafe, billingWebhookUnmatchedProps, bucketFiles, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, capabilityTokenHandler, 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, hardenUntrustedPromptText, 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, prepareUntrustedSpan, publicHttpsUrl, publicReadOnlyHandler, qualityRules, refineDirectObjectFindings, replaceBlockComments, resetStructuralState, routeForFile, routePathFromFile, runCustomRules, sanitizePromptField, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, setStructuralFaultForTest, sqlInjection, stripeWebhookUnprotected, structuralParseCount, 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.25";
172
+ declare const SCANNER_VERSION = "2.4.27";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
@@ -1266,7 +1266,16 @@ declare function authPrefixCovers(prefix: string, path: string): boolean;
1266
1266
  declare function isAnchoredPublicAuthPath(routePath: string): boolean;
1267
1267
  declare function isOgRoutePath(routePath: string): boolean;
1268
1268
  declare function routePathFromFile(filePath: string): string | null;
1269
- declare function widenedAuthSuppresses(content: string, filePath: string, index: number, handler: string | null): boolean;
1269
+ declare function widenedAuthSuppresses(content: string, filePath: string, index: number, handler: string | null, rawContent?: string, capability?: boolean, strictApp?: boolean): boolean;
1270
+
1271
+ declare function setStructuralFaultForTest(name: string | null): void;
1272
+ declare function structuralParseCount(): number;
1273
+ declare function resetStructuralState(): void;
1274
+ declare function publicHttpsUrl(value: string): boolean;
1275
+ declare function publicReadOnlyHandler(content: string, filePath: string, index: number, strictApp?: boolean): boolean;
1276
+ declare function capabilityTokenHandler(content: string, filePath: string, index: number): boolean;
1277
+ declare function bearerProvenanceSafe(content: string, filePath: string, index: number): boolean;
1278
+ declare function refineDirectObjectFindings(content: string, filePath: string, legacyLines: number[]): number[] | null;
1270
1279
 
1271
1280
  /**
1272
1281
  * Rule-set sizes as plain numbers, importable without dragging the rules in.
@@ -1459,6 +1468,25 @@ declare function filterFalsePositives(findings: Finding[], fileContents: Map<str
1459
1468
  surface?: AiSurface;
1460
1469
  }): Promise<AIFilterResult>;
1461
1470
 
1471
+ /**
1472
+ * Untrusted code and file text that will be placed in a model prompt.
1473
+ * Invisible characters are removed first, so a token split by them is
1474
+ * contiguous before the fence check.
1475
+ */
1476
+ declare function hardenUntrustedPromptText(text: string): string;
1477
+ /**
1478
+ * One line outside a data fence. Drops controls and invisible characters,
1479
+ * then caps the length the same way the review prompt always has.
1480
+ */
1481
+ declare function sanitizePromptField(text: string, max: number): string;
1482
+ /**
1483
+ * Text that will sit between a fence pair. Invisible characters are already
1484
+ * gone. A scanner fence that appears in the text is broken with a space so
1485
+ * it cannot match the closing delimiter. A short fence is only broken when
1486
+ * the text contains the delimiter itself, so ordinary source is unchanged.
1487
+ */
1488
+ declare function prepareUntrustedSpan(text: string, fence: string): string;
1489
+
1462
1490
  /**
1463
1491
  * Shannon-entropy based secret detection.
1464
1492
  *
@@ -1840,4 +1868,4 @@ input: {
1840
1868
  content: string;
1841
1869
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1842
1870
 
1843
- 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 };
1871
+ 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, bearerProvenanceSafe, billingWebhookUnmatchedProps, bucketFiles, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, capabilityTokenHandler, 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, hardenUntrustedPromptText, 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, prepareUntrustedSpan, publicHttpsUrl, publicReadOnlyHandler, qualityRules, refineDirectObjectFindings, replaceBlockComments, resetStructuralState, routeForFile, routePathFromFile, runCustomRules, sanitizePromptField, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, setStructuralFaultForTest, sqlInjection, stripeWebhookUnprotected, structuralParseCount, supabaseFunctionName, supabaseNoRLS, testPathHold, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, widenedAuthSuppresses, xssVulnerability };