forked from wangziqi/gongxue-base
feat: add feedback operations report
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user