mirror of
https://github.com/docmost/docmost.git
synced 2026-05-06 22:03:06 +08:00
fix: logs
This commit is contained in:
@@ -142,6 +142,18 @@ export function isUserDisabled(user: {
|
||||
return !!(user.deactivatedAt || user.deletedAt);
|
||||
}
|
||||
|
||||
const SENSITIVE_URL_PREFIXES = ['/api/sso/'];
|
||||
|
||||
export function redactSensitiveUrl(url: string): string {
|
||||
if (url && SENSITIVE_URL_PREFIXES.some((prefix) => url.includes(prefix))) {
|
||||
const qsIndex = url.indexOf('?');
|
||||
if (qsIndex !== -1) {
|
||||
return url.substring(0, qsIndex);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export function createByteCountingStream(source: Readable) {
|
||||
let bytesRead = 0;
|
||||
const stream = new Transform({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Params } from 'nestjs-pino';
|
||||
import { stdTimeFunctions } from 'pino';
|
||||
import { redactSensitiveUrl } from '../helpers/utils';
|
||||
|
||||
const CONTEXTS_TO_IGNORE = [
|
||||
'InstanceLoader',
|
||||
@@ -52,7 +53,7 @@ export function createPinoConfig(): Params {
|
||||
serializers: {
|
||||
req: (req) => ({
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
url: redactSensitiveUrl(req.url),
|
||||
ip: req.ip || req.remoteAddress,
|
||||
userAgent: req.headers?.['user-agent'],
|
||||
}),
|
||||
|
||||
+1
-1
Submodule apps/server/src/ee updated: 38158a5ab6...dc7ae0e3b0
Reference in New Issue
Block a user