mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 13:30:48 +00:00
fix: make sensitive field whitelist case-insensitive
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
6565ec2e53
commit
7050a2e001
@@ -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))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user