TelescopeRedaction class final
Masks credentials in HTTP records before TelescopeStore.recordHttp buffers them.
The HTTP ring buffer is served verbatim to AI agents over
ext.telescope.requests and MCP, so a bearer header or a login body
stored as captured leaks the credential into an agent transcript. The
model mirrors Laravel Telescope: three name lists (request headers,
request parameters, response parameters), matched case-insensitively,
extended through the hide* methods (additions merge with the defaults,
they never replace them), and every matching value replaced with mask.
The store only understands JSON and form-encoded bodies. An adapter that holds a body as
structured data (a Dart Map whose toString() is not JSON) must run it
through redactParameters before stringifying it.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
Lowercased request header names whose values are masked.
no setter
-
Lowercased request body keys whose values are masked.
no setter
-
Lowercased response body keys whose values are masked.
no setter
- redactor ↔ String Function(String)?
-
The host's text redactor, or null while none is registered.
getter/setter pair
Static Methods
-
hideRequestHeaders(
Iterable< String> names) → void - Hide the given request headers in addition to the defaults.
-
hideRequestParameters(
Iterable< String> names) → void - Hide the given request body keys in addition to the defaults.
-
hideResponseParameters(
Iterable< String> names) → void - Hide the given response body keys in addition to the defaults.
-
redactBody(
String? body, Set< String> keys) → String? -
Return
bodywith the value under every key inkeysmasked, when it parses as a JSON object or array, or reads as a form-encoded body (key=value&key=value, an OAuth token call or a form login). -
redactEventRecord(
EventRecord record) → EventRecord? -
Return
recordwith a JSON-safe payload, and with every text field run through the redactor andredactedset when one is registered. -
redactExceptionRecord(
ExceptionRecord record) → ExceptionRecord? -
Return
recordwith every text field run through the redactor andredactedset, orrecorditself when none is registered. Returns null, the record dropped, when the redactor throws. -
redactHttpRecord(
HttpRequestRecord record) → HttpRequestRecord? -
Return
recordwith its hidden request headers masked and the hidden keys of a JSON or form-encoded request or response body masked, then, when a redactor is registered, every text field run through it. -
redactLogRecord(
LogRecordEntry record) → LogRecordEntry? -
Return
recordwith every text field run through the redactor andredactedset, orrecorditself when none is registered. Returns null, the record dropped, when the redactor throws. -
redactParameters(
Object? data, Set< String> keys) → Object? -
Return a copy of
datawith the value under every key inkeysreplaced by mask, at any depth of nested Maps and Lists. -
resetForTesting(
) → void - Restore the three lists to their defaults and unregister the redactor.