Skip to content

Fix MCP +Add path bypassing secret redaction check#11297

Merged
vkodithala merged 2 commits into
warpdotdev:masterfrom
SagarSDagdu:sagar/mcp-add-secret-redaction-11265
Jun 4, 2026
Merged

Fix MCP +Add path bypassing secret redaction check#11297
vkodithala merged 2 commits into
warpdotdev:masterfrom
SagarSDagdu:sagar/mcp-add-secret-redaction-11265

Conversation

@SagarSDagdu
Copy link
Copy Markdown
Contributor

@SagarSDagdu SagarSDagdu commented May 19, 2026

Description

The "+ Add" (new MCP server) save path in app/src/settings_view/mcp_servers/edit_page.rs was calling ParsedTemplatableMCPServerResult::from_user_json directly and skipping the detect_secrets_in_templatable_mcp_server check that the edit-existing path runs via parse_templatable_json.

Net effect today: secrets pasted into a freshly added MCP server config are not blocked locally — the cloud-side sync_queue reject is the only guard, and the user sees a generic Failed to create mcp server toast instead of the actionable This MCP server contains secrets. Visit Settings > Privacy ... toast.

This PR reuses the existing per-server helper after parsing so both save paths get the same local guard.

Linked Issue

Fixes #11265.

  • The linked issue is labeled ready-to-implement.

Screenshots / Videos

Video showing error toast after the fix:

Screen.Recording.2026-05-19.at.9.21.42.PM.mov

Testing

Manual repro per #11265:

  1. Settings → Privacy → confirm Secret redaction is ON and the default recommended regexes are loaded (click "Add all recommended" if the list is empty — see SECRETS_REGEX silently empty at startup despite persisted custom_secret_regex_list — local MCP-save redaction check never fires #11262)
  2. Settings → MCP Servers → + Add
  3. Paste:
    {
      "demo-new-server-bypass": {
        "command": "/usr/bin/true",
        "args": ["--api-key=sk-FAKE0000000000FAKEdemoWARP8761"]
      }
    }
  4. Click Save → expect the actionable redaction toast, save blocked.

No automated test added; the secret-detection helper is already exercised via the edit-existing path and the change is a 12-line reuse of that helper. Happy to add an integration test on request.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

The new-server save branch was calling `from_user_json` directly,
skipping the `detect_secrets_in_templatable_mcp_server` check that
the edit-existing branch runs via `parse_templatable_json`. Result:
secrets in a freshly added MCP server config were never blocked
locally, and the user saw a generic "Failed to create mcp server"
toast instead of the actionable redaction toast.

Reuse the existing per-server helper after parsing so both save
paths get the same local guard.

Fixes warpdotdev#11265.
@cla-bot cla-bot Bot added the cla-signed label May 19, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 19, 2026
@SagarSDagdu SagarSDagdu marked this pull request as ready for review May 19, 2026 15:36
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 19, 2026

@SagarSDagdu

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 19, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR updates the new MCP server save path to run the existing templatable MCP server secret detection before creating templates, matching the edit-existing path.

Concerns

  • The change is user-facing because it alters the MCP Servers + Add save flow and expected error toast, but the PR does not include screenshots or a screen recording demonstrating the actionable secret-redaction toast end to end. For this user-facing change, please include screenshots or a screen recording demonstrating it working end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@SagarSDagdu
Copy link
Copy Markdown
Contributor Author

/oz-review I added video of the fix.

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 19, 2026

@SagarSDagdu

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @lucieleblanc.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed their stale review May 19, 2026 15:58

Oz no longer requests changes for this pull request after the latest automated review.

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds the missing local secret-redaction guard to the new MCP server +Add save path before templatable MCP servers are created or installed.

Concerns

  • No blocking correctness, security, or spec-alignment concerns found in the changed hunk.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot requested a review from lucieleblanc May 19, 2026 15:58
@lucieleblanc lucieleblanc requested review from peicodes and removed request for lucieleblanc May 20, 2026 16:02
@SagarSDagdu
Copy link
Copy Markdown
Contributor Author

@peicodes can you take a look at this? A very small but important change in the MCP addition.

@vkodithala vkodithala requested review from vkodithala and removed request for peicodes May 29, 2026 14:24
@vkodithala
Copy link
Copy Markdown
Contributor

Hey @SagarSDagdu, I'm taking over here. Will take a look later today!

Copy link
Copy Markdown
Contributor

@vkodithala vkodithala left a comment

Choose a reason for hiding this comment

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

This is a great, well-scoped PR. Great job!

Added a small comment that's non-blocking. I like that you didn't make an extra test here. Approved, will merge once CI passes.

Comment thread app/src/settings_view/mcp_servers/edit_page.rs Outdated
Address review nit: replace the manual `for ... if .is_err() return`
with `try_for_each` over the parsed servers.
@vkodithala vkodithala enabled auto-merge (squash) June 4, 2026 19:54
@vkodithala vkodithala merged commit 51c380c into warpdotdev:master Jun 4, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP server save: '+ Add' (new server) path bypasses redaction predicate entirely

2 participants