feature(auth): replace clerk.com with custom auth (#103)
* feature(auth): replace clerk.com with custom auth * minor fixes * remove notification preferences * decrease live events interval fix(api): cookies.. # Conflicts: # .gitignore # apps/api/src/index.ts # apps/dashboard/src/app/providers.tsx # packages/trpc/src/trpc.ts
This commit is contained in:
committed by
Carl-Gerhard Lindesvärd
parent
f28802b1c2
commit
d31d9924a5
@@ -32,8 +32,37 @@ export function createLogger({ name }: { name: string }): ILogger {
|
||||
return info;
|
||||
});
|
||||
|
||||
const sensitiveKeys = [
|
||||
'password',
|
||||
'token',
|
||||
'secret',
|
||||
'authorization',
|
||||
'apiKey',
|
||||
];
|
||||
|
||||
const redactSensitiveInfo = winston.format((info) => {
|
||||
const redactObject = (obj: any): any => {
|
||||
if (!obj || typeof obj !== 'object') return obj;
|
||||
|
||||
return Object.keys(obj).reduce((acc, key) => {
|
||||
const lowerKey = key.toLowerCase();
|
||||
if (sensitiveKeys.some((k) => lowerKey.includes(k))) {
|
||||
acc[key] = '[REDACTED]';
|
||||
} else if (typeof obj[key] === 'object') {
|
||||
acc[key] = redactObject(obj[key]);
|
||||
} else {
|
||||
acc[key] = obj[key];
|
||||
}
|
||||
return acc;
|
||||
}, {} as any);
|
||||
};
|
||||
|
||||
return Object.assign({}, info, redactObject(info));
|
||||
});
|
||||
|
||||
const format = winston.format.combine(
|
||||
errorFormatter(),
|
||||
redactSensitiveInfo(),
|
||||
winston.format.json(),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user