Skip to content

fix(e2e): fake EHR redirects only to the registered redirect URI - #74

Merged
ftaakash merged 1 commit into
mainfrom
claude/fix-codeql-smart-redirect-488d96
Oct 20, 2026
Merged

ftaakash merged 1 commit into
mainfrom
claude/fix-codeql-smart-redirect-488d96

Conversation

@ftaakash

Copy link
Copy Markdown
Owner

Fixes code-scanning alert #2 (Server-side URL redirect, frontend/e2e/smart-launch.spec.js:49).

The fake EHR in the SMART launch E2E spec answered /authorize with a 302 to the request's own redirect_uri, an open redirect driven by the request. It now behaves like a real authorization server:

  • client_id and redirect_uri must equal the registered CLIENT_ID and REDIRECT; otherwise 400 {error: 'invalid_request'}.
  • Location is built from new URL(REDIRECT) with code and state set through searchParams, so state is encoded too.

No other fake server in frontend/e2e/ or backend/tests/ redirects to a request value.

Test-only change; the test's behaviour is otherwise unchanged.

Checks

  • npx eslint .: clean
  • npx playwright test e2e/smart-launch.spec.js (local, Chrome): 2 passed

The SMART launch spec's fake authorization server answered /authorize with a
302 to whatever redirect_uri the request carried (CodeQL
js/server-side-unvalidated-url-redirection, alert #2). It now checks client_id
and redirect_uri against the registered values like a real authorization
server, answers 400 invalid_request on a mismatch, and builds Location from
the registered URI with code and state encoded through searchParams.
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
dischargeflow Ready Ready Preview Oct 20, 2026 4:01pm UTC

@ftaakash
ftaakash merged commit 9bc5da9 into main Oct 20, 2026
10 checks passed
@ftaakash
ftaakash deleted the claude/fix-codeql-smart-redirect-488d96 branch October 20, 2026 16:21

This branch was successfully deployed

1 active deployment
Preview — 07542251 Deployed Oct 20, 2026 by vercel[bot]
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.

1 participant