mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-02 18:25:45 +00:00
Merge pull request #1857 from Infisical/misc/added-pino-logger-redaction
misc: added logger redaction
This commit is contained in:
@@ -30,6 +30,37 @@ const loggerConfig = z.object({
|
|||||||
NODE_ENV: z.enum(["development", "test", "production"]).default("production")
|
NODE_ENV: z.enum(["development", "test", "production"]).default("production")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const redactedKeys = [
|
||||||
|
"accessToken",
|
||||||
|
"authToken",
|
||||||
|
"serviceToken",
|
||||||
|
"identityAccessToken",
|
||||||
|
"token",
|
||||||
|
"privateKey",
|
||||||
|
"serverPrivateKey",
|
||||||
|
"plainPrivateKey",
|
||||||
|
"plainProjectKey",
|
||||||
|
"encryptedPrivateKey",
|
||||||
|
"userPrivateKey",
|
||||||
|
"protectedKey",
|
||||||
|
"decryptKey",
|
||||||
|
"encryptedProjectKey",
|
||||||
|
"encryptedSymmetricKey",
|
||||||
|
"encryptedPrivateKey",
|
||||||
|
"backupPrivateKey",
|
||||||
|
"secretKey",
|
||||||
|
"SecretKey",
|
||||||
|
"botPrivateKey",
|
||||||
|
"encryptedKey",
|
||||||
|
"plaintextProjectKey",
|
||||||
|
"accessKey",
|
||||||
|
"botKey",
|
||||||
|
"decryptedSecret",
|
||||||
|
"secrets",
|
||||||
|
"key",
|
||||||
|
"password"
|
||||||
|
];
|
||||||
|
|
||||||
export const initLogger = async () => {
|
export const initLogger = async () => {
|
||||||
const cfg = loggerConfig.parse(process.env);
|
const cfg = loggerConfig.parse(process.env);
|
||||||
const targets: pino.TransportMultiOptions["targets"][number][] = [
|
const targets: pino.TransportMultiOptions["targets"][number][] = [
|
||||||
@@ -74,7 +105,9 @@ export const initLogger = async () => {
|
|||||||
hostname: bindings.hostname
|
hostname: bindings.hostname
|
||||||
// node_version: process.version
|
// node_version: process.version
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
// redact until depth of three
|
||||||
|
redact: [...redactedKeys, ...redactedKeys.map((key) => `*.${key}`), ...redactedKeys.map((key) => `*.*.${key}`)]
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||||
transport
|
transport
|
||||||
|
|||||||
Reference in New Issue
Block a user