Files
speckle-server/packages/server/logging/loggingHelper.js
T
Kristaps Fabians Geikins 83d8035dc2 chore: upgrade to eslint 9 (#2348)
* root + server

* frontend

* frontend-2

* dui3

* dui3

* tailwind theme

* ui-components

* preview service

* viewer

* viewer-sandbox

* fileimport-service

* webhook service

* objectloader

* shared

* ui-components-nuxt

* WIP full config

* WIP full linter

* eslint projectwide util

* minor fix

* removing redundant ci

* clean up test errors

* fixed prettier formatting

* CI improvements

* TSC lint fix

* 'buildBatch' needs to be async since some batch types (like Text) require it. Removed a disabled liniting rule from ObjLoader

* removed unnecessary void

---------

Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
2024-06-12 14:38:02 +03:00

40 lines
752 B
JavaScript

/**
* @returns {Record<string, unknown>}
*/
const redactSensitiveVariables = (variables) => {
if (!variables) {
return variables
}
if (Array.isArray(variables)) {
return variables.map((v) => redactSensitiveVariables(v))
}
if (typeof variables !== 'object') {
return variables
}
return Object.entries(variables).reduce((acc, [key, val]) => {
if (typeof val === 'object') {
acc[key] = redactSensitiveVariables(val)
return acc
}
if (
['email', 'emailaddress', 'email_address', 'emails'].includes(
key.toLocaleLowerCase()
)
) {
acc[key] = '[REDACTED]'
return acc
}
acc[key] = val
return acc
}, {})
}
module.exports = {
redactSensitiveVariables
}