Skip to content

[Dashboard] Fix: reject unsafe checkout redirects and isolate opener - #9075

Open
yinbowen-dc wants to merge 1 commit into
thirdweb-dev:mainfrom
yinbowen-dc:codex/fix-9061-payment-success-redirect
Open

yinbowen-dc wants to merge 1 commit into
thirdweb-dev:mainfrom
yinbowen-dc:codex/fix-9061-payment-success-redirect

Conversation

@yinbowen-dc

@yinbowen-dc yinbowen-dc commented Nov 19, 2026 •

Copy link
Copy Markdown

Payment-link success redirects now reject malformed/non-HTTP URLs and open allowed destinations without an opener reference.

Refs #9061 (the unsafe-scheme and reverse-tabnabbing portions).

  • Require an absolute HTTP(S) URL in the actual PayPageWidget success callback, consistent with the pay landing page's supported schemes.
  • Ignore invalid URLs without throwing after successful checkout.
  • Use _blank with noopener,noreferrer for allowed destinations.
  • Add 16 regressions invoking the real rendered component's success callback; the SDK widget, browser open, analytics, and application context hooks are isolated. No payment is executed.
  • Add the Dashboard Vitest task with dependent workspace builds. The common test setup overlaps [Dashboard] Fix: keep login tokens server-side and disable caching #9074; the runtime patches are independent and both branches are based on main.

Validation (Node 22.23.4):

  • Unmodified callback: 14 failed, 2 controls passed; fixed callback: 16 passed.
  • turbo run test --filter=thirdweb-dashboard: 6 tasks successful, including SDK build and 16 tests.
  • Dashboard tsc --noEmit, scoped ESLint/Biome, and git diff --check: passed.
  • Frozen-lockfile dependency installation: passed; lockfile changes are limited to the Dashboard Vitest dependency and its resolved peer snapshot.
  • Full-app build limitation: Next.js compilation and type validation pass, but static generation fails on /account/settings and /bridge with server-component digest 1169307521 in this local configuration. A complete production build and end-to-end checkout are not claimed.

Scope: HTTP(S) redirect destinations remain caller-provided, preserving the existing feature. This patch does not implement merchant-owned allowlists or claim that arbitrary HTTP(S) phishing destinations are prevented; that policy/backend change remains open in #9061. Consequently this uses Refs, not an automatic issue-closing directive.

AI assistance: Codex implemented and tested the patch. Maintainer review is still needed; no human review is claimed.

Summary by CodeRabbit

  • Bug Fixes
    • Checkout success redirects now open only valid HTTP or HTTPS destinations in a new tab with additional security protections. Invalid or unsupported destinations are ignored without interrupting checkout completion.
  • Tests
    • Added automated checks for redirect handling and checkout success reporting.

@yinbowen-dc
yinbowen-dc requested review from a team as code owners November 19, 2026 07:46
@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9d75af2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@yinbowen-dc is attempting to deploy a commit to the thirdweb Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the Dashboard Involves changes to the Dashboard. label Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The dashboard adds Vitest unit-test support. The checkout success handler now validates redirect URLs, opens accepted HTTP(S) destinations in a new tab with noopener,noreferrer, and has tests for accepted and rejected destinations.

Changes

Checkout redirect handling

Layer / File(s) Summary
Dashboard unit-test wiring
apps/dashboard/package.json, apps/dashboard/vitest.config.mts, turbo.json
The dashboard adds Vitest, test scripts, a Vitest configuration, and a Turbo test task.
Checkout success redirect validation
apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx, apps/dashboard/src/app/pay/components/client/PayPageWidget.client.test.ts
The success handler ignores malformed and non-HTTP(S) destinations. It opens accepted URLs with noopener,noreferrer. Tests check redirect behavior and verify that success analytics runs once.

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

Change: Bug fix

Possibly related issues

  • thirdweb-dev/js#9061: The changes implement the issue’s HTTP(S) URL check and noopener,noreferrer behavior. The issue notes that its allowlist and policy changes remain open, so it is only partly addressed.

Suggested labels: Dashboard

Suggested reviewers: gregfromstl, 0xfirekeeper, jnsdls

Merge Risk: Minimal · up to 9d75a

Checkout success redirects now ignore malformed and non-HTTP(S) URLs and open accepted destinations in an isolated tab. Arbitrary HTTP(S) destinations are still allowed by design. No remaining merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes the main change: payment-link checkout success redirects now reject unsafe URLs and open accepted destinations with noopener,noreferrer. It follows the repository's [Dashboard] Fix…
Description check Passed The description follows the repository template in substance. It states the change, links the related issue (Refs #9061, with the reason it does not auto-close), and gives detailed testing steps and r…
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 describes the main change: payment-link checkout success redirects now reject unsafe URLs and open accepted destinations with noopener,noreferrer. It follows the repository's [Dashboard] Fix: format and matches the PR objectives and the changed PayPageWidget callback.

Full details: Description check

Explanation

The description follows the repository template in substance. It states the change, links the related issue (Refs #9061, with the reason it does not auto-close), and gives detailed testing steps and results under validation. The template's 'Notes for the reviewer' and 'How to test' content is covered, though the headings are not used and no branch-name or Linear issue tag line is given.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • 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: Advanced
  • Run ID: 3c7fb2c0-640e-4280-b0f9-4a8e23241330
Commits

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

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 5

  • apps/dashboard/package.json
  • apps/dashboard/src/app/pay/components/client/PayPageWidget.client.test.ts
  • apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx
  • apps/dashboard/vitest.config.mts
  • turbo.json

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

This branch has not been deployed

No deployments
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant