feat: add feedback operations report

This commit is contained in:
Codex
2026-06-30 15:38:47 +08:00
parent 87f4cf9c4e
commit ddad2ac04d
17 changed files with 593 additions and 44 deletions

View File

@@ -25,6 +25,7 @@ const importSecretValues = process.env.IMPORT_SECRET_VALUES === 'true';
const sensitiveKeyPattern =
/(password|token|secret|privatekey|sessionkey|accesskey|appkey|apikey|api_v3_key|notifytoken|aeskey|openid|unionid|wxaccesstoken|wechatsessionkey|smscode|verifycode|verificationcode|captcha)/i;
const identityKeyPattern = /(phone|email|openid|unionid|sessionkey)/i;
const externalAvatarKeyPattern = /(avatar|headimg|figureurl|profilephoto|portrait)/i;
const legacyLookupTables = new Set([
'activation_codes',
@@ -109,7 +110,7 @@ function sanitizeRecord(record: JsonRecord): JsonRecord {
function stripSensitiveKeys(value: unknown, keyPath = ''): unknown {
const key = keyPath.split('.').pop() || keyPath;
if (sensitiveKeyPattern.test(key)) return undefined;
if (sensitiveKeyPattern.test(key) || externalAvatarKeyPattern.test(key)) return undefined;
if (Array.isArray(value)) {
return value.map((item, index) => stripSensitiveKeys(item, `${keyPath}.${index}`)).filter(item => item !== undefined);
}
@@ -2293,7 +2294,7 @@ async function normalizeUsers(records: JsonRecord[]) {
text(r.email),
text(r.phone),
text(r.name) || text(r.username),
text(r.avatar),
null,
normalizeTenantRole(r.role),
intValue(r.score),
dateText(r.lastSeenAt),