DefaultRedactor
The default Redactor applied at capture time.
Redacts:
Header values to
[REDACTED]forAuthorization,Proxy-Authorization,Cookie,Set-Cookie, and any header whose NAME contains a sensitive token (e.g.X-Api-Key,X-Auth-Token), so custom auth headers are covered too. Well-known PUBLIC headers whose names merely resemble a secret (Access-Control-Allow-Credentials,WWW-Authenticate,Proxy-Authenticate) are exempt — they carry CORS metadata / server challenges, not credentials.URL query parameters, JSON object fields, and form fields whose name contains a sensitive token (
token,key,secret,password,passwd,pwd,auth,access_token,refresh_token,api_key,apikey,client_secret,session,credential,bearer,signature,sig). A name is split into words, at separators and camelCase humps, and the token must be in a word that isn't an ordinary one that happens to contain it, in any of its forms:author_name,authors,design,assignments, andkeywordsare kept, whileauthorization,accessToken, andpresigned_urlare masked. Names that hold no secret although they have a sensitive word are kept too, in any spelling:Idempotency-Key,public_key, andvapid_key; a token count or limit, wheretokenortokenssits next to a word such asmax,total,count,remaining,prompt, orinput, as inprompt_tokens,max_tokens,totalTokenCount, andx-ratelimit-remaining-tokens; a key that names a column, such asprimary_keyandpartitionKey; and a yes-or-no flag about a secret, whose first word isis,has,can, orshould, whose last word isexist,exists,enabled,disabled,enforced,required, orprotected, or that asks for one, as inis_password_protected,passwordEnforced, andask_for_password. This name check is SensitiveKeys.isSensitive, which other tabs use too.The parts of a
multipart/form-databody: a part whose field name is sensitive is masked whole, and any other part is redacted as a body of its own type, so a JSON part is redacted as JSON. A part's own headers are masked like a request's.Sensitive values in any other captured text body — SSE, XML, plain text, and JSON that does not parse as a single object/array (NDJSON / concatenated frames) — via a framing-agnostic, key-name-based fallback. As on the structured path, a sensitive key's whole value is masked, whether a string, a number, or a nested object or array, and so is everything inside a sensitive XML element.
A captured body can end partway through a value, when it's cut off at the capture cap or captured while a stream is still arriving. A sensitive value cut off that way is masked through to the end of the body.
What it masks is never stored. Every rule above keys off a NAME, though, so this is a reduction of exposure and not a guarantee: a credential that no sensitive name points at is stored as it arrived. Known gaps are listed under "Capture-time redaction" in SECURITY.md; consumers whose traffic needs more pass their own Redactor to NetworkDebugTab.create(...).
Functions
Returns body with sensitive values redacted. EVERY captured text body is covered (the capture layer only retains text-like bodies): the structured JSON/form paths are the precise fast paths, and anything else — including JSON that fails to parse (NDJSON / concatenated frames), SSE (text/event-stream), XML, and text/plain — falls through to the key-name-based redactTextually. Every path keys off a NAME, so a value no sensitive name points at is returned as it arrived; see the class KDoc.
Returns the header value, or [REDACTED] when name is a well-known sensitive header OR its name matches a sensitive key fragment — so custom auth headers (X-Api-Key, X-Auth-Token, …) are masked, not just the standard Authorization / Cookie set. Well-known public headers that merely resemble a secret by name (NON_SENSITIVE_HEADERS) pass through.