Skip to content

Remove early redaction of secrets, use reveal button for sensitive headers #3077

Done

Description

@cliffhall

Supersedes #3023 (reported by @mikecat) and #3076 (reported by @CloneOfAlex), which are closed as duplicates of this issue. Thanks also to @aniket-r2Dev2 for tracing the capture-time redaction on #3023.

For the PR: link #3023 and #3076 as closing references alongside this issue (Closes #<this>, closes #3023, closes #3076 plus addCloseIssueReferences for all three) so both reporters are credited in the release notes' Thanks section.

Problem

The Network tab is meant to mask secrets for display (••••••••) and show the real value when the user clicks Reveal. Two symptoms show it doesn't:

  1. Reveal reveals nothing (Network tab: Reveal doesn't reveal secrets, and credential headers aren't masked (incl. #3076) #3023). On an OAuth /token request or response, Reveal flips the label to "Secrets revealed", but the values only change from •••••••• to [REDACTED] / %5BREDACTED%5D.
  2. Credential headers show in plain text (Network tab records X-Auth-Token, Api-Key, X-Goog-Api-Key, Ocp-Apim-Subscription-Key, PRIVATE-TOKEN unredacted (CLI servers/show treats them as sensitive) #3076). X-Auth-Token, Api-Key, X-Goog-Api-Key, Ocp-Apim-Subscription-Key, PRIVATE-TOKEN, X-Secret and DPoP appear unmasked in the Network tab and its exports, while Authorization shows [REDACTED], which can't be revealed. The CLI's servers/show already treats any *auth* / *token* / *secret* / *api-key* name as sensitive.

How we got here

  1. Show OAuth auth response bodies in Network tab, with sensitive-field masking + reveal toggle #1386 / feat(network): show auth response bodies with masked secrets + reveal toggle (#1386) #1387 (May 31) added display-time masking: maskSecretsInBody (clients/web/src/utils/maskSecrets.ts) plus a Reveal toggle, on the stated premise that "the raw body is preserved by the caller and shown only when the user reveals it."
  2. core: redact sensitive headers in the fetch log #1561 (headers) and core: redact sensitive fields in fetch-log request/response bodies + URL query strings #1593 (bodies + URL query) (July 1, ported from reference PR feat(web/apps): spec-conformant Apps host + CLI/deep-link path for programmatic review #1510) moved redaction to capture time in createFetchTracker (core/mcp/fetchTracking.ts). The reason was that the recorded entry reaches the in-memory list, the logger and persisted session storage. Neither issue accounted for the Reveal toggle, so since then the "raw" body Reveal shows is already redacted.
  3. Headers never got the mask/reveal treatment. HeadersTable in NetworkEntry.tsx renders values verbatim. Only the six headers core's list named were redacted (and so unrevealable); every other credential header passed through in plain text.
  4. Five separate lists decide what a secret is, and they have drifted: the fetch tracker's header set and body-field set, --oauth-debug's SENSITIVE_FIELDS, the CLI's isSensitiveHeader, and the web mask's JSON/form keys.

Fix

Mask for display and reveal on request in the live view; redact wherever data leaves memory.

  • One list. A new core/mcp/sensitiveNames.ts is the single source used by every masker and redactor. It has two predicates: exact match for protocol field names (so token_endpoint / token_type stay readable) and fragment match for header names, the CLI's rule plus DPoP and Ocp-Apim-Subscription-Key, minus WWW-Authenticate, which is a challenge, not a credential.
  • Keep real values in the live fetch log. createFetchTracker stops redacting headers and bodies. It still redacts the URL query, since the URL shows in every collapsed row with no reveal control; still masks whsec_ webhook secrets (Events (#3026) phase 4: webhook subscription management #3031), which are found by value, not by name; and still withholds truncated JSON, which can't be masked.
  • Redact at the sinks with a new redactFetchRequestEntry: the InspectorClient fetch log line, Network export, and the TUI's request details, which have no reveal control.
  • Mask/reveal for headers in NetworkEntry, matching bodies.
  • Never offer Reveal over a value that is genuinely gone: a value already [REDACTED] is not counted as a maskable secret.
  • Carry the pre-redirect OAuth Network log in browser sessionStorage instead of the backend's disk (/api/storage → ~/.mcp-inspector/storage). The entries are needed only across the one full-page OAuth redirect, in the same tab. sessionStorage is scoped to the tab and origin, never leaves the browser, already holds the backend API token (a strictly stronger credential), and the entry is deleted as soon as it is restored. Today's disk copy is never deleted.

Activity

  1. added this to the v2.18.0 milestone on Nov 30, 2026
  2. added
    bug
    v2
    on Nov 30, 2026
  3. self-assigned this
    on Nov 30, 2026
  4. cliffhall commented on Nov 30, 2026

    @cliffhall
    MemberAuthor

    Priority: High (total 10), carried over from #3023's re-score with #3076 folded in.

    • Severity 4 — credential headers are shown in plain text in the UI and its exports, and Reveal claims to reveal values it can't
    • Urgency 3 — wanted this milestone (v2.18.0)
    • Bonuses: +1 bug label, +1 security-related (secret exposure), +1 milestone (v2.18.0)
  5. cliffhall commented on Nov 30, 2026

    @cliffhall
    MemberAuthor

    Shipped in #3078 (merged into v2/main as b1cad2e).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions