fix: make sensitive field whitelist case-insensitive

This commit is contained in:
SK Akram
2026-02-14 10:13:43 +00:00
committed by Gustavo Madeira Santana
parent 6565ec2e53
commit 7050a2e001

View File

@@ -107,8 +107,9 @@ const SENSITIVE_KEY_WHITELIST = new Set([
const SENSITIVE_PATTERNS = [/token$/i, /password/i, /secret/i, /api.?key/i];
export function isSensitiveConfigPath(path: string): boolean {
const lowerPath = path.toLowerCase();
return (
!Array.from(SENSITIVE_KEY_WHITELIST).some((suffix) => path.endsWith(suffix)) &&
!Array.from(SENSITIVE_KEY_WHITELIST).some((suffix) => lowerPath.endsWith(suffix)) &&
SENSITIVE_PATTERNS.some((pattern) => pattern.test(path))
);
}