Skip to content

fix(ui): mask flagged secrets server-side, skeleton Security tiles, fold /search into Tools - #1051

Merged
github-actions[bot] merged 5 commits into
mainfrom
fix/ux-security-routing
Aug 25, 2026
Merged

github-actions[bot] merged 5 commits into
mainfrom
fix/ux-security-routing

Conversation

@Dumbris

@Dumbris Dumbris commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Web UI UX audit (docs/qa/ux-audit-webui-2026-08.md) — the security-surfaces + routing-polish cluster: F13, F15, F20, F31, F33, plus the F36 item in this area.

F13 — the drawer printed the secret it just flagged (security)

A call flagged critical · aws_access_key rendered, a few hundred pixels under the red detection panel, "message": "AKIAIOSFODNN7EXAMPLE aws key here" in cleartext with a Copy button — and the internal _auth_auth_type: "admin" beside it.

The raw value was in the API response, so the fix is server-side: internal/httpapi/activity.go → maskActivityPayloads, applied to GET /api/v1/activity and GET /api/v1/activity/{id}, plus the other read paths a cross-model review turned up (see below).

  • Every value the detector recognises inside arguments, response and error_message is replaced with a recognisable preview — AKIAIOSFODNN7EXAMPLE → AKIA…****. Enough to know which credential to rotate, not enough to use. A private key goes whole, envelope and body: its pattern matches only the -----BEGIN …----- line, so masking the match alone would have replaced the label and served the key.
  • Masking runs on records the detector flagged (has_sensitive_data: true), so an unflagged payload costs nothing.
  • Internal _auth_* arguments are stripped from every browsing response — plumbing, not caller input.
  • New internal/security/mask.go: MaskValue, Detector.MaskText, MaskArguments, MaskJSON, StripInternalArgs. It honours the same per-category switches as detection. Two deliberate differences from the existing Redact: it also masks known example values (the drawer ends up in screenshots, and "it only looked like a secret" is not a judgement the rendering surface gets to make), and it ignores the enabled flag, so turning detection off later does not start serving the credentials in records flagged while it was on.

Redacting in the client was rejected: the raw value would still be on the wire and in the browser's network log.

Full values stay reachable through the one deliberate surface that already gates them: GET /api/v1/activity/export?include_bodies=true (mcpproxy activity export --include-bodies) — the compliance/incident-response path, not a browsing one. That export keeps _auth_* too: attributing a call to a user is the point of it. The drawer says where full values live, and badges both payload panels Masked. mcpproxy activity show reads the detail endpoint, so it is masked too. Documented in docs/features/sensitive-data-detection.md (which previously over-promised redaction that was not happening).

The other read paths (cross-model review)

Two rounds of opencode/gpt-sol review found the API boundary necessary but not sufficient. Every finding was reproduced against the code before fixing:

  • /events streamed the raw payload to every SSE subscriber — Web UI, tray, mcpproxy activity watch — and the frontend console.logged it straight into the DevTools console. Those events are emitted at completion time, before the async detector has a verdict, so there is no flag to gate on: the SSE writer masks unconditionally, and the payload logging is gone. A first attempt keyed on field names and still missed detection_text (the raw pre-encoding response), intent (agent-authored prose) and the response values that are any rather than string — the payload shape keeps growing, so the field list is now only the trigger and a qualifying event has every string in it masked. The shared event map is never edited in place, and the identifiers the UI joins on (request id, parent id, session ids, ULIDs) sit under the entropy threshold — pinned by a test, since a masked parent_id would silently break code-execution parent↔child linking.
  • error_message was unmasked. An upstream error commonly quotes the payload it choked on, so masking the response alone just moved the leak.
  • metadata was unmasked, and metadata.intent.reason is prose the calling agent wrote — an agent explaining "rotating AKIA…" put the value straight back into a field nothing masked.
  • /api/v1/tool-calls, /tool-calls/{id}, /servers/{id}/tool-calls are a separate store with no detection metadata and bypassed masking entirely; so did the replay endpoint's returned record. All mask unconditionally now.
  • Private-key blocks ended at the first -----END, so a payload quoting an EC key inside an RSA key left the outer key's remainder readable. A block now ends at its own footer, and block masking is gated on the match being a real -----BEGIN header so a custom pattern filed under private_key cannot eat trailing text.
  • The detection cap was acting as a disclosure budget. MaxDetectionsPerScan bounds what is worth reporting; reused as a replacement cap it meant the 51st secret in a payload was served raw, and the entropy sweep masked at most five strings (and examined only the first 1,000 candidates). The caps are gone from the mask path — it walks every candidate itself — and, since "a payload stuffed with secrets" is now the worst case rather than an impossible one, per-value ReplaceAll became a single strings.Replacer pass. A 64KB response of nothing but distinct tokens masks in ~12ms (test fails above 2s).
  • /search → /tools forwarded only a scalar q, dropping other query params and the hash.

Left as-is, deliberately: the sub-second window between a record being saved and the async detector flagging it (closing it means scanning synchronously on the dispatch path) — documented instead; and the server-edition activity handlers, whose activityFilter is wired nil today (the endpoints return empty), which carry a comment pointing at the masking helper for whoever wires them.

F15 — four zero tiles while loading

The stat row sat outside v-if="loading && !initialized", so overview = {} rendered Scanners Installed 0 · Total Scans 0 · Active Scans 0 · Findings 0 before the page had looked. The tiles now skeleton (titles kept, numerals withheld) until the first /security/overview response lands.

F20 — /search orphan

/search was a third search surface: routed but sidebar-less, marketing-styled, duplicating both the header box and the Tools page. Tools is the canonical one — it is in the sidebar, it lists what it searches, and it can act on the results — so:

  • /search redirects to /tools, carrying the whole query and hash across so old links keep their state. Search.vue deleted.
  • Tools honours ?q= on mount and on later route changes (a second header search is a query change, not a remount).
  • The header box targets Tools, and its Search button is no longer greyed out beside an empty box (it opens Tools unfiltered) — which also covers F32's complaint.
  • The server-edition user menu's "Search" entry becomes "Tools".

F31 — unexplained header jargon

Mode: Retrieve gains a tooltip and an aria-label. Label and explanation live together in frontend/src/utils/routingMode.ts so they cannot drift. (The per-card Manual trust badge the audit also named already carries a title from spec 088 — verified, left alone.)

F33 — deep links without /ui returned a raw Go 404

http://127.0.0.1:8080/activity answered 404 page not found in plain text. Known UI paths now 302 into the SPA (internal/server/ui_redirect.go), preserving the escaped path (an encoded / in a server name survives) and the query string (?apikey= is how a browser authenticates on a fresh profile). An allowlist on purpose: a blanket redirect would answer a mistyped API path with an HTML page. Unknown paths still 404.

F36 (this area)

Tools table descriptions carry a title, so the clipped half is readable without opening the tool.

Not attempted, and why: the collapsed sidebar's icon-only rows still rely on hover title. An instant tooltip there is not an S-effort tweak — the nav container is overflow-y-auto overflow-x-hidden, which clips any flyout to its right; fixing it properly means either persistent micro-labels or a portalled tooltip, and belongs with whoever owns the sidebar.

Verification

Unit — 676 frontend tests (4 new specs), vue-tsc clean; go test -race on internal/security, internal/httpapi, internal/server (plus -tags server on internal/serveredition); golangci-lint v2 (.github/.golangci.yml) 0 issues; both editions build.

Live, isolated instance (127.0.0.1:18450, scratch config + data dir, everything server over npx):

  • A real echo call carrying AKIAIOSFODNN7EXAMPLE, and a second with a non-example AKIA…/ghp_… pair:
    • GET /api/v1/activity → "message": "AKIA…**** aws key here", _auth_auth_type absent.
    • GET /api/v1/activity/{id} → same.
    • GET /api/v1/activity/export?include_bodies=true → full value, as designed.
    • Drawer in Chrome: zero matches for /AKIA[0-9A-Z]{16}/ and /ghp_[A-Za-z0-9]{20,}/ in the rendered page, 5 masked previews, both Masked badges, the explanation line, no _auth_ keys.
    • GET /events while the call ran: zero raw keys in the stream, masked previews in both the started and completed events, and the payload otherwise intact (server_name, tool_name, status, duration_ms, request_id, session_id, byte counts).
  • The committed Playwright sweep (./scripts/run-web-smoke.sh, MCPPROXY_FIXTURE_PATH set so nothing skips): 5/5 — servers list, server detail + security tab, tools page and its search, activity log, settings.
  • Security page with a 4s-delayed overview: 4 skeleton tiles, no numerals; after the response, 1 · 1 · 0 · 0 · Signatures 7.
  • /search?q=echo (no prefix) → 302 /ui/search?q=echo → /ui/tools?q=echo, search box prefilled, one matching row. /servers → 302 /ui/servers; /settings?apikey=x → 302 /ui/settings?apikey=x; /nope → still 404.
  • Mode: Retrieve tooltip reads its description; header Search button disabled === false with an empty box.

No API shape change, so no make swagger regeneration.

…old /search into Tools

Web UI UX audit (docs/qa/ux-audit-webui-2026-08.md), security + routing cluster.

F13 — the activity drawer printed the credential it had just flagged, in
cleartext, next to a Copy button. Masking now happens in the REST layer, before
the record leaves the process: GET /api/v1/activity and /activity/{id} replace
every detected value inside `arguments` and `response` with a recognisable
preview (`AKIA…****`) whenever the record carries a detection, and drop the
internal `_auth_*` arguments from every record. Redacting in the browser would
have left the raw value on the wire and in the network log, which is not a fix.
Full values stay reachable through the one deliberate surface that already
gates them: `activity export --include-bodies`. The drawer says so, and badges
both payload panels Masked.

F15 — the Security page's four stat tiles sat outside the loading guard, so a
cold start rendered "0 scanners · 0 scans · 0 findings" before the overview had
been fetched. A security page asserting zero findings before it has looked is
worse than one that admits it is still looking: the tiles now skeleton until
the first response lands.

F20 — `/search` was a third search surface, routed but sidebar-less,
duplicating both the header box and the Tools page. It redirects to Tools (the
canonical one) carrying `?q=` across; Tools honours the query on mount and on
later route changes; the header box targets it, and its Search button is no
longer greyed out next to an empty box.

F31 — the header's routing-mode badge explains itself: label and description
live together in utils/routingMode.ts.

F33 — a Web UI deep link without the `/ui` prefix returned Go's plain-text
"404 page not found". Known UI paths now 302 into the SPA, keeping the escaped
path and the query string (`?apikey=` survives). Unknown paths still 404 — an
allowlist, so a mistyped API path is not answered with an HTML page.

F36 (this area) — Tools table descriptions carry a title, so the clipped half
is readable without opening the tool.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1dfd9fb
Status: ✅  Deploy successful!
Preview URL: https://3954ddb1.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-ux-security-routing.mcpproxy-docs.pages.dev

View logs

Cross-model review (opencode/gpt-sol) of the F13 masking found the API
boundary was necessary but not sufficient. Each finding verified against the
code before fixing:

* `/events` streamed the call's raw arguments, response and error to every SSE
  subscriber (Web UI, tray, `activity watch`). Those events are emitted at
  completion time, BEFORE the asynchronous detector has a verdict, so there is
  no flag to gate on: the SSE writer masks unconditionally. Non-payload fields
  pass through untouched, and an event without payload fields is not copied.
  The store's `console.log(data)` of the same payloads — which printed the
  secret into the DevTools console — is gone with them.

* `error_message` was served unmasked. An upstream error commonly quotes the
  payload it choked on, so masking the response alone just moved the leak.

* `/api/v1/tool-calls`, `/tool-calls/{id}` and `/servers/{id}/tool-calls` are a
  separate store with no detection metadata; they bypassed masking entirely.
  They now mask unconditionally, arguments, response and error.

* Private-key masking replaced the `-----BEGIN …-----` line and left the key
  body. `maskKeyBlocks` takes the whole block, envelope included; an
  unterminated (truncated) block loses its remainder rather than serving a
  partial key.

* `MaxDetectionsPerScan` was reused as a replacement cap, making it a
  disclosure budget: the 51st secret in a payload was served raw, and the
  entropy sweep masked at most five strings. Masking is no longer capped — work
  is bounded by the fixed pattern set (each applied once over de-duplicated
  matches) and by the payload sizes the activity log already caps. The entropy
  sweep gets a work bound two orders of magnitude above what it reports.

* The masker was only installed when detection was enabled, so turning the
  feature off started serving the credentials in records flagged while it was
  on. It is installed unconditionally now, and `MaskText` no longer consults
  the `enabled` flag. Per-category switches are still honoured.

* `/search` → `/tools` forwarded only a scalar `q`, dropping every other query
  parameter and the hash.

Not changed, deliberately: `export?include_bodies=true` still resolves full
values AND `_auth_*`, because attributing a call to a user is the point of a
compliance export — the docs now say so instead of claiming `_auth_*` is
stripped everywhere. The sub-second window between a record being saved and the
async detector flagging it is also documented rather than closed; closing it
means scanning synchronously on the dispatch path.

The server-edition activity handlers serialize raw storage records, but their
filter is wired nil today (the endpoints return empty), so they are commented
rather than plumbed.
Removing the replacement cap made "a payload stuffed with secrets" the worst
case rather than an impossible one, and per-value strings.ReplaceAll re-scanned
the whole payload once per secret found — quadratic exactly where it now
matters. Collect the (value, preview) pairs per pattern and hand them to a
single strings.Replacer instead.

A 64KB response (the activity_max_response_size cap) of nothing but distinct
GitHub tokens masks in ~12ms; the new test fails above 2s.
Round 2 of the cross-model review; every finding reproduced before fixing.

* SSE masking was keyed on field NAMES and so missed `detection_text` (the raw
  pre-encoding response, spec 084), `intent` (prose the calling agent wrote),
  and the `response` values that are `any` rather than string on the
  internal-call and prompt paths. The payload shape keeps growing, and an
  allowlist leaks each new field until someone remembers to add it — so the
  field list is now only the TRIGGER, and a qualifying event has every string
  in it masked. The shared event map is still never edited in place.

* `POST /api/v1/tool-calls/{id}/replay` returned the new record straight from
  the controller, unmasked. A replay is a tool call like any other.

* `metadata` was serialised untouched, and `metadata.intent.reason` is
  agent-authored: an agent explaining "rotating AKIA…" put the value back in a
  field nothing masked. Flagged records now have their metadata swept too; the
  detection block is short identifiers no pattern matches, so it survives.

* `maskKeyBlocks` ended a block at the first `-----END` rather than at its own
  footer, so a payload quoting an EC key inside an RSA key left the outer key's
  remainder readable. It now looks for the matching `-----END <same type>-----`.
  Block masking is also gated on the match being a real `-----BEGIN` header, so
  a custom pattern filed under private_key can no longer eat the text after an
  ordinary match.

* The entropy sweep still carried Scan's find-limit (500 masks, and only 1000
  candidates examined) — a disclosure budget by another name. Masking now walks
  every candidate in the payload itself instead of reusing
  FindHighEntropyStrings.

The remaining round-2 finding, quadratic per-match ReplaceAll, was already
fixed in 78c8de3 (single strings.Replacer pass) — the review measured the
commit before it.
Whole-payload event masking is only safe if the ids the UI joins on survive
it: a masked parent_id would silently break code_execution parent-child
linking, and a masked session id would break session grouping. ULIDs, request
ids, MCP session ids, work-session ids and scan ids all sit under the entropy
threshold today — this pins that, so a future threshold or pattern change
fails here instead of in the Activity view.
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/ux-security-routing

Available Artifacts

  • archive-darwin-amd64 (29 MB)
  • archive-darwin-arm64 (26 MB)
  • archive-linux-amd64 (17 MB)
  • archive-linux-arm64 (15 MB)
  • archive-windows-amd64 (29 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (23 MB)
  • installer-dmg-darwin-arm64 (20 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 32845891985 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 75.98039% with 49 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/security/mask.go 80.00% 14 Missing and 11 partials ⚠️
internal/httpapi/server.go 53.65% 16 Missing and 3 partials ⚠️
internal/server/server.go 28.57% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved (Model B): Paperclip review verdicts = ACCEPT and qa-gate green at this head SHA. Arming auto-merge; GitHub merges when all required checks pass.

@github-actions
github-actions Bot merged commit 1ce385c into main Aug 25, 2026
49 of 50 checks passed
Dumbris added a commit that referenced this pull request Aug 26, 2026
The document read as an open P0-P3 backlog, but seven PRs merged on 2026-08-25
(#1044, #1048, #1049, #1051, #1052, #1053, #1054) closed it. Anyone opening this
file against current main was being handed 36 stale defects.

Added a status banner and a Resolution section that separates three things
honestly:

- Re-checked live on v0.61.0 against a running isolated core with real /mcp
  traffic: F1, F4, F5, F7, F8, F12, F13, F20, F24, F26, F33 confirmed fixed,
  each with the observed evidence rather than a PR reference.
- Still open: F6 is half fixed. Focus enters the Add Server dialog and submit is
  in a sticky footer, but Escape still does not close it - AddServerModal.vue has
  no key handler and JsonViewer.vue is the only component under components/ that
  handles Escape at all. F28's "key called optional" half is fixed; its
  three-surfaces state is not.
- Not re-checked: named explicitly rather than implied, so the next reader knows
  which closures rest on a PR body and which on an observation.

Five defects found on main while re-checking are recorded separately, since they
are not regressions of anything in the audit. The first is security-relevant:
quarantining a server through the config file leaves its tools in the search
index, so retrieve_tools still hands the agent their names and descriptions -
which is exactly what quarantine exists to prevent - before the call is refused.
Runtime.QuarantineServer purges the index; the reload path detects the same
transition (quarantined_changed: true) and does not.

Also corrects the record on #1053: its body names F1-F16, which is the tray
audit's numbering mis-pasted. #1055 is the tray PR; #1053 touches no Swift file.
Dumbris added a commit that referenced this pull request Aug 26, 2026
The document read as an open P0-P3 backlog, but eight PRs merged on 2026-08-25
(#1044, #1048, #1049, #1050, #1051, #1052, #1053, #1054) closed it. Anyone
opening this file against current main was being handed 36 stale defects.

Added a status banner and a Resolution section that separates four things:

- Re-checked live on v0.61.0 against a running isolated core with real /mcp
  traffic: F1, F4, F5, F6, F7, F8, F12, F13, F20, F24, F26, F33 confirmed fixed,
  each with the observed evidence rather than a PR reference.
- Not re-checked: named explicitly rather than implied, so the next reader knows
  which closures rest on a PR body and which on an observation. F28 is called
  out as partial - its "key called optional" half is fixed, its
  three-surfaces-at-once state is not.
- Corrections to the audit itself: F23 mis-diagnosed a per-request structural
  estimate as a stale aggregation, and F31's "Manual badge has no tooltip" half
  was wrong even at audit time (spec-088 trust-mode badge, already titled).
- Five defects found on main while re-checking, recorded separately since they
  are not regressions of anything in the audit. The first is security-relevant:
  quarantining a server through the config file leaves its tools in the search
  index, so retrieve_tools still hands the agent their names and descriptions -
  which is exactly what quarantine exists to prevent - before the call is
  refused. Runtime.QuarantineServer purges the index; the reload path detects
  the same transition (quarantined_changed: true) and does not.

F6 carries a methodology note. Re-checking it produced a false negative: Escape
driven through the browser-automation layer never reaches the page's document
keydown listener, so the dialog looked stuck open. Dispatched in-page it closes
at once, and #1050's useModalA11y is wired into all five <dialog :open> modals.
The sweep assertion this document proposes must dispatch in-page, or it tests
the automation layer instead of the app.

Also corrects the record on #1053: its body names F1-F16, which is the tray
audit's numbering mis-pasted. #1055 is the tray PR; #1053 touches no Swift file.
Dumbris added a commit that referenced this pull request Aug 26, 2026
* docs(qa): Web UI UX audit — ranked findings (ux-audit epic)

Heuristic + live-instance audit of every routed Web UI view in light/dark,
first-run and populated states, at 1440/820/390px. 36 findings ranked P0-P3
with view, evidence, heuristic violated, suggested fix and effort.

Audited against standard heuristics plus the house activity-UI rules
(grouping, failure-only status, intent reason, histogram/log parity).

* docs(qa): record what the Web UI audit's backlog actually resolved to

The document read as an open P0-P3 backlog, but eight PRs merged on 2026-08-25
(#1044, #1048, #1049, #1050, #1051, #1052, #1053, #1054) closed it. Anyone
opening this file against current main was being handed 36 stale defects.

Added a status banner and a Resolution section that separates four things:

- Re-checked live on v0.61.0 against a running isolated core with real /mcp
  traffic: F1, F4, F5, F6, F7, F8, F12, F13, F20, F24, F26, F33 confirmed fixed,
  each with the observed evidence rather than a PR reference.
- Not re-checked: named explicitly rather than implied, so the next reader knows
  which closures rest on a PR body and which on an observation. F28 is called
  out as partial - its "key called optional" half is fixed, its
  three-surfaces-at-once state is not.
- Corrections to the audit itself: F23 mis-diagnosed a per-request structural
  estimate as a stale aggregation, and F31's "Manual badge has no tooltip" half
  was wrong even at audit time (spec-088 trust-mode badge, already titled).
- Five defects found on main while re-checking, recorded separately since they
  are not regressions of anything in the audit. The first is security-relevant:
  quarantining a server through the config file leaves its tools in the search
  index, so retrieve_tools still hands the agent their names and descriptions -
  which is exactly what quarantine exists to prevent - before the call is
  refused. Runtime.QuarantineServer purges the index; the reload path detects
  the same transition (quarantined_changed: true) and does not.

F6 carries a methodology note. Re-checking it produced a false negative: Escape
driven through the browser-automation layer never reaches the page's document
keydown listener, so the dialog looked stuck open. Dispatched in-page it closes
at once, and #1050's useModalA11y is wired into all five <dialog :open> modals.
The sweep assertion this document proposes must dispatch in-page, or it tests
the automation layer instead of the app.

Also corrects the record on #1053: its body names F1-F16, which is the tray
audit's numbering mis-pasted. #1055 is the tray PR; #1053 touches no Swift file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants