Property-path redaction for traces.
A trace records real application state, which means it records whatever the user typed. Redaction happens at record time, not at export time: a value a rule matches is never written into the buffer at all, so a trace cannot leak a secret that a later export step forgot to strip.
Patterns are matched against the same dotted property paths the reactive
system already produces (see getPropertyPath in reactive/watcher.js), so
auth.token and cart.items.2.cardNumber are both addressable.
- Source:
Classes
Members
(static, constant) NO_REDACTION :Redactor
A redactor with no rules, shared by callers that have not configured any.
Type:
- Redactor
- Source:
(inner, constant) MIN_SCRUBBABLE_LENGTH :number
The shortest withheld value that is worth scrubbing out of source text.
Type:
- number
- Source:
(inner, constant) REMEMBER_MAX_DEPTH :number
How deep a withheld object is walked when collecting scrubbable strings.
Type:
- number
- Source:
(inner, constant) REMEMBER_MAX_STRINGS :number
How many strings are remembered from a single withheld value.
A rule that matches a large object should not turn the redactor into a copy of that object.
Type:
- number
- Source:
Methods
(inner) compilePattern(pattern) → {RegExp}
Compiles one redaction pattern into a matcher.
Supported syntax, deliberately small:
auth.token— that exact path.auth.*— any single segment underauth.*.password—passwordunder any single segment.auth.**—authand everything beneath it, at any depth.
A pattern that matches a path also redacts everything nested below it: a
rule for auth.token must not be defeated by the value happening to be an
object. That also makes auth and auth.** equivalent, which is why **
needs no special handling beyond ending the pattern.
Parameters:
| Name | Type | Description |
|---|---|---|
pattern |
string | The pattern source. |
- Source:
Returns:
A matcher anchored to the whole path.
- Type
- RegExp
(inner) escapeSegment(segment) → {string}
Escapes the regular-expression metacharacters in a literal path segment.
Parameters:
| Name | Type | Description |
|---|---|---|
segment |
string | A literal segment. |
- Source:
Returns:
The escaped segment.
- Type
- string