Skip to content

Escape html in mcp oauth flow - #2928

Merged
dwwoelfel merged 2 commits into
mainfrom
fix/mcp-stored-xss
Sep 26, 2026
Merged

dwwoelfel merged 2 commits into
mainfrom
fix/mcp-stored-xss

Conversation

@dwwoelfel

Copy link
Copy Markdown
Contributor

Escape html in the oauth flow for the mcp server.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9651abf0-b51b-441d-b7a6-affc3bec3d6c

📥 Commits

Reviewing files that changed from the base of the PR and between 7e60003 and 7480a48.

📒 Files selected for processing (1)
  • client/packages/mcp/src/oauth-service-provider.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/packages/mcp/src/oauth-service-provider.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change adds an HTML escaping helper and applies it to values inserted into the OAuth authorization page. The page renderer is exported, and its response adds X-Frame-Options and X-Content-Type-Options headers.

Changes

OAuth authorization page

Layer / File(s) Summary
HTML escaping helper
client/packages/mcp/src/escape-html.ts
Adds escapeHtml, which replaces five HTML-special characters with entities and returns unchanged input when none are present.
OAuth page rendering
client/packages/mcp/src/oauth-service-provider.ts
Exports oauthStartHtml and escapes the client name, encoded redirect URI, and client token before inserting them into the page. The response adds X-Frame-Options: DENY and X-Content-Type-Options: nosniff.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7480a

The OAuth authorization page’s inspected values are escaped for where they appear. No issue identified here needs resolution before merge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 7e600

The change appears to strengthen a single OAuth authorization page without creating a new route or changing token validation. No introduced security issue was identified, though broader security coverage is incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The effective change is concentrated on the MCP OAuth consent page shown to users with an existing cookie-backed flow. Matching names in web-client files do not establish additional callers of this helper.

Trust Boundaries and Controls

  • observed — Client metadata and redirect information are escaped at the HTML output boundary. The hidden token is escaped for its attribute context, while the POST handler still checks it against persisted redirect state; missing or expired flows are rejected before rendering.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: escaping HTML in the MCP OAuth flow.
Description check ✅ Passed The description directly explains that the pull request escapes HTML in the MCP server OAuth flow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

View Vercel preview at instant-www-js-fix-mcp-stored-xss-jsv.vercel.app.

@nezaj nezaj 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.

Nice!

@dwwoelfel
dwwoelfel merged commit e541bc7 into main Sep 26, 2026
28 checks passed
@dwwoelfel
dwwoelfel deleted the fix/mcp-stored-xss branch September 26, 2026 03:45

This branch was successfully deployed

1 active deployment
Preview — 7480a488 Deployed Sep 26, 2026 by dwwoelfel via Deploy to vercel preview #23103
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