diff --git a/src/config/schema.hints.ts b/src/config/schema.hints.ts index 5eb5dd722fe3..214678821be6 100644 --- a/src/config/schema.hints.ts +++ b/src/config/schema.hints.ts @@ -101,14 +101,19 @@ const SENSITIVE_KEY_WHITELIST_SUFFIXES = [ "tokencount", "tokenlimit", "tokenbudget", - "passwordfile", + "passwordFile", ] as const; +const NORMALIZED_SENSITIVE_KEY_WHITELIST_SUFFIXES = SENSITIVE_KEY_WHITELIST_SUFFIXES.map((suffix) => + suffix.toLowerCase(), +); const SENSITIVE_PATTERNS = [/token$/i, /password/i, /secret/i, /api.?key/i]; export function isSensitiveConfigPath(path: string): boolean { const lowerPath = path.toLowerCase(); - const whitelisted = SENSITIVE_KEY_WHITELIST_SUFFIXES.some((suffix) => lowerPath.endsWith(suffix)); + const whitelisted = NORMALIZED_SENSITIVE_KEY_WHITELIST_SUFFIXES.some((suffix) => + lowerPath.endsWith(suffix), + ); return !whitelisted && SENSITIVE_PATTERNS.some((pattern) => pattern.test(path)); }