Upgrade @arki/log 0.2.0 to 0.3.0
For @arki/[email protected] · source docs/upgrades/0.2.0-to-0.3.0.md
Nobody has to act: 0.3.0 only adds a processor. Apps that load secrets from env files should adopt it.
What changed
maskSecrets(values)processor: replaces every occurrence of a known secret value (8+ characters) in the template, string fields at any depth, the serialised error and the body. Pairs withsecretValuesfrom@arki/env/node:processors: [maskSecrets(secretValues)]. Also exportsMIN_SECRET_LENGTH.
Public API changes
- Added
maskSecrets(values: () => readonly string[], options?: { censor?: string }): Processor. - Added
MIN_SECRET_LENGTH(8): shorter values are never masked, so common words are not censored. - No existing export changed.
Steps
-
Optional: mask loaded secrets in every log record.
Before:
configure({ sinks, processors: [redact(['password'])] });After:
import { secretValues } from '@arki/env/node'; import { maskSecrets } from '@arki/log'; configure({ sinks, processors: [redact(['password']), maskSecrets(secretValues)] });
Verify
bun -e "import { maskSecrets, MIN_SECRET_LENGTH } from '@arki/log'; console.log(typeof maskSecrets, MIN_SECRET_LENGTH)"It prints function 8.