Optional keys?: readonly (string | RegExp)[]Property names never read from the caught object. A string matches exactly.
Optional paths?: readonly (string | RegExp)[]JSONPaths never read, e.g. "$.cause.config.headers". A string matches exactly.
Optional patterns?: readonly RegExp[]Applied with String.prototype.replace to every string the report emits.
Optional replacement?: stringWhat an excluded value and a pattern match become. Defaults to CORJ_REDACTED_MARKER.
Optional transform?: CorjRedactTransform | nullRuns after the above on every value the report emits.
const redact: CorjRedactPolicyInput = {
keys: ['password', /^authorization$/i],
paths: ['$.cause.config.headers'],
patterns: [/sk-live-[A-Za-z0-9]+/g], // the g flag is required
transform: (value, { sourceProperty }) => (sourceProperty === 'url' ? '[url]' : value),
};
A redaction policy as it is passed in; every part is optional.
keysandpathsskip reads, so an excluded getter never runs;patternsandtransformrewrite text wherever the report emits it. To remove a secret's text frommessage,stackandas_stringalike, usepatterns.