Skip to content

[Dashboard] pay link: validate redirectUri; [Portal] MCP docs: send the secret key in a header - #9080

Merged
0xFirekeeper merged 2 commits into
mainfrom
pay-redirect-uri-check
Nov 23, 2026
Merged

0xFirekeeper merged 2 commits into
mainfrom
pay-redirect-uri-check

Conversation

@0xFirekeeper

@0xFirekeeper 0xFirekeeper commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Dashboard

The payment-link page passed the redirectUri query parameter to the widget without the check the /pay landing route already applies to successUrl. It now goes through the same validation (http or https with a hostname; anything else is dropped), the widget re-checks the protocol before opening, and the new tab is opened with noopener,noreferrer.

A valid http(s) redirect still opens in a new tab after a successful payment, as before.

Portal

The MCP pages documented only https://api.thirdweb.com/mcp?secretKey=.... The server also reads the key from the x-secret-key header, and a key in a URL ends up in logs and config files. The examples now use the header for clients that support custom headers (Claude Code, Cursor, VS Code, Windsurf, LangChain); the query-parameter form stays as the fallback for clients that cannot send headers.

Checks

biome check, eslint and tsc --noEmit on the dashboard; both MDX pages compile.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Payment success redirects now accept only valid HTTP or HTTPS URLs. Unsupported protocols and invalid redirect values are ignored.
  • Documentation
    • Updated setup guidance and examples to send project secret keys in the x-secret-key header. A query-parameter option remains documented for clients that cannot set custom headers, with a note that URLs may be logged or stored.

0xFirekeeper and others added 2 commits November 23, 2026 22:08
The /pay/{id} page passed the redirectUri query parameter straight to
window.open after a completed payment, so a javascript: URL ran in the
thirdweb.com origin and any page opened got window.opener.

- validate redirectUri with the same http/https + hostname check the
  /pay landing route already uses for successUrl (moved to a shared
  module); anything else, or a repeated parameter, is dropped
- re-check the protocol in the widget and open with noopener,noreferrer

Honest http(s) redirect URLs still open in a new tab after success.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The MCP examples only showed https://api.thirdweb.com/mcp?secretKey=...,
which puts the project secret key in URLs, logs and config files. The
server already reads the x-secret-key header first.

- remote endpoint, LangChain (TS/Python), Cursor (mcp.json + install
  link), Windsurf, VS Code (mcp.json + install link) and Claude Code
  now pass the key in the x-secret-key header
- the query parameter stays documented as a fallback for clients that
  cannot send headers
- VS Code example uses the documented .vscode/mcp.json "servers" shape;
  its install link previously carried an unused "secret" field

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@0xFirekeeper
0xFirekeeper requested review from a team as code owners November 23, 2026 15:26
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs-v2 Ready Ready Preview Nov 23, 2026 3:36pm UTC
thirdweb-www Ready Ready Preview Nov 23, 2026 3:36pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
nebula Skipped Skipped Nov 23, 2026 3:36pm UTC
thirdweb_playground Skipped Skipped Nov 23, 2026 3:36pm UTC
wallet-ui Skipped Skipped Nov 23, 2026 3:36pm UTC

@vercel
vercel Bot temporarily deployed to Preview – nebula November 23, 2026 15:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – wallet-ui November 23, 2026 15:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – thirdweb_playground November 23, 2026 15:26 Inactive
@github-actions github-actions Bot added Dashboard Involves changes to the Dashboard. Portal Involves changes to the Portal (docs) codebase. labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Payment pages now validate redirect URLs with a shared HTTP(S) validator, and the payment widget restricts post-payment redirects. MCP documentation updates client configurations to send project secrets in the x-secret-key header and documents a query-parameter fallback.

Changes

Payment Redirect Validation

Layer / File(s) Summary
Shared URL validation and page wiring
apps/dashboard/src/app/pay/url-validation.ts, apps/dashboard/src/app/pay/page.tsx, apps/dashboard/src/app/pay/[id]/page.tsx
Payment pages use onlyUrl to accept normalized HTTP(S) URLs with a hostname. The /pay/[id] page ignores array values and forwards only accepted string values.
Post-payment redirect handling
apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx
The widget opens only HTTP(S) redirects in a new tab with noopener,noreferrer.

MCP Secret Header Documentation

Layer / File(s) Summary
Endpoint and secret-key guidance
apps/portal/src/app/ai/mcp/page.mdx, apps/portal/src/app/x402/agents/page.mdx
The documentation recommends the x-secret-key header, describes a query-parameter fallback for clients that cannot set headers, and notes that URLs may be logged or stored.
Client setup examples
apps/portal/src/app/ai/mcp/page.mdx, apps/portal/src/app/x402/agents/page.mdx
The client examples pass the project secret through the header. The Python examples also specify HTTP transport.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

  • thirdweb-dev/js#9061: The payment redirect changes check the URL scheme and use noopener,noreferrer, addressing the reported redirect behavior. The issue's stronger allowlist or per-link storage remedy is not shown in this change.

Possibly related PRs

  • thirdweb-dev/js#9075: This PR changes redirect validation in the same payment-link widget and overlaps with the redirect handling here.

Suggested labels: Dashboard

Suggested reviewers: gregfromstl, jnsdls, joaquim-verges

Merge Risk: Minimal · up to be6c0

The change tightens redirect URL validation on payment pages and updates MCP documentation to send the secret key in a header. No concrete defect was established. The only open question is whether the external MCP endpoint accepts the documented header and transport, which the repository cannot confirm.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names both changes in the PR: dashboard payment-link redirectUri validation and Portal MCP docs moving the secret key into a header. Both match the changeset. The title is long (94 character…
Description check Passed The description follows the repository template in substance. It explains the dashboard change (redirectUri validation, widget protocol re-check, noopener,noreferrer) and the portal change (x-secret-k…
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.
Full details: Title check

Explanation

The title names both changes in the PR: dashboard payment-link redirectUri validation and Portal MCP docs moving the secret key into a header. Both match the changeset. The title is long (94 characters, 15 words) and uses a semicolon to join two unrelated areas, so it is not concise, but it is related to the main changes and is specific enough to scan.

Full details: Description check

Explanation

The description follows the repository template in substance. It explains the dashboard change (redirectUri validation, widget protocol re-check, noopener,noreferrer) and the portal change (x-secret-key header, query-parameter fallback). It lists the checks run. It does not include a Linear/issue tag line, and the template's 'Notes for the reviewer' section is not filled in. The 'How to test' section lists checks run, not test steps. These are minor gaps, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 5c017315-27e6-495d-bbeb-05c6c53533d9
Commits

Reviewing files that changed from the base of the PR and between 940b374 and be6c0b1.

Files selected for processing: 6

  • apps/dashboard/src/app/pay/[id]/page.tsx
  • apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx
  • apps/dashboard/src/app/pay/page.tsx
  • apps/dashboard/src/app/pay/url-validation.ts
  • apps/portal/src/app/ai/mcp/page.mdx
  • apps/portal/src/app/x402/agents/page.mdx

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 105.66 KB (0%)
@thirdweb-dev/nexus (cjs) 319.47 KB (0%)

@0xFirekeeper
0xFirekeeper merged commit 0619d88 into main Nov 23, 2026
21 of 22 checks passed
@0xFirekeeper
0xFirekeeper deleted the pay-redirect-uri-check branch November 23, 2026 15:37

This branch was successfully deployed

2 active and 3 inactive deployments
Preview – thirdweb-www — be6c0b1a Deployed Nov 23, 2026 by vercel[bot]
Preview – docs-v2 — be6c0b1a Deployed Nov 23, 2026 by vercel[bot]
Preview – nebula — be6c0b1a Deployed Nov 23, 2026 by vercel[bot]
Preview – wallet-ui — be6c0b1a Deployed Nov 23, 2026 by vercel[bot]
Preview – thirdweb_playground — be6c0b1a Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard. Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant