phase 16 implementation

This commit is contained in:
root
2026-06-25 20:08:39 -04:00
parent 5d017f533a
commit c43620a005
248 changed files with 18458 additions and 90 deletions
+32
View File
@@ -0,0 +1,32 @@
const sensitiveKeys = new Set([
'fullname',
'name',
'workemail',
'email',
'company',
'market',
'message',
'phone',
'fieldvalue',
'serverresponse',
]);
export function redactSensitive(value: unknown): unknown {
if (Array.isArray(value)) return value.map(redactSensitive);
if (!value || typeof value !== 'object') return value;
return Object.fromEntries(
Object.entries(value).map(([key, child]) => [
key,
sensitiveKeys.has(key.toLowerCase()) ? '[REDACTED]' : redactSensitive(child),
]),
);
}
export function containsSensitiveKey(value: unknown): boolean {
if (Array.isArray(value)) return value.some(containsSensitiveKey);
if (!value || typeof value !== 'object') return false;
return Object.entries(value).some(
([key, child]) => sensitiveKeys.has(key.toLowerCase()) || containsSensitiveKey(child),
);
}