/** * @file Shared catalog of secret-bearing env-var key names and literal * secret-value shapes. One source of truth for every scanner that looks for * accidentally-checked-in or accidentally-printed credentials, so a new * vendor shape is added once and every gate picks it up. * Keep the catalog narrow + auditable. Adding a name here means every * consumer will scan for it; false-positives on legitimate config keys * (e.g. `FOO_API_VERSION=2.1`) are real friction. Names follow the published * env-var convention of each tool — when in doubt, prefer the official docs * over guessed shapes. Layout: * * - Per-category arrays so consumers can opt out of specific categories if * needed (e.g. an AWS-only repo might not care about Linear). * - `ALL_TOKEN_KEY_PATTERNS` is the flat union used by default. * - `GENERIC_TOKEN_SUFFIX_RE` catches anything ending in `_TOKEN` / `_KEY` / * `_SECRET` after the named lists; consumers decide whether to include it. * The trade-off: catches more leaks but also fires on * `JWT_PUBLIC_KEY=-----BEGIN PUBLIC KEY----` etc. The named lists are the * recommended primary pass. If you need to add a name, add it to the * matching category. If the category doesn't exist yet, add it (with a * comment naming the vendor / product) — don't dump it into MISC. */ export declare const SOCKET_FLEET_TOKEN_PATTERNS: readonly RegExp[]; export declare const LLM_TOKEN_PATTERNS: readonly RegExp[]; export declare const VCS_TOKEN_PATTERNS: readonly RegExp[]; export declare const PRODUCT_TOKEN_PATTERNS: readonly RegExp[]; export declare const CHAT_TOKEN_PATTERNS: readonly RegExp[]; export declare const CLOUD_TOKEN_PATTERNS: readonly RegExp[]; export declare const REGISTRY_TOKEN_PATTERNS: readonly RegExp[]; export declare const PAYMENT_TOKEN_PATTERNS: readonly RegExp[]; export declare const EMAIL_TOKEN_PATTERNS: readonly RegExp[]; export declare const OBSERVABILITY_TOKEN_PATTERNS: readonly RegExp[]; export declare const CI_TOKEN_PATTERNS: readonly RegExp[]; /** * Flat union of every named category above. Default catalog for consumers that * don't need per-category granularity. */ export declare const ALL_TOKEN_KEY_PATTERNS: readonly RegExp[]; /** * Fallback: anything that _looks_ like a token by suffix. Catches vendors not * in the named lists at the cost of false-positives on things like * `JWT_PUBLIC_KEY` (which is decidedly NOT a secret). Consumers should use this * as an additional pass after the named lists, not in place of them. * * The shape: `__` — at least one * underscore-separated qualifier word in front of the suffix to avoid matching * bare `KEY=`/`TOKEN=` keys, which are usually loop indices, not secrets. */ export declare const GENERIC_TOKEN_SUFFIX_RE: RegExp; /** * Check if the given key name matches any pattern in * `ALL_TOKEN_KEY_PATTERNS`. Doesn't include the generic suffix fallback — * callers that want it should test `isTokenKey(key) || * GENERIC_TOKEN_SUFFIX_RE.test(key)`. * * @example * ;```ts * isTokenKey('ANTHROPIC_API_KEY') // true * isTokenKey('FOO_API_VERSION') // false * ``` * * @param key - The env-var key name to test. * * @returns `true` if the key names a known secret-bearing env var. */ export declare function isTokenKey(key: string): boolean; /** * Substring fragments matched case-insensitively against arbitrary command * text. Different shape from `ALL_TOKEN_KEY_PATTERNS`: those match a parsed * KEY= identifier exactly, these match anywhere in arbitrary command text * (`curl -H "Authorization: $TOKEN"` → matches "TOKEN" → flag for inspection). * * Kept short to minimize false positives. A "PASSWORD" mention in a * commit-message body would otherwise trip every commit, so consumers should * narrow matches to assignment / flag-value positions rather than any * occurrence in arbitrary text. */ export declare const SENSITIVE_NAME_FRAGMENTS: readonly string[]; export interface SecretValuePattern { re: RegExp; label: string; } export declare const SECRET_VALUE_PATTERNS: readonly SecretValuePattern[]; export interface SecretValueHit { label: string; match: string; } /** * Return the first secret-VALUE shape matched in `text`, or `undefined`. Used * by every secret gate (Bash / edit / commit) so they share one detection * list. * * @param text - Arbitrary text to scan for literal secret-value shapes. * * @returns The first hit's `label` + `match`, or `undefined` when clean. */ export declare function scanSecretValues(text: string): SecretValueHit | undefined;