xploitscan-shared-rules 2.4.22 → 2.4.23

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.22";
172
+ declare const SCANNER_VERSION = "2.4.23";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
@@ -584,15 +584,29 @@ declare function isUngradedFinding(finding: {
584
584
  gradeVendored?: boolean;
585
585
  }): boolean;
586
586
  /**
587
- * Reported severity for one finding.
587
+ * Repo-level checks. A test-path copy is still the file that ships, so the
588
+ * severity stays and the finding is not labeled testFile. Live credentials
589
+ * are not in this set: `isLive` keeps them critical and graded.
590
+ */
591
+ declare const KEEP_SEVERITY_IN_TESTS: Set<string>;
592
+ /**
593
+ * Reported severity for one finding, for every rule.
588
594
  *
589
- * A non-live VC001 match in a test path (`testFile === true`, stamped only
590
- * when `isTestPath` holds and `isLive` does not) is emitted at low. Every
591
- * other rule, a live key, and a finding whose `testFile` flag is unset or
592
- * false keeps the severity it was given. Callers pass `testFile` after that
593
- * stamp, so "low" and the not-graded label stay on the same findings.
595
+ * A non-live, non-keep finding in a test path is emitted at low. The caller
596
+ * stamps `testFile` only for that same set, so "low" and the not-graded
597
+ * label stay on the same findings. A live credential, a keep-list rule, and
598
+ * a finding whose `testFile` flag is unset or false keep the severity they
599
+ * were given.
594
600
  */
595
- declare function vc001TestFixtureSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
601
+ declare function applyTestPathSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
602
+ /** Whether this finding is held to low and labeled testFile. */
603
+ declare function testPathHold(finding: {
604
+ rule?: string;
605
+ file?: string;
606
+ live?: boolean;
607
+ category?: string;
608
+ snippet?: string;
609
+ }): boolean;
596
610
 
597
611
  /**
598
612
  * Route-table extraction — what URL, if any, reaches a given source file.
@@ -1824,4 +1838,4 @@ input: {
1824
1838
  content: string;
1825
1839
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1826
1840
 
1827
- 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, 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, 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, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vc001TestFixtureSeverity, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
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 };
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.22";
172
+ declare const SCANNER_VERSION = "2.4.23";
173
173
 
174
174
  /**
175
175
  * Line-oriented helpers shared by every rule. Pure string manipulation — no fs
@@ -584,15 +584,29 @@ declare function isUngradedFinding(finding: {
584
584
  gradeVendored?: boolean;
585
585
  }): boolean;
586
586
  /**
587
- * Reported severity for one finding.
587
+ * Repo-level checks. A test-path copy is still the file that ships, so the
588
+ * severity stays and the finding is not labeled testFile. Live credentials
589
+ * are not in this set: `isLive` keeps them critical and graded.
590
+ */
591
+ declare const KEEP_SEVERITY_IN_TESTS: Set<string>;
592
+ /**
593
+ * Reported severity for one finding, for every rule.
588
594
  *
589
- * A non-live VC001 match in a test path (`testFile === true`, stamped only
590
- * when `isTestPath` holds and `isLive` does not) is emitted at low. Every
591
- * other rule, a live key, and a finding whose `testFile` flag is unset or
592
- * false keeps the severity it was given. Callers pass `testFile` after that
593
- * stamp, so "low" and the not-graded label stay on the same findings.
595
+ * A non-live, non-keep finding in a test path is emitted at low. The caller
596
+ * stamps `testFile` only for that same set, so "low" and the not-graded
597
+ * label stay on the same findings. A live credential, a keep-list rule, and
598
+ * a finding whose `testFile` flag is unset or false keep the severity they
599
+ * were given.
594
600
  */
595
- declare function vc001TestFixtureSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
601
+ declare function applyTestPathSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
602
+ /** Whether this finding is held to low and labeled testFile. */
603
+ declare function testPathHold(finding: {
604
+ rule?: string;
605
+ file?: string;
606
+ live?: boolean;
607
+ category?: string;
608
+ snippet?: string;
609
+ }): boolean;
596
610
 
597
611
  /**
598
612
  * Route-table extraction — what URL, if any, reaches a given source file.
@@ -1824,4 +1838,4 @@ input: {
1824
1838
  content: string;
1825
1839
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1826
1840
 
1827
- 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, 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, 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, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vc001TestFixtureSeverity, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
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 };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SCANNER_VERSION = "2.4.22";
2
+ var SCANNER_VERSION = "2.4.23";
3
3
 
4
4
  // src/snippet.ts
5
5
  var cacheContent = null;
@@ -1394,8 +1394,9 @@ function baseName(normalized) {
1394
1394
  function isTestPath(filePath) {
1395
1395
  const normalized = normalize(filePath);
1396
1396
  if (!normalized) return false;
1397
+ if (normalized.split("/").includes("..")) return false;
1397
1398
  const base = baseName(normalized);
1398
- if (/(?:\.test\.|\.spec\.|\.stories\.|\.story\.|\.mock\.|\.cy\.|\.e2e\.)/i.test(base)) return true;
1399
+ if (/(?:\.test\.|\.spec\.|\.mock\.|\.cy\.|\.e2e\.)/i.test(base)) return true;
1399
1400
  if (/^test_.*\.py$/i.test(base) || /_test\.py$/i.test(base)) return true;
1400
1401
  if (/^Test[A-Z_]\w*\.py$/.test(base)) return true;
1401
1402
  if (/^conftest\.py$/i.test(base)) return true;
@@ -1403,10 +1404,11 @@ function isTestPath(filePath) {
1403
1404
  if (/^[A-Z][A-Za-z0-9]*Tests\.cs$/.test(base)) return true;
1404
1405
  if (/(?:^|\/)routes\/test\//i.test(normalized)) return false;
1405
1406
  if (/(?:^|\/)(?:tests|testdata|spec|__tests__|__mocks__|fixtures?|mocks?)(?:\/|$)/i.test(normalized)) return true;
1407
+ if (/(?:^|\/)e2e(?:\/|$)/i.test(normalized)) return true;
1406
1408
  if (/(?:^|\/)test\//i.test(normalized)) return true;
1407
1409
  if (/(?:^|\/)[^/]*\.(?:UnitTests|IntegrationTests|Tests)\//i.test(normalized)) return true;
1408
1410
  if (/\.cs$/.test(base) && /(?:^|\/)[^/]*Tests\//.test(normalized)) return true;
1409
- if (/test-utils/i.test(normalized)) return true;
1411
+ if (/(?:^|\/)test-utils(?:\/|$)/i.test(normalized)) return true;
1410
1412
  if (/(?:^|\/)testing(?:\/|$)/i.test(normalized)) return true;
1411
1413
  return false;
1412
1414
  }
@@ -1473,10 +1475,14 @@ function isUngradedFinding(finding, options = {}) {
1473
1475
  if (options.gradeVendored) return false;
1474
1476
  return isVendoredFinding(finding);
1475
1477
  }
1476
- function vc001TestFixtureSeverity(rule, testFile, severity) {
1477
- if (rule === "VC001" && testFile === true) return "low";
1478
+ var KEEP_SEVERITY_IN_TESTS = /* @__PURE__ */ new Set(["VC002", "VC014"]);
1479
+ function applyTestPathSeverity(rule, testFile, severity) {
1480
+ if (testFile === true && !KEEP_SEVERITY_IN_TESTS.has(rule ?? "")) return "low";
1478
1481
  return severity;
1479
1482
  }
1483
+ function testPathHold(finding) {
1484
+ return isTestPath(finding.file ?? "") && !isLive(finding) && !KEEP_SEVERITY_IN_TESTS.has(finding.rule ?? "");
1485
+ }
1480
1486
 
1481
1487
  // src/routes.ts
1482
1488
  var API_RE = /^\/api(\/|$)|^\/_|\.(json|js|xml|txt|ico)$/;
@@ -3340,7 +3346,8 @@ var hardcodedSecrets = {
3340
3346
  continue;
3341
3347
  }
3342
3348
  const matched = matchedText[ri] ?? "";
3343
- emit(rm, judged, textHasLiveCredential(matched) || matchedLive ? { live: true } : {});
3349
+ const pemHeader = pi === 9 && isTestPath(filePath);
3350
+ emit(rm, judged, pemHeader || textHasLiveCredential(matched) || matchedLive ? { live: true } : {});
3344
3351
  }
3345
3352
  }
3346
3353
  collectSupabaseCreateClientKeys(content, filePath, matches, hardcodedSecrets, fixMessages[3]);
@@ -5796,7 +5803,7 @@ var todoLeftInCode = {
5796
5803
  category: "Code Quality",
5797
5804
  description: "TODO, FIXME, HACK, and XXX comments indicate unfinished work that should be resolved before shipping to production.",
5798
5805
  check(content, filePath) {
5799
- if (filePath.match(/test|spec|mock|__tests__|fixture|node_modules/i)) return [];
5806
+ if (isTestFile(filePath) || filePath.includes("node_modules")) return [];
5800
5807
  if (/\.(?:md|mdx|markdown|txt)$/i.test(filePath)) return [];
5801
5808
  const marker = /(?<![`'":])(?:\/\/|\/\*\*?|^[ \t]*\*+)[ \t]*(?:(?:TODO|FIXME|HACK)\b|XXX(?![\w.-])|(?:[Tt]odo|[Ff]ixme)[ \t]*:|@todo\b)/gm;
5802
5809
  const matches = [];
@@ -5838,7 +5845,7 @@ var emptyCatchBlock = {
5838
5845
  category: "Code Quality",
5839
5846
  description: "Empty catch blocks silently swallow errors, making bugs impossible to diagnose. At minimum, log the error.",
5840
5847
  check(content, filePath) {
5841
- if (filePath.match(/test|spec|mock/i)) return [];
5848
+ if (isTestFile(filePath)) return [];
5842
5849
  const fix = () => "Handle errors in catch blocks: catch(err) { console.error('Operation failed:', err); } or re-throw if appropriate.";
5843
5850
  const blocks = findMatches(content, /catch\s*(?:\([^)]{0,200}\))?\s*\{\s*\}/g, emptyCatchBlock, filePath, fix);
5844
5851
  const seen = new Set(blocks.map((m) => m.line));
@@ -5936,7 +5943,6 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5936
5943
  const matches = rule.check(content, filePath, project);
5937
5944
  const compliance = complianceMap[rule.id];
5938
5945
  const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
5939
- const onTestPath = isTestPath(filePath);
5940
5946
  for (const match of matches) {
5941
5947
  const live = isLive({
5942
5948
  rule: match.rule,
@@ -5944,14 +5950,20 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
5944
5950
  live: match.live,
5945
5951
  snippet: match.snippet
5946
5952
  });
5947
- const testFixture = onTestPath && !live;
5953
+ const testFixture = testPathHold({
5954
+ rule: match.rule,
5955
+ file: filePath,
5956
+ live: match.live,
5957
+ category: match.category,
5958
+ snippet: match.snippet
5959
+ });
5948
5960
  findings.push({
5949
5961
  ...vendored ? { vendored: true } : {},
5950
5962
  ...testFixture ? { testFile: true } : {},
5951
5963
  ...live ? { live: true } : {},
5952
5964
  id: `${match.rule}-${match.file}:${match.line}`,
5953
5965
  rule: match.rule,
5954
- severity: vc001TestFixtureSeverity(match.rule, testFixture ? true : void 0, match.severity),
5966
+ severity: applyTestPathSeverity(match.rule, testFixture ? true : void 0, match.severity),
5955
5967
  title: match.title,
5956
5968
  description: rule.description,
5957
5969
  file: match.file,
@@ -12086,6 +12098,7 @@ export {
12086
12098
  FREE_RULE_COUNT,
12087
12099
  GRADE_FINDINGS_PER_RULE,
12088
12100
  INTENT_EXPECTATIONS,
12101
+ KEEP_SEVERITY_IN_TESTS,
12089
12102
  MAX_IGNORE_BYTES,
12090
12103
  MAX_IGNORE_LINES,
12091
12104
  MAX_SUPPRESSED_LIST,
@@ -12116,6 +12129,7 @@ export {
12116
12129
  aiStatusLine,
12117
12130
  allRules,
12118
12131
  applySuppressions,
12132
+ applyTestPathSeverity,
12119
12133
  assessHeaders,
12120
12134
  astMatch,
12121
12135
  attachInlineSuppressed,
@@ -12241,13 +12255,13 @@ export {
12241
12255
  supabaseFunctionName,
12242
12256
  supabaseNoRLS,
12243
12257
  suppressionSummary,
12258
+ testPathHold,
12244
12259
  toAiDegraded,
12245
12260
  todoLeftInCode,
12246
12261
  tryParse,
12247
12262
  unknownAiStatus,
12248
12263
  unmeasuredQualityRules,
12249
12264
  unvalidatedRedirect,
12250
- vc001TestFixtureSeverity,
12251
12265
  vendoredReason,
12252
12266
  visitBinary,
12253
12267
  visitCalls,