xploitscan-shared-rules 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -90,6 +90,18 @@ interface Finding {
90
90
  * itself by arriving with the flag already set.
91
91
  */
92
92
  vendored?: boolean;
93
+ /**
94
+ * True when the finding sits in a test or fixture file and the test
95
+ * holdout applies. A live credential in a test file is graded and does
96
+ * not carry this flag. The GitHub Action cannot import the helper, so it
97
+ * trusts the flag the CLI stamps, exactly as it trusts `vendored`.
98
+ */
99
+ testFile?: boolean;
100
+ /**
101
+ * True when the finding is a live provider credential. A placeholder
102
+ * token and a PEM private key are not. `calculateGrade` reads it via `isLive`.
103
+ */
104
+ live?: boolean;
93
105
  /**
94
106
  * The URL that reaches this finding's file, when one does.
95
107
  *
@@ -121,6 +133,8 @@ interface RuleMatch {
121
133
  column?: number;
122
134
  snippet: string;
123
135
  fix?: string;
136
+ /** Set on a VC001 match whose text is a live provider credential. */
137
+ live?: boolean;
124
138
  }
125
139
 
126
140
  interface CustomRule {
@@ -460,6 +474,69 @@ declare function isVendoredFinding(finding: {
460
474
  */
461
475
  declare function vendoredReason(filePath: string): string | null;
462
476
 
477
+ /**
478
+ * One classification for "this path is a test or fixture" and for SBOM files.
479
+ *
480
+ * Rules that already skip tests call `isTestFile`, which delegates here.
481
+ * Rules that still emit (VC001, VC061, the config checks) stay visible;
482
+ * `calculateGrade` holds a test path out unless the finding is a live
483
+ * credential. Entropy omits test paths entirely, using this same helper.
484
+ *
485
+ * `src/routes/test/` is a route, not a suite (#886). A file there is a
486
+ * test only when its own name says so (`handler_test.go`, `foo.test.ts`).
487
+ */
488
+ /**
489
+ * True for a test, spec, or fixture path.
490
+ *
491
+ * Filename rules win over the `routes/test/` exception, so
492
+ * `src/routes/test/handler_test.go` is still a test file.
493
+ * `Testimonial.py` and `Testing.py` stay application code: `Test*.py`
494
+ * requires an uppercase letter or underscore after `Test`.
495
+ * A C# `WidgetTest.cs` stays application code too. Those suites live in
496
+ * `tests/`, `*.Tests/`, `*.UnitTests/`, or `*.IntegrationTests/`.
497
+ */
498
+ declare function isTestPath(filePath: string): boolean;
499
+ declare function isSbomPath(filePath: string): boolean;
500
+ /**
501
+ * A credential that is live wherever the file sits. Test-mode keys,
502
+ * placeholder tokens, connection strings, and PEM private keys are not.
503
+ *
504
+ * Formats: `AKIA`/`ABIA`/`ACCA`/`ASIA` (not a key ending in EXAMPLE),
505
+ * `sk_live_`, `rk_live_`, an OpenAI key (`T3BlbkFJ`), an OpenRouter key
506
+ * (`sk-or-v1-`), `ghp_` and `github_pat_`, a Slack `xox*` token, `AIza`,
507
+ * an Anthropic `sk-ant-api03-` key, SendGrid `SG.`, and a Hugging Face
508
+ * `hf_` token.
509
+ * A bare `sk-` is live only in one of those provider shapes. VC001 is live
510
+ * only when the rule set `live` on that token. Other Secrets rules are
511
+ * live too, except ENTROPY, VC002, and VC014, and except a snippet whose
512
+ * only provider tokens are placeholders.
513
+ */
514
+ declare function isLive(finding: {
515
+ rule?: string;
516
+ category?: string;
517
+ live?: boolean;
518
+ snippet?: string;
519
+ }): boolean;
520
+ /**
521
+ * True when a finding is reported but must not move the grade.
522
+ *
523
+ * A test or fixture path is held out even when `--grade-vendored` is set,
524
+ * unless the finding is live (`isLive`). QA's VC001 hits were template
525
+ * connection strings; a live `sk_live_` key in `test/` still fails the gate.
526
+ * A secret in a non-test vendored or documentation path stays graded —
527
+ * `isVendoredFinding` still refuses to hold a real credential out of a
528
+ * README. Test paths are decided first.
529
+ */
530
+ declare function isUngradedFinding(finding: {
531
+ file?: string;
532
+ rule?: string;
533
+ category?: string;
534
+ live?: boolean;
535
+ snippet?: string;
536
+ }, options?: {
537
+ gradeVendored?: boolean;
538
+ }): boolean;
539
+
463
540
  /**
464
541
  * Route-table extraction — what URL, if any, reaches a given source file.
465
542
  *
@@ -1088,14 +1165,6 @@ interface GradeOptions {
1088
1165
  * same rule do not also zero the numeric score.
1089
1166
  */
1090
1167
  declare const GRADE_FINDINGS_PER_RULE = 3;
1091
- /**
1092
- * Rule family for the per-rule grade cap.
1093
- *
1094
- * Findings group by `rule` (`VC001`), not by the per-line id
1095
- * (`VC001-src/app.ts:12`). ENTROPY's id is `ENTROPY-<file>:<line>` and its
1096
- * rule is `ENTROPY`; both collapse to one family so a noisy entropy pass
1097
- * cannot deduct once per line.
1098
- */
1099
1168
  declare function gradeRuleFamily(finding: {
1100
1169
  rule?: string;
1101
1170
  id?: string;
@@ -1556,4 +1625,4 @@ input: {
1556
1625
  content: string;
1557
1626
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1558
1627
 
1559
- export { type AIFilterResult, type AppRoute, 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, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, 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, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
1628
+ export { type AIFilterResult, type AppRoute, 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, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, 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, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
package/dist/index.d.ts CHANGED
@@ -90,6 +90,18 @@ interface Finding {
90
90
  * itself by arriving with the flag already set.
91
91
  */
92
92
  vendored?: boolean;
93
+ /**
94
+ * True when the finding sits in a test or fixture file and the test
95
+ * holdout applies. A live credential in a test file is graded and does
96
+ * not carry this flag. The GitHub Action cannot import the helper, so it
97
+ * trusts the flag the CLI stamps, exactly as it trusts `vendored`.
98
+ */
99
+ testFile?: boolean;
100
+ /**
101
+ * True when the finding is a live provider credential. A placeholder
102
+ * token and a PEM private key are not. `calculateGrade` reads it via `isLive`.
103
+ */
104
+ live?: boolean;
93
105
  /**
94
106
  * The URL that reaches this finding's file, when one does.
95
107
  *
@@ -121,6 +133,8 @@ interface RuleMatch {
121
133
  column?: number;
122
134
  snippet: string;
123
135
  fix?: string;
136
+ /** Set on a VC001 match whose text is a live provider credential. */
137
+ live?: boolean;
124
138
  }
125
139
 
126
140
  interface CustomRule {
@@ -460,6 +474,69 @@ declare function isVendoredFinding(finding: {
460
474
  */
461
475
  declare function vendoredReason(filePath: string): string | null;
462
476
 
477
+ /**
478
+ * One classification for "this path is a test or fixture" and for SBOM files.
479
+ *
480
+ * Rules that already skip tests call `isTestFile`, which delegates here.
481
+ * Rules that still emit (VC001, VC061, the config checks) stay visible;
482
+ * `calculateGrade` holds a test path out unless the finding is a live
483
+ * credential. Entropy omits test paths entirely, using this same helper.
484
+ *
485
+ * `src/routes/test/` is a route, not a suite (#886). A file there is a
486
+ * test only when its own name says so (`handler_test.go`, `foo.test.ts`).
487
+ */
488
+ /**
489
+ * True for a test, spec, or fixture path.
490
+ *
491
+ * Filename rules win over the `routes/test/` exception, so
492
+ * `src/routes/test/handler_test.go` is still a test file.
493
+ * `Testimonial.py` and `Testing.py` stay application code: `Test*.py`
494
+ * requires an uppercase letter or underscore after `Test`.
495
+ * A C# `WidgetTest.cs` stays application code too. Those suites live in
496
+ * `tests/`, `*.Tests/`, `*.UnitTests/`, or `*.IntegrationTests/`.
497
+ */
498
+ declare function isTestPath(filePath: string): boolean;
499
+ declare function isSbomPath(filePath: string): boolean;
500
+ /**
501
+ * A credential that is live wherever the file sits. Test-mode keys,
502
+ * placeholder tokens, connection strings, and PEM private keys are not.
503
+ *
504
+ * Formats: `AKIA`/`ABIA`/`ACCA`/`ASIA` (not a key ending in EXAMPLE),
505
+ * `sk_live_`, `rk_live_`, an OpenAI key (`T3BlbkFJ`), an OpenRouter key
506
+ * (`sk-or-v1-`), `ghp_` and `github_pat_`, a Slack `xox*` token, `AIza`,
507
+ * an Anthropic `sk-ant-api03-` key, SendGrid `SG.`, and a Hugging Face
508
+ * `hf_` token.
509
+ * A bare `sk-` is live only in one of those provider shapes. VC001 is live
510
+ * only when the rule set `live` on that token. Other Secrets rules are
511
+ * live too, except ENTROPY, VC002, and VC014, and except a snippet whose
512
+ * only provider tokens are placeholders.
513
+ */
514
+ declare function isLive(finding: {
515
+ rule?: string;
516
+ category?: string;
517
+ live?: boolean;
518
+ snippet?: string;
519
+ }): boolean;
520
+ /**
521
+ * True when a finding is reported but must not move the grade.
522
+ *
523
+ * A test or fixture path is held out even when `--grade-vendored` is set,
524
+ * unless the finding is live (`isLive`). QA's VC001 hits were template
525
+ * connection strings; a live `sk_live_` key in `test/` still fails the gate.
526
+ * A secret in a non-test vendored or documentation path stays graded —
527
+ * `isVendoredFinding` still refuses to hold a real credential out of a
528
+ * README. Test paths are decided first.
529
+ */
530
+ declare function isUngradedFinding(finding: {
531
+ file?: string;
532
+ rule?: string;
533
+ category?: string;
534
+ live?: boolean;
535
+ snippet?: string;
536
+ }, options?: {
537
+ gradeVendored?: boolean;
538
+ }): boolean;
539
+
463
540
  /**
464
541
  * Route-table extraction — what URL, if any, reaches a given source file.
465
542
  *
@@ -1088,14 +1165,6 @@ interface GradeOptions {
1088
1165
  * same rule do not also zero the numeric score.
1089
1166
  */
1090
1167
  declare const GRADE_FINDINGS_PER_RULE = 3;
1091
- /**
1092
- * Rule family for the per-rule grade cap.
1093
- *
1094
- * Findings group by `rule` (`VC001`), not by the per-line id
1095
- * (`VC001-src/app.ts:12`). ENTROPY's id is `ENTROPY-<file>:<line>` and its
1096
- * rule is `ENTROPY`; both collapse to one family so a noisy entropy pass
1097
- * cannot deduct once per line.
1098
- */
1099
1168
  declare function gradeRuleFamily(finding: {
1100
1169
  rule?: string;
1101
1170
  id?: string;
@@ -1556,4 +1625,4 @@ input: {
1556
1625
  content: string;
1557
1626
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1558
1627
 
1559
- export { type AIFilterResult, type AppRoute, 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, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, 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, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
1628
+ export { type AIFilterResult, type AppRoute, 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, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, 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, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
package/dist/index.js CHANGED
@@ -462,6 +462,89 @@ function vendoredReason(filePath) {
462
462
  return null;
463
463
  }
464
464
 
465
+ // src/test-path.ts
466
+ function normalize(filePath) {
467
+ return filePath.replace(/\\/g, "/");
468
+ }
469
+ function baseName(normalized) {
470
+ const slash = normalized.lastIndexOf("/");
471
+ return slash === -1 ? normalized : normalized.slice(slash + 1);
472
+ }
473
+ function isTestPath(filePath) {
474
+ const normalized = normalize(filePath);
475
+ if (!normalized) return false;
476
+ const base = baseName(normalized);
477
+ if (/(?:\.test\.|\.spec\.|\.stories\.|\.story\.|\.mock\.|\.cy\.|\.e2e\.)/i.test(base)) return true;
478
+ if (/^test_.*\.py$/i.test(base) || /_test\.py$/i.test(base)) return true;
479
+ if (/^Test[A-Z_]\w*\.py$/.test(base)) return true;
480
+ if (/^conftest\.py$/i.test(base)) return true;
481
+ if (/_test\.go$/.test(base)) return true;
482
+ if (/(?:^|\/)routes\/test\//i.test(normalized)) return false;
483
+ if (/(?:^|\/)(?:tests|testdata|spec|__tests__|__mocks__|fixtures?|mocks?)(?:\/|$)/i.test(normalized)) return true;
484
+ if (/(?:^|\/)test\//i.test(normalized)) return true;
485
+ if (/(?:^|\/)[^/]*\.(?:UnitTests|IntegrationTests|Tests)\//i.test(normalized)) return true;
486
+ if (/test-utils/i.test(normalized)) return true;
487
+ if (/(?:^|\/)testing(?:\/|$)/i.test(normalized)) return true;
488
+ return false;
489
+ }
490
+ var SBOM_FILE_RE = /(?:^|\/)(?:[^/]*\.spdx(?:\.json)?|[^/]*\.cdx\.json|[^/]*\.cdx\.xml|bom\.json|sbom[^/]*\.json|[^/]*\.sbom\.json|[^/]*cyclonedx[^/]*\.(?:json|xml))$/i;
491
+ function isSbomPath(filePath) {
492
+ return SBOM_FILE_RE.test(normalize(filePath));
493
+ }
494
+ function isPlaceholderToken(token) {
495
+ if (!token) return true;
496
+ if (/(.)\1{7,}/.test(token)) return true;
497
+ if (new Set(token).size < 8) return true;
498
+ return /example|placeholder|redacted|your_?(?:api_?)?(?:key|token)|insert_?your|replace_?me|\b(?:test|fake|dummy|sample|your)\b/i.test(token);
499
+ }
500
+ var LIVE_TOKEN_SOURCES = [
501
+ String.raw`(?:sk|rk)_live_[A-Za-z0-9]+`,
502
+ // OpenAI (`T3BlbkFJ` sits in every sk-proj- / sk-svcacct- / sk-admin- / legacy
503
+ // sk- key) and OpenRouter. A bare `sk-` is not a provider format.
504
+ String.raw`sk-(?:(?:proj|svcacct|admin)-[A-Za-z0-9_-]{20,80}|[A-Za-z0-9]{20,80})T3BlbkFJ[A-Za-z0-9_-]{20,80}`,
505
+ String.raw`sk-or-v1-[a-f0-9]{64}`,
506
+ String.raw`sk-ant-api03-[A-Za-z0-9_-]{80,}`,
507
+ String.raw`ghp_[A-Za-z0-9]{36}`,
508
+ String.raw`github_pat_[A-Za-z0-9_]{22,}`,
509
+ String.raw`xox[a-z]-[0-9A-Za-z-]{10,}`,
510
+ String.raw`AIza[A-Za-z0-9_-]{35}`,
511
+ String.raw`SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}`,
512
+ String.raw`\bhf_[A-Za-z]{34}\b`,
513
+ String.raw`(?:AKIA|ABIA|ACCA|ASIA)[A-Z0-9]{16}`
514
+ ];
515
+ function providerTokens(text) {
516
+ if (!text) return [];
517
+ const out = [];
518
+ for (const source of LIVE_TOKEN_SOURCES) {
519
+ const found = text.match(new RegExp(source, "g"));
520
+ if (found) out.push(...found);
521
+ }
522
+ return out;
523
+ }
524
+ function tokenIsLive(token) {
525
+ if (isPlaceholderToken(token)) return false;
526
+ if (/^(?:AKIA|ABIA|ACCA|ASIA)/.test(token) && /EXAMPLE$/i.test(token)) return false;
527
+ return true;
528
+ }
529
+ function isLive(finding) {
530
+ const rule = finding?.rule ?? "";
531
+ if (rule === "ENTROPY" || rule.startsWith("ENTROPY-")) return false;
532
+ if (rule === "VC002" || rule === "VC014") return false;
533
+ if (rule === "VC001") return finding?.live === true;
534
+ if (finding?.live === true) return true;
535
+ const snippet = finding?.snippet ?? "";
536
+ if (providerTokens(snippet).length > 0 && !textHasLiveCredential(snippet)) return false;
537
+ return finding?.category === "Secrets";
538
+ }
539
+ function textHasLiveCredential(text) {
540
+ return providerTokens(text).some(tokenIsLive);
541
+ }
542
+ function isUngradedFinding(finding, options = {}) {
543
+ if (isTestPath(finding?.file ?? "")) return !isLive(finding);
544
+ if (options.gradeVendored) return false;
545
+ return isVendoredFinding(finding);
546
+ }
547
+
465
548
  // src/routes.ts
466
549
  var API_RE = /^\/api(\/|$)|^\/_|\.(json|js|xml|txt|ico)$/;
467
550
  var DYNAMIC_RE = /:[A-Za-z_]|\[[^\]]+\]|<[^>]+>|\$[A-Za-z_]|\*/;
@@ -477,7 +560,7 @@ function hasDep(files, name) {
477
560
  return false;
478
561
  }
479
562
  }
480
- function normalize(p) {
563
+ function normalize2(p) {
481
564
  if (!p.startsWith("/")) return "";
482
565
  if (p.length > 1 && p.endsWith("/")) return p.replace(/\/+$/, "");
483
566
  return p;
@@ -486,7 +569,7 @@ function extractRoutes(files) {
486
569
  const routes = /* @__PURE__ */ new Map();
487
570
  const frameworks = /* @__PURE__ */ new Set();
488
571
  const add = (raw, framework, source, kindOverride) => {
489
- const path = normalize(raw);
572
+ const path = normalize2(raw);
490
573
  if (!path || routes.has(path)) return;
491
574
  routes.set(path, {
492
575
  path,
@@ -1498,7 +1581,7 @@ function callSpreads(call, matcher) {
1498
1581
  // src/rules.ts
1499
1582
  var TEST_FILE_PATTERN = /(?:\.test\.|\.spec\.|__tests__|__mocks__|\.stories\.|\.story\.|\/test\/|\/tests\/|\/fixtures?\/|\/mocks?\/|\.mock\.|test-utils|testing|\.cy\.|\.e2e\.)/i;
1500
1583
  function isTestFile(filePath) {
1501
- return TEST_FILE_PATTERN.test(filePath);
1584
+ return isTestPath(filePath);
1502
1585
  }
1503
1586
  var HANDLER_HEADER_RE = /(?:\b(?:async\s+)?function\b|=>\s*$|=>\s*\{?\s*$|\.(?:get|post|put|patch|delete|use|all)\s*\(|\bexport\s+(?:async\s+)?(?:function|const)\s+(?:GET|POST|PUT|PATCH|DELETE)\b|\b(?:Deno\.)?serve\s*\()/i;
1504
1587
  function maskComments(content) {
@@ -1713,11 +1796,6 @@ function isNamespacedSlotKey(name, value) {
1713
1796
  }
1714
1797
  var CREDENTIAL_NAME = /SECRET|SIGN|ENCRYPT|CRYPT|CIPHER|HMAC|JWT|PRIVATE|API|ACCESS|AUTH|MASTER|ADMIN|SESSION|PASS|TOKEN|CLIENT|SALT|PEPPER|LICEN[CS]E|WEBHOOK|STRIPE|AWS|SERVICE/;
1715
1798
  var CREDENTIAL_WORD = /secret|passw|token|private|signing|apikey|credential/i;
1716
- function isPlaceholderToken(token) {
1717
- if (/(.)\1{7,}/.test(token)) return true;
1718
- if (new Set(token).size < 8) return true;
1719
- return /example|placeholder|redacted|your_?(?:api_?)?(?:key|token)|insert_?your|replace_?me/i.test(token);
1720
- }
1721
1799
  var GEMINI_FILE_CONTEXT_RE = /generativelanguage\.googleapis\.com|@google\/generative-ai|@google\/genai|\bGoogleGenerativeAI\b|\bGoogleGenAI\b|\bgoogle\.generativeai\b|\bfrom\s+google\s+import\s+genai\b/;
1722
1800
  var GEMINI_NAME_RE = /gemini|generative/i;
1723
1801
  var PUBLIC_GOOGLE_KEY_NAME_RE = /firebase|maps?(?:\b|_)|places|recaptcha|youtube/i;
@@ -1734,6 +1812,39 @@ function isGeminiKeyContext(lines, line, fileIsGemini) {
1734
1812
  }
1735
1813
  return fileIsGemini || GEMINI_NAME_RE.test(before);
1736
1814
  }
1815
+ function dbUrlLacksRealCredential(url) {
1816
+ const rest = url.replace(/^[a-z0-9+]+:\/\//i, "");
1817
+ const at = rest.lastIndexOf("@");
1818
+ if (at < 0) return true;
1819
+ const userinfo = rest.slice(0, at);
1820
+ const colon = userinfo.indexOf(":");
1821
+ const user = colon < 0 ? userinfo : userinfo.slice(0, colon);
1822
+ const pass = colon < 0 ? "" : decodeURIComponentSafe(userinfo.slice(colon + 1));
1823
+ if (!pass) return true;
1824
+ if (isFormatPlaceholder(pass)) return true;
1825
+ if (isPlaceholderSecret(pass)) return true;
1826
+ if (/^(?:u|user|username)$/i.test(user) && /^(?:pass|password|passwd|pwd)$/i.test(pass)) return true;
1827
+ return false;
1828
+ }
1829
+ function decodeURIComponentSafe(value) {
1830
+ try {
1831
+ return decodeURIComponent(value);
1832
+ } catch {
1833
+ return value;
1834
+ }
1835
+ }
1836
+ var FORMAT_PLACEHOLDER_MAX = 256;
1837
+ function isFormatPlaceholder(value) {
1838
+ const v = value.trim();
1839
+ if (!v) return true;
1840
+ if (v.length > FORMAT_PLACEHOLDER_MAX) return false;
1841
+ if (/^(?:%(?:[%sdifvx]|\([^)]+\))|\{[0-9]*\}|\$\{[^}]*\}|<[^<>]*>|\*+)$/i.test(v)) return true;
1842
+ if (/%(?:[%sdifvx]|\([^)]+\))|\{[0-9]*\}|\$\{[^}]*\}|<[^<>]*>/.test(v)) return true;
1843
+ return false;
1844
+ }
1845
+ function isPlaceholderSecret(value) {
1846
+ return /^(?:password|passwd|pwd|changeme|change[-_]?me|your[-_]?password)$/i.test(value.trim());
1847
+ }
1737
1848
  var hardcodedSecrets = {
1738
1849
  id: "VC001",
1739
1850
  title: "Hardcoded API Key or Secret",
@@ -1742,7 +1853,6 @@ var hardcodedSecrets = {
1742
1853
  description: "API keys, tokens, or secrets hardcoded in source code can be extracted by anyone with access to the code.",
1743
1854
  check(content, filePath) {
1744
1855
  if (filePath.endsWith(".example") || filePath.endsWith(".template")) return [];
1745
- if (isTestFile(filePath)) return [];
1746
1856
  if (filePath.match(/\.(md|txt|rst|adoc)$/)) return [];
1747
1857
  const patterns = [
1748
1858
  // Generic API key patterns — require actual value assignment, not variable declarations
@@ -1876,13 +1986,17 @@ var hardcodedSecrets = {
1876
1986
  if (isPlaceholderToken(token)) continue;
1877
1987
  if (pi === GOOGLE_PI) {
1878
1988
  if (!isGeminiKeyContext(lines, rm.line, fileIsGemini)) continue;
1879
- matches.push({ ...rm, severity: "high" });
1989
+ matches.push(textHasLiveCredential(token) ? { ...rm, severity: "high", live: true } : { ...rm, severity: "high" });
1880
1990
  continue;
1881
1991
  }
1882
1992
  if (pi === STRIPE_RESTRICTED_PI && !token.startsWith("rk_live_")) {
1883
1993
  matches.push({ ...rm, severity: "high" });
1884
1994
  continue;
1885
1995
  }
1996
+ if (textHasLiveCredential(token)) {
1997
+ matches.push({ ...rm, live: true });
1998
+ continue;
1999
+ }
1886
2000
  }
1887
2001
  if (floor > 0) {
1888
2002
  const secretMatch = lineText.match(/[:=]\s*["'`]([^"'`]*)["'`]/);
@@ -1898,7 +2012,9 @@ var hardcodedSecrets = {
1898
2012
  if (isKeySuffix && isSlotIdentifier) continue;
1899
2013
  }
1900
2014
  }
1901
- matches.push(rm);
2015
+ if (pi === 10 && dbUrlLacksRealCredential(matchedText[ri] ?? "")) continue;
2016
+ const matched = matchedText[ri] ?? "";
2017
+ matches.push(textHasLiveCredential(matched) ? { ...rm, live: true } : rm);
1902
2018
  }
1903
2019
  }
1904
2020
  return matches;
@@ -3364,10 +3480,12 @@ var missingHTTPS = {
3364
3480
  category: "Configuration",
3365
3481
  description: "Hardcoded http:// URLs (other than localhost and private-network addresses) send data unencrypted, exposing it to man-in-the-middle attacks.",
3366
3482
  check(content, filePath) {
3367
- const baseName = filePath.slice(filePath.lastIndexOf("/") + 1);
3368
- const isTestPath = /(?:^|\/)(?:__tests__|tests?|testdata|testing|test[-_]?(?:utils?|helpers?|support))\//i.test(filePath) || /^(?:tests?(?![a-z])|conftest\.py$|setupTests\.)|[._-]tests?\.\w+$|\.spec\.\w+$|_spec\.rb$/.test(baseName);
3369
- if (filePath.endsWith(".example") || isTestPath || filePath.includes("README")) return [];
3370
- if (filePath.match(/\.(md|txt)$/)) return [];
3483
+ const baseName2 = filePath.slice(filePath.lastIndexOf("/") + 1);
3484
+ const vc032SkipsTests = /(?:^|\/)(?:__tests__|tests?|testdata|testing|test[-_]?(?:utils?|helpers?|support))\//i.test(filePath) || /^(?:tests?(?![a-z])|conftest\.py$|setupTests\.)|[._-]tests?\.\w+$|\.spec\.\w+$|_spec\.rb$/.test(baseName2);
3485
+ if (filePath.endsWith(".example") || vc032SkipsTests || filePath.includes("README")) return [];
3486
+ if (filePath.match(/\.(md|txt|rst)$/)) return [];
3487
+ if (/(?:^|\/)(?:doc|docs)\//i.test(filePath)) return [];
3488
+ if (/(?:^|\/)conf\.py$/i.test(filePath) && /intersphinx/i.test(content)) return [];
3371
3489
  const matches = [];
3372
3490
  const isScriptFile = /\.(?:[cm]?[jt]sx?|vue|svelte)$/i.test(filePath);
3373
3491
  if (!isScriptFile && /<!DOCTYPE|xmlns|\.dtd|\.xsd/i.test(content) && !/fetch|axios|request|http\.get/i.test(content)) return [];
@@ -3383,6 +3501,8 @@ var missingHTTPS = {
3383
3501
  for (const rm of rawMatches) {
3384
3502
  const matchText = lines[rm.line - 1] ?? "";
3385
3503
  if (/DTD|DOCTYPE|w3\.org|apple\.com\/DTDs|\bxmlns[\w:-]*\s*=/i.test(matchText)) continue;
3504
+ if (/["']\$schema["']\s*:|["']\$id["']\s*:/.test(matchText)) continue;
3505
+ if (/--\s*tsaurl\b|\btsaurl\b|timestamp\.(?:digicert|sectigo|comodoca|globalsign|entrust|geotrust|verisign|apple)\.|timestamp\.acs\.microsoft\.com|freetsa\.org/i.test(matchText)) continue;
3386
3506
  matches.push(rm);
3387
3507
  }
3388
3508
  return matches;
@@ -3723,11 +3843,13 @@ var GRADE_SEVERITY_RANK = {
3723
3843
  low: 1,
3724
3844
  info: 0
3725
3845
  };
3846
+ var ADVISORY_FAMILY_RE = /^(?:GHSA-|CVE-\d|OSV-|DEP\d)/i;
3726
3847
  function gradeRuleFamily(finding) {
3727
3848
  const rule = (finding.rule ?? "").trim();
3849
+ const id = finding.id ?? "";
3850
+ if (ADVISORY_FAMILY_RE.test(rule) || ADVISORY_FAMILY_RE.test(id)) return "ADVISORY";
3728
3851
  if (rule === "ENTROPY" || rule.startsWith("ENTROPY-")) return "ENTROPY";
3729
3852
  if (rule) return rule;
3730
- const id = finding.id ?? "";
3731
3853
  if (id === "ENTROPY" || id.startsWith("ENTROPY-")) return "ENTROPY";
3732
3854
  return id || "unknown";
3733
3855
  }
@@ -3754,9 +3876,27 @@ function findingsCountedTowardGrade(findings) {
3754
3876
  return counted;
3755
3877
  }
3756
3878
  function calculateGrade(findings, _totalFiles, options = {}) {
3757
- const scored = options.gradeVendored ? findings : findings.filter((f) => !isVendoredFinding(f));
3879
+ const scored = findings.filter((f) => !isUngradedFinding(f, options));
3758
3880
  const ungraded = findings.length - scored.length;
3759
- const holdout = ungraded > 0 ? ` ${ungraded} finding${ungraded === 1 ? "" : "s"} in vendored, generated, or documentation files ${ungraded === 1 ? "is" : "are"} reported but not graded.` : "";
3881
+ let testHeld = 0;
3882
+ let vendoredHeld = 0;
3883
+ for (const f of findings) {
3884
+ if (!isUngradedFinding(f, options)) continue;
3885
+ if (isTestPath(f.file ?? "")) testHeld++;
3886
+ else vendoredHeld++;
3887
+ }
3888
+ const holdoutParts = [];
3889
+ if (vendoredHeld > 0) {
3890
+ holdoutParts.push(
3891
+ `${vendoredHeld} finding${vendoredHeld === 1 ? "" : "s"} in vendored, generated, or documentation files ${vendoredHeld === 1 ? "is" : "are"} reported but not graded.`
3892
+ );
3893
+ }
3894
+ if (testHeld > 0) {
3895
+ holdoutParts.push(
3896
+ `${testHeld} finding${testHeld === 1 ? "" : "s"} in a test or fixture file, not counted toward the grade, ${testHeld === 1 ? "is" : "are"} reported but not graded.`
3897
+ );
3898
+ }
3899
+ const holdout = holdoutParts.length > 0 ? ` ${holdoutParts.join(" ")}` : "";
3760
3900
  if (scored.length === 0) {
3761
3901
  return {
3762
3902
  grade: "A+",
@@ -4292,6 +4432,7 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
4292
4432
  }
4293
4433
  if (maxLineLen > 5e4) return findings;
4294
4434
  if (/demo-data|example-vulnerable|code-sample/i.test(filePath)) return findings;
4435
+ if (isSbomPath(filePath)) return findings;
4295
4436
  const vendoredFile = isVendoredPath(filePath);
4296
4437
  const ruleset = tier === "pro" && extraRules.length > 0 ? [...freeRules, ...extraRules] : freeRules;
4297
4438
  const silenceableLines = /-OK\b/i.test(content) ? content.split("\n") : null;
@@ -4300,12 +4441,21 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
4300
4441
  const matches = rule.check(content, filePath, project);
4301
4442
  const compliance = complianceMap[rule.id];
4302
4443
  const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
4444
+ const onTestPath = isTestPath(filePath);
4303
4445
  for (const match of matches) {
4304
4446
  if (silenceableLines && isLineSilenced(silenceableLines, match.line - 1, match.rule)) {
4305
4447
  continue;
4306
4448
  }
4449
+ const live = isLive({
4450
+ rule: match.rule,
4451
+ category: match.category,
4452
+ live: match.live,
4453
+ snippet: match.snippet
4454
+ });
4307
4455
  findings.push({
4308
4456
  ...vendored ? { vendored: true } : {},
4457
+ ...onTestPath && !live ? { testFile: true } : {},
4458
+ ...live ? { live: true } : {},
4309
4459
  id: `${match.rule}-${match.file}:${match.line}`,
4310
4460
  rule: match.rule,
4311
4461
  severity: match.severity,
@@ -4700,20 +4850,6 @@ var SAFE_PATTERNS = [
4700
4850
  ];
4701
4851
  var SKIP_FILES = /\.(css|scss|less|svg|md|txt|html?|xml|yml|yaml|toml|lock|map|woff2?|ttf|eot|ico|png|jpg|gif|webp)$/i;
4702
4852
  var SKIP_FILENAMES = /(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|composer\.lock|Gemfile\.lock|Cargo\.lock|poetry\.lock|Pipfile\.lock|shrinkwrap\.json)$/i;
4703
- var SKIP_SBOM_FILES = /(?:^|\/)(?:[^/]*\.spdx(?:\.json)?|[^/]*\.cdx\.json|[^/]*\.cdx\.xml|bom\.json|sbom[^/]*\.json|[^/]*\.sbom\.json)$/i;
4704
- function isEntropyTestPath(filePath) {
4705
- const normalized = filePath.replace(/\\/g, "/");
4706
- if (/(?:\.test\.|\.spec\.|__tests__|__mocks__|fixtures?\/)/i.test(normalized)) return true;
4707
- if (/(?:^|\/)(?:tests|spec)\//i.test(normalized)) return true;
4708
- if (/(?:^|\/)test\//i.test(normalized) && !/(?:^|\/)routes\/test\//i.test(normalized)) return true;
4709
- if (/(?:^|\/)[^/]+\.Tests\//.test(normalized)) return true;
4710
- const base = normalized.split("/").pop() ?? "";
4711
- if (/^test_.*\.py$/i.test(base)) return true;
4712
- if (/_test\.py$/i.test(base)) return true;
4713
- if (/^Test[A-Z_]\w*\.py$/.test(base)) return true;
4714
- if (/_test\.go$/.test(base)) return true;
4715
- return false;
4716
- }
4717
4853
  var SAFE_VAR_NAMES = /(?:description|message|text|label|title|content|template|html|svg|css|style|class(?:Name)?|query|mutation|schema|regex|pattern|format|placeholder|comment|url|path|route|endpoint|href|src|alt|name|type|version|encoding|charset|chars|alphabet|locale|translation|copy|prose|markdown|slug|handle)/i;
4718
4854
  var HASH_LIKE_VAR_NAMES = /(?:^|[^a-z])(?:hash|digest|checksum|fingerprint|etag|crc|md5|sha1|sha256|sha512|contenthash|buildid|revision|commit|sri|integrity|cacheKey|fileHash|assetId|versionId)(?:$|[^a-z])/i;
4719
4855
  var HASH_PREFIX_RE = /^(?:sha\d+|md5|crc32|base64|bcrypt|argon2|pbkdf2|blake2b?)[:_]/i;
@@ -4740,11 +4876,11 @@ function scanEntropy(files) {
4740
4876
  if (SKIP_FILENAMES.test(filePath)) continue;
4741
4877
  const basename = filePath.split("/").pop() || "";
4742
4878
  if (SKIP_FILENAMES.test(basename)) continue;
4743
- if (SKIP_SBOM_FILES.test(filePath) || SKIP_SBOM_FILES.test(basename)) continue;
4879
+ if (isSbomPath(filePath) || isSbomPath(basename)) continue;
4744
4880
  if (filePath.includes("node_modules")) continue;
4745
4881
  if (filePath.includes(".min.")) continue;
4746
4882
  if (/pro-rules-bundle|\.bundle\.|\.chunk\./i.test(filePath)) continue;
4747
- if (isEntropyTestPath(filePath)) continue;
4883
+ if (isTestPath(filePath)) continue;
4748
4884
  const vendored = isVendoredPath(filePath);
4749
4885
  const dotenv = isDotenvPath(filePath) && !DOTENV_EXAMPLE_RE.test(filePath);
4750
4886
  const lines = content.split("\n");
@@ -5049,6 +5185,7 @@ function getSnippet3(content, line) {
5049
5185
  function scanDependencies(files) {
5050
5186
  const findings = [];
5051
5187
  for (const { path: filePath, content } of files) {
5188
+ if (isSbomPath(filePath)) continue;
5052
5189
  if (filePath.endsWith("package.json") && !filePath.includes("node_modules")) {
5053
5190
  try {
5054
5191
  const pkg = JSON.parse(content);
@@ -5394,6 +5531,7 @@ var CONFIG_CHECKS = [
5394
5531
  function scanConfigs(files) {
5395
5532
  const findings = [];
5396
5533
  for (const { path: filePath, content } of files) {
5534
+ if (isSbomPath(filePath)) continue;
5397
5535
  for (const check of CONFIG_CHECKS) {
5398
5536
  if (!check.filePattern.test(filePath)) continue;
5399
5537
  const result = check.check(content, filePath);
@@ -5431,6 +5569,7 @@ function getSnippet5(content, line) {
5431
5569
  }).join("\n");
5432
5570
  }
5433
5571
  function scanMultiFile(files) {
5572
+ files = files.filter((f) => !isSbomPath(f.path));
5434
5573
  const findings = [];
5435
5574
  const fileMap = /* @__PURE__ */ new Map();
5436
5575
  for (const f of files) {
@@ -5781,7 +5920,7 @@ function extractScriptUrls(html, pageUrl, limit = 12) {
5781
5920
 
5782
5921
  // src/quality/context.ts
5783
5922
  function isExcludedPath(path) {
5784
- if (TEST_FILE_PATTERN.test(path)) return true;
5923
+ if (isTestPath(path)) return true;
5785
5924
  if (/(?:^|\/)[\w.-]*(?:fixtures?|mocks?|examples?|samples?)\//i.test(path)) return true;
5786
5925
  if (isVendoredPath(path)) return true;
5787
5926
  if (/(?:^|\/)(?:\.next|dist|build|out|coverage|node_modules)\//.test(path)) return true;
@@ -7594,8 +7733,8 @@ function hasOpenStateEarlyReturn(fn) {
7594
7733
  }
7595
7734
  return false;
7596
7735
  }
7597
- function isOpenGated(element, parents, baseName) {
7598
- if (MODAL_FILENAME.test(baseName)) return true;
7736
+ function isOpenGated(element, parents, baseName2) {
7737
+ if (MODAL_FILENAME.test(baseName2)) return true;
7599
7738
  let child = element;
7600
7739
  let parent = parents.get(child);
7601
7740
  for (let steps = 0; parent && steps < 256; steps++) {
@@ -7638,7 +7777,7 @@ var undeclaredModal = {
7638
7777
  if (DIALOG_PRIMITIVE.test(file.code)) continue;
7639
7778
  const program = parsed.ast.program;
7640
7779
  const parents = buildParents(program);
7641
- const baseName = baseNameWithoutExtension(file.path);
7780
+ const baseName2 = baseNameWithoutExtension(file.path);
7642
7781
  const elements = [];
7643
7782
  walkNodes2(program, (node) => {
7644
7783
  if (node.type === "JSXElement") elements.push(node);
@@ -7653,7 +7792,7 @@ var undeclaredModal = {
7653
7792
  if (!rendersElementChild(element)) continue;
7654
7793
  if (!hasFocusableDescendant(element)) continue;
7655
7794
  if (declaresSemantics(element)) continue;
7656
- if (!isOpenGated(element, parents, baseName)) continue;
7795
+ if (!isOpenGated(element, parents, baseName2)) continue;
7657
7796
  const line = opening.loc?.start.line ?? lineAt(file.content, opening.start ?? 0);
7658
7797
  hits.push({ file: file.path, line });
7659
7798
  break;
@@ -9361,11 +9500,15 @@ export {
9361
9500
  isInlineSilenced,
9362
9501
  isInsideFixMessage,
9363
9502
  isLineSilenced,
9503
+ isLive,
9364
9504
  isMethodCall,
9365
9505
  isPrivateAddress,
9506
+ isSbomPath,
9366
9507
  isServerSideFile,
9367
9508
  isServerTarget,
9368
9509
  isTestFile,
9510
+ isTestPath,
9511
+ isUngradedFinding,
9369
9512
  isVendoredFinding,
9370
9513
  isVendoredPath,
9371
9514
  lineNumberAt,