xploitscan-shared-rules 2.0.2 → 2.1.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
@@ -13,7 +13,7 @@ import { File, Node, CallExpression, ObjectExpression, BinaryExpression } from '
13
13
  * ProjectContext is the narrow exception: a small set of facts computed ONCE
14
14
  * over the whole file list before any rule runs, then handed to every rule.
15
15
  * It is intentionally not "here is every file" — that would let rules re-parse
16
- * the project 214 times and quietly become a cross-file analyser, which the
16
+ * the project 223 times and quietly become a cross-file analyser, which the
17
17
  * roadmap explicitly rules out as an unwinnable race against CodeQL.
18
18
  *
19
19
  * Every field is optional and every consumer must behave correctly when the
@@ -186,8 +186,11 @@ declare function getSnippet(content: string, line: number, contextLines?: number
186
186
  * 3. Multi-line block: `/* VC146-OK: ... *\/` above the match
187
187
  *
188
188
  * The marker is `<RULE-ID>-OK` (with optional `:` and explanation) or the
189
- * wildcard `scanner-OK`. Both `#` (Python/Ruby/sh) and `//` (JS/TS/Go)
190
- * comment prefixes are accepted.
189
+ * wildcard `scanner-OK`. `#` (Python/Ruby/sh), `//` (JS/TS/Go) and `--`
190
+ * (SQL) comment prefixes are accepted. `--` is there because rules now read
191
+ * migration SQL (VC215), where `--` is the only line comment a developer
192
+ * would think to write; without it the marker the fix text recommends would
193
+ * silently do nothing in exactly the files that rule scans.
191
194
  *
192
195
  * Rationale: some findings aren't a regex-tightening problem — they're "I
193
196
  * have reviewed this and accept it here." An intentionally public OG-image
@@ -691,6 +694,67 @@ declare function checkIntent(files: Array<{
691
694
  content: string;
692
695
  }>, findings: Finding[]): IntentReport;
693
696
 
697
+ /**
698
+ * Browser-exposed environment variables: which names a framework ships to the
699
+ * client, and which of those look like secrets.
700
+ *
701
+ * Shared by VC011 (secret-named variable in a .env file), the entropy scanner
702
+ * (which must not suppress a secret just because its name is public-prefixed,
703
+ * and must not report a public-by-design key either) and the Pro rule for AI
704
+ * keys read in browser code. One definition, so the three cannot disagree
705
+ * about whether VITE_SUPABASE_ANON_KEY is a secret.
706
+ */
707
+ /**
708
+ * Env-var prefixes a framework inlines into code it ships to the browser, or
709
+ * into a mobile app bundle: Next.js NEXT_PUBLIC_, Vite VITE_, Create React App
710
+ * REACT_APP_, Expo EXPO_PUBLIC_, Gatsby GATSBY_, SvelteKit/Astro PUBLIC_ and
711
+ * Nuxt NUXT_PUBLIC_ (which fills runtimeConfig.public, sent to every client).
712
+ *
713
+ * VC011 only knew NEXT_PUBLIC_. The AI app builders mostly generate Vite apps
714
+ * (Lovable, Bolt) or Expo apps, so `VITE_OPENAI_API_KEY=sk-…` in a committed
715
+ * .env — a key that ends up in the public JavaScript of every deploy — got no
716
+ * finding naming the problem. Vite's own docs say VITE_* variables "should not
717
+ * contain sensitive information such as API keys".
718
+ *
719
+ * Anchored, so `PUBLIC_` cannot match inside `NEXT_PUBLIC_`/`NUXT_PUBLIC_`/
720
+ * `EXPO_PUBLIC_`; alternation order puts those first for the same reason.
721
+ * Exported for the Pro browser-key rule and the entropy scanner, which apply
722
+ * the same idea of "exposed by name".
723
+ */
724
+ declare const PUBLIC_ENV_PREFIX_RE: RegExp;
725
+ /**
726
+ * Classify an env var by name (and, if known, value): `null` when the name has
727
+ * no browser-exposed prefix, otherwise the prefix and whether the variable
728
+ * looks like a secret. Order matters: a publishable VALUE beats any name; an
729
+ * unambiguous secret word beats the public-by-design list (so
730
+ * VITE_FIREBASE_ADMIN_PRIVATE_KEY is still a secret); a key-like name that
731
+ * survives both is treated as a secret.
732
+ *
733
+ * `publicByDesign` is true only when something positively says the value is
734
+ * not a credential — a publishable value, a boolean/number/plain URL, an anon
735
+ * JWT, or a name on the public-by-design list. A name that merely does not
736
+ * look key-like is `secret: false` without it, so the entropy scanner can
737
+ * still judge the value on its own.
738
+ */
739
+ declare function classifyPublicEnvVar(name: string, value?: string): {
740
+ prefix: string;
741
+ secret: boolean;
742
+ publicByDesign: boolean;
743
+ } | null;
744
+ declare function isDotenvPath(filePath: string): boolean;
745
+ /**
746
+ * `NAME=value` / `export NAME=value`, the dotenv grammar. The value stops at a
747
+ * line break of either kind: callers split on "\n", so a CRLF file leaves a
748
+ * trailing "\r" on every line, and `(.*)$` (`.` does not match "\r") made
749
+ * every line of a Windows-saved .env fail to parse.
750
+ */
751
+ declare const DOTENV_ASSIGN_RE: RegExp;
752
+ /**
753
+ * The value of a dotenv assignment, as dotenv reads it: the text inside
754
+ * matching quotes, or for an unquoted value everything up to a ` #` comment.
755
+ */
756
+ declare function dotenvValue(raw: string): string;
757
+
694
758
  /**
695
759
  * Centralized Babel parser with per-file caching.
696
760
  *
@@ -820,6 +884,19 @@ declare function isTestFile(filePath: string): boolean;
820
884
  * beneath them, so this is not a fixture artefact.
821
885
  */
822
886
  declare function maskComments(content: string): string;
887
+ /**
888
+ * Replace every closed `/* … *\/` block comment with `replace(comment)`.
889
+ * Same output as `content.replace(/\/\*[\s\S]*?\*\//g, replace)`, in linear
890
+ * time.
891
+ *
892
+ * WHY NOT THAT REGEX. The lazy `[\s\S]*?` scans to the end of the file for
893
+ * every `/*` that has no closer, so a payload of unclosed `/*` lines costs
894
+ * O(n²): about 1.6s per caller on 256KB, and maskComments has many callers.
895
+ * Here each `/*` costs one indexOf for its closer. When there is none, no
896
+ * later `/*` can be closed either (its closer would have been found first),
897
+ * so the rest of the file is left as it is, which is what the regex does.
898
+ */
899
+ declare function replaceBlockComments(content: string, replace: (comment: string) => string): string;
823
900
  /**
824
901
  * Return the source of the handler enclosing `index`, or null if none is found.
825
902
  *
@@ -891,6 +968,47 @@ declare function tryParse(content: string, filePath: string): {
891
968
  } | null;
892
969
  declare const hardcodedSecrets: CustomRule;
893
970
  declare const exposedEnvFile: CustomRule;
971
+ /**
972
+ * Blank the parts of a file that LOOK like caller authentication but are the
973
+ * server authenticating ITSELF to somebody else, or chat-message plumbing.
974
+ *
975
+ * WHY THIS EXISTS. An AI chat endpoint is the most common server function an
976
+ * AI app builder writes, and every one of them contains
977
+ *
978
+ * fetch("https://ai.gateway.lovable.dev/v1/chat/completions", {
979
+ * headers: { Authorization: `Bearer ${LOVABLE_API_KEY}` },
980
+ * body: JSON.stringify({ messages: [{ role: "user", content }] }),
981
+ * })
982
+ *
983
+ * The outbound `Authorization: Bearer …` header matched VC003's `bearer`,
984
+ * `authorization` and strong `bearer\s` patterns, and `role: "user"` matched
985
+ * its `user` hint, so an endpoint that lets anyone on the internet spend the
986
+ * owner's AI credits was reported as authenticated. Neither says anything
987
+ * about who is CALLING the endpoint.
988
+ *
989
+ * What is blanked:
990
+ * - `role: "user" | "assistant" | "system" | …` literals;
991
+ * - object literals passed as request headers (`headers: { … }`,
992
+ * `headers = { … }`, `new Headers({ … })`), unless the object forwards
993
+ * the inbound request's credential (see INBOUND_CREDENTIAL_READ_RE), or
994
+ * a variable bound to one (see credentialValueReadsCaller);
995
+ * - `headers.set("Authorization", …)` style calls building outbound headers,
996
+ * with the same exception;
997
+ * - SDK key configuration, `apiKey: process.env.X` / `Deno.env.get("X")`.
998
+ *
999
+ * What is NOT blanked, on purpose: anything that reads the inbound request
1000
+ * (`req.headers.get("Authorization")`, `getUser(token)`, a 401 branch). Those
1001
+ * are the evidence the rule is looking for.
1002
+ *
1003
+ * Offset-preserving (every blanked character becomes a space, newlines are
1004
+ * kept), so the result can stand in for the input in code that slices by
1005
+ * index or reports line numbers.
1006
+ *
1007
+ * Linear: every regex here is bounded, and the brace scan is capped both per
1008
+ * object and in the number of objects examined. Past the cap the remaining
1009
+ * objects are left as they are, which can only suppress a finding.
1010
+ */
1011
+ declare function maskOutboundAuthNoise(code: string): string;
894
1012
  declare const missingAuthMiddleware: CustomRule;
895
1013
  declare const supabaseNoRLS: CustomRule;
896
1014
  declare const stripeWebhookUnprotected: CustomRule;
@@ -986,7 +1104,7 @@ project?: ProjectContext): Finding[];
986
1104
  * CLI should have to import to print one.
987
1105
  *
988
1106
  * Since 2.0.0 the Pro rules are not in this package at all — they live in the
989
- * private packages/pro-rules — so this package CANNOT compute 184 or 214: the
1107
+ * private packages/pro-rules — so this package CANNOT compute 193 or 223: the
990
1108
  * arrays those numbers describe do not exist here. Literals are the only way
991
1109
  * to publish them.
992
1110
  *
@@ -1000,9 +1118,9 @@ project?: ProjectContext): Finding[];
1000
1118
  /** Rules any caller gets, including anonymous and free-tier CLI users. */
1001
1119
  declare const FREE_RULE_COUNT = 30;
1002
1120
  /** Rules gated behind a paid plan and served from the API, never bundled. */
1003
- declare const PRO_RULE_COUNT = 184;
1121
+ declare const PRO_RULE_COUNT = 193;
1004
1122
  /** The full catalog. FREE_RULE_COUNT + PRO_RULE_COUNT, asserted in the test. */
1005
- declare const TOTAL_RULE_COUNT = 214;
1123
+ declare const TOTAL_RULE_COUNT = 223;
1006
1124
 
1007
1125
  interface FilteredFinding {
1008
1126
  finding: Finding;
@@ -1369,4 +1487,4 @@ input: {
1369
1487
  content: string;
1370
1488
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1371
1489
 
1372
- export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, 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, 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, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isInlineSilenced, isInsideFixMessage, isLineSilenced, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, routeForFile, runCustomRules, scanEntropy, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
1490
+ 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, 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, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, 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, scanEntropy, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import { File, Node, CallExpression, ObjectExpression, BinaryExpression } from '
13
13
  * ProjectContext is the narrow exception: a small set of facts computed ONCE
14
14
  * over the whole file list before any rule runs, then handed to every rule.
15
15
  * It is intentionally not "here is every file" — that would let rules re-parse
16
- * the project 214 times and quietly become a cross-file analyser, which the
16
+ * the project 223 times and quietly become a cross-file analyser, which the
17
17
  * roadmap explicitly rules out as an unwinnable race against CodeQL.
18
18
  *
19
19
  * Every field is optional and every consumer must behave correctly when the
@@ -186,8 +186,11 @@ declare function getSnippet(content: string, line: number, contextLines?: number
186
186
  * 3. Multi-line block: `/* VC146-OK: ... *\/` above the match
187
187
  *
188
188
  * The marker is `<RULE-ID>-OK` (with optional `:` and explanation) or the
189
- * wildcard `scanner-OK`. Both `#` (Python/Ruby/sh) and `//` (JS/TS/Go)
190
- * comment prefixes are accepted.
189
+ * wildcard `scanner-OK`. `#` (Python/Ruby/sh), `//` (JS/TS/Go) and `--`
190
+ * (SQL) comment prefixes are accepted. `--` is there because rules now read
191
+ * migration SQL (VC215), where `--` is the only line comment a developer
192
+ * would think to write; without it the marker the fix text recommends would
193
+ * silently do nothing in exactly the files that rule scans.
191
194
  *
192
195
  * Rationale: some findings aren't a regex-tightening problem — they're "I
193
196
  * have reviewed this and accept it here." An intentionally public OG-image
@@ -691,6 +694,67 @@ declare function checkIntent(files: Array<{
691
694
  content: string;
692
695
  }>, findings: Finding[]): IntentReport;
693
696
 
697
+ /**
698
+ * Browser-exposed environment variables: which names a framework ships to the
699
+ * client, and which of those look like secrets.
700
+ *
701
+ * Shared by VC011 (secret-named variable in a .env file), the entropy scanner
702
+ * (which must not suppress a secret just because its name is public-prefixed,
703
+ * and must not report a public-by-design key either) and the Pro rule for AI
704
+ * keys read in browser code. One definition, so the three cannot disagree
705
+ * about whether VITE_SUPABASE_ANON_KEY is a secret.
706
+ */
707
+ /**
708
+ * Env-var prefixes a framework inlines into code it ships to the browser, or
709
+ * into a mobile app bundle: Next.js NEXT_PUBLIC_, Vite VITE_, Create React App
710
+ * REACT_APP_, Expo EXPO_PUBLIC_, Gatsby GATSBY_, SvelteKit/Astro PUBLIC_ and
711
+ * Nuxt NUXT_PUBLIC_ (which fills runtimeConfig.public, sent to every client).
712
+ *
713
+ * VC011 only knew NEXT_PUBLIC_. The AI app builders mostly generate Vite apps
714
+ * (Lovable, Bolt) or Expo apps, so `VITE_OPENAI_API_KEY=sk-…` in a committed
715
+ * .env — a key that ends up in the public JavaScript of every deploy — got no
716
+ * finding naming the problem. Vite's own docs say VITE_* variables "should not
717
+ * contain sensitive information such as API keys".
718
+ *
719
+ * Anchored, so `PUBLIC_` cannot match inside `NEXT_PUBLIC_`/`NUXT_PUBLIC_`/
720
+ * `EXPO_PUBLIC_`; alternation order puts those first for the same reason.
721
+ * Exported for the Pro browser-key rule and the entropy scanner, which apply
722
+ * the same idea of "exposed by name".
723
+ */
724
+ declare const PUBLIC_ENV_PREFIX_RE: RegExp;
725
+ /**
726
+ * Classify an env var by name (and, if known, value): `null` when the name has
727
+ * no browser-exposed prefix, otherwise the prefix and whether the variable
728
+ * looks like a secret. Order matters: a publishable VALUE beats any name; an
729
+ * unambiguous secret word beats the public-by-design list (so
730
+ * VITE_FIREBASE_ADMIN_PRIVATE_KEY is still a secret); a key-like name that
731
+ * survives both is treated as a secret.
732
+ *
733
+ * `publicByDesign` is true only when something positively says the value is
734
+ * not a credential — a publishable value, a boolean/number/plain URL, an anon
735
+ * JWT, or a name on the public-by-design list. A name that merely does not
736
+ * look key-like is `secret: false` without it, so the entropy scanner can
737
+ * still judge the value on its own.
738
+ */
739
+ declare function classifyPublicEnvVar(name: string, value?: string): {
740
+ prefix: string;
741
+ secret: boolean;
742
+ publicByDesign: boolean;
743
+ } | null;
744
+ declare function isDotenvPath(filePath: string): boolean;
745
+ /**
746
+ * `NAME=value` / `export NAME=value`, the dotenv grammar. The value stops at a
747
+ * line break of either kind: callers split on "\n", so a CRLF file leaves a
748
+ * trailing "\r" on every line, and `(.*)$` (`.` does not match "\r") made
749
+ * every line of a Windows-saved .env fail to parse.
750
+ */
751
+ declare const DOTENV_ASSIGN_RE: RegExp;
752
+ /**
753
+ * The value of a dotenv assignment, as dotenv reads it: the text inside
754
+ * matching quotes, or for an unquoted value everything up to a ` #` comment.
755
+ */
756
+ declare function dotenvValue(raw: string): string;
757
+
694
758
  /**
695
759
  * Centralized Babel parser with per-file caching.
696
760
  *
@@ -820,6 +884,19 @@ declare function isTestFile(filePath: string): boolean;
820
884
  * beneath them, so this is not a fixture artefact.
821
885
  */
822
886
  declare function maskComments(content: string): string;
887
+ /**
888
+ * Replace every closed `/* … *\/` block comment with `replace(comment)`.
889
+ * Same output as `content.replace(/\/\*[\s\S]*?\*\//g, replace)`, in linear
890
+ * time.
891
+ *
892
+ * WHY NOT THAT REGEX. The lazy `[\s\S]*?` scans to the end of the file for
893
+ * every `/*` that has no closer, so a payload of unclosed `/*` lines costs
894
+ * O(n²): about 1.6s per caller on 256KB, and maskComments has many callers.
895
+ * Here each `/*` costs one indexOf for its closer. When there is none, no
896
+ * later `/*` can be closed either (its closer would have been found first),
897
+ * so the rest of the file is left as it is, which is what the regex does.
898
+ */
899
+ declare function replaceBlockComments(content: string, replace: (comment: string) => string): string;
823
900
  /**
824
901
  * Return the source of the handler enclosing `index`, or null if none is found.
825
902
  *
@@ -891,6 +968,47 @@ declare function tryParse(content: string, filePath: string): {
891
968
  } | null;
892
969
  declare const hardcodedSecrets: CustomRule;
893
970
  declare const exposedEnvFile: CustomRule;
971
+ /**
972
+ * Blank the parts of a file that LOOK like caller authentication but are the
973
+ * server authenticating ITSELF to somebody else, or chat-message plumbing.
974
+ *
975
+ * WHY THIS EXISTS. An AI chat endpoint is the most common server function an
976
+ * AI app builder writes, and every one of them contains
977
+ *
978
+ * fetch("https://ai.gateway.lovable.dev/v1/chat/completions", {
979
+ * headers: { Authorization: `Bearer ${LOVABLE_API_KEY}` },
980
+ * body: JSON.stringify({ messages: [{ role: "user", content }] }),
981
+ * })
982
+ *
983
+ * The outbound `Authorization: Bearer …` header matched VC003's `bearer`,
984
+ * `authorization` and strong `bearer\s` patterns, and `role: "user"` matched
985
+ * its `user` hint, so an endpoint that lets anyone on the internet spend the
986
+ * owner's AI credits was reported as authenticated. Neither says anything
987
+ * about who is CALLING the endpoint.
988
+ *
989
+ * What is blanked:
990
+ * - `role: "user" | "assistant" | "system" | …` literals;
991
+ * - object literals passed as request headers (`headers: { … }`,
992
+ * `headers = { … }`, `new Headers({ … })`), unless the object forwards
993
+ * the inbound request's credential (see INBOUND_CREDENTIAL_READ_RE), or
994
+ * a variable bound to one (see credentialValueReadsCaller);
995
+ * - `headers.set("Authorization", …)` style calls building outbound headers,
996
+ * with the same exception;
997
+ * - SDK key configuration, `apiKey: process.env.X` / `Deno.env.get("X")`.
998
+ *
999
+ * What is NOT blanked, on purpose: anything that reads the inbound request
1000
+ * (`req.headers.get("Authorization")`, `getUser(token)`, a 401 branch). Those
1001
+ * are the evidence the rule is looking for.
1002
+ *
1003
+ * Offset-preserving (every blanked character becomes a space, newlines are
1004
+ * kept), so the result can stand in for the input in code that slices by
1005
+ * index or reports line numbers.
1006
+ *
1007
+ * Linear: every regex here is bounded, and the brace scan is capped both per
1008
+ * object and in the number of objects examined. Past the cap the remaining
1009
+ * objects are left as they are, which can only suppress a finding.
1010
+ */
1011
+ declare function maskOutboundAuthNoise(code: string): string;
894
1012
  declare const missingAuthMiddleware: CustomRule;
895
1013
  declare const supabaseNoRLS: CustomRule;
896
1014
  declare const stripeWebhookUnprotected: CustomRule;
@@ -986,7 +1104,7 @@ project?: ProjectContext): Finding[];
986
1104
  * CLI should have to import to print one.
987
1105
  *
988
1106
  * Since 2.0.0 the Pro rules are not in this package at all — they live in the
989
- * private packages/pro-rules — so this package CANNOT compute 184 or 214: the
1107
+ * private packages/pro-rules — so this package CANNOT compute 193 or 223: the
990
1108
  * arrays those numbers describe do not exist here. Literals are the only way
991
1109
  * to publish them.
992
1110
  *
@@ -1000,9 +1118,9 @@ project?: ProjectContext): Finding[];
1000
1118
  /** Rules any caller gets, including anonymous and free-tier CLI users. */
1001
1119
  declare const FREE_RULE_COUNT = 30;
1002
1120
  /** Rules gated behind a paid plan and served from the API, never bundled. */
1003
- declare const PRO_RULE_COUNT = 184;
1121
+ declare const PRO_RULE_COUNT = 193;
1004
1122
  /** The full catalog. FREE_RULE_COUNT + PRO_RULE_COUNT, asserted in the test. */
1005
- declare const TOTAL_RULE_COUNT = 214;
1123
+ declare const TOTAL_RULE_COUNT = 223;
1006
1124
 
1007
1125
  interface FilteredFinding {
1008
1126
  finding: Finding;
@@ -1369,4 +1487,4 @@ input: {
1369
1487
  content: string;
1370
1488
  }[] | QualityContext, rules?: QualityRule[]): Finding[];
1371
1489
 
1372
- export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, 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, 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, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isInlineSilenced, isInsideFixMessage, isLineSilenced, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, routeForFile, runCustomRules, scanEntropy, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
1490
+ 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, 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, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, 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, scanEntropy, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };