Open redirects: what they are and how to fix them
An open redirect is a link on your domain that forwards visitors to any address supplied in the URL, such as a next or returnTo parameter. Accept only relative paths on your own site or a short allowlist of destinations.
Check your app free, first fix freeSign-in flows often add a returnTo parameter so users land where they started. If the server redirects to whatever value it receives, an attacker can send a trusted-looking link to your domain that ends on a phishing page. Validate the destination on the server and test with an external URL. ProofForge does not run a dedicated check for this.
How it shows up in generated apps
Look for redirect parameters: next, redirect, returnTo, callbackUrl, continue, url. A typical pattern is a sign-in page that reads one of these and calls redirect(value) or window.location = value after success. If value can be https://evil.example, your domain becomes a launching point for phishing, and in some OAuth setups a token can end up at the wrong place.
The redirect itself does not leak your database. Its harm is borrowed trust, and occasionally a step in a larger attack chain. That is why fixing it is cheap and worth doing.
Test your own app
Run this only on an app you own. Replace the parameter with the one your app uses:
https://your-app.example/login?next=https://example.comSign in through that link. If you end up on example.com, the redirect is open. Also try //example.com and a URL with backslashes, because naive checks for "starts with /" often miss them.
Validate on the server
export function safeRedirect(target: string | null, fallback = "/") {
if (!target) return fallback;
// Only same-site paths. Reject protocol-relative and backslash tricks.
if (!target.startsWith("/") || target.startsWith("//") || target.includes("\\")) {
return fallback;
}
try {
const url = new URL(target, "https://your-app.example");
return url.origin === "https://your-app.example" ? url.pathname + url.search : fallback;
} catch {
return fallback;
}
}If you genuinely need external destinations, keep a fixed allowlist of hostnames and compare the parsed hostname exactly. Auth providers usually have an allowed redirect URL list; keep it to your real domains and remove old previews.
Verify
Repeat the test with the external, protocol-relative and backslash variants. Each should land on your fallback page. Confirm the normal return-to-page behaviour still works for real internal paths.
What ProofForge does and does not check here
ProofForge does not currently perform a dedicated open-redirect check. This is a manual guide, not a claim of detection: a clean ProofForge report says nothing either way about this issue. The public scan covers the areas listed on the methodology page, such as exposed files, bundle secrets, security headers, CORS and selected database access. Use the steps above on an app you own or have permission to test, and keep your own notes as evidence.
Turn the check into a release decision
Keep a small record of the production URL, the time you checked it, the exact finding and the action you took. A local preview and a deployed application can have different environment variables, response headers and database projects. After a repair, deploy the intended version and check the public address again. Do not assume that changing a repository file changed the live system.
Read coverage as carefully as the score. A timed-out asset, an ambiguous backend configuration or a request that could not safely establish access should remain unknown. It should not disappear from your release notes merely because there is no red finding. If a check was not completed, decide who will review it and what additional evidence is needed.
ProofForge's free report includes the first fix. The $9 Fix Report unlocks all findings' available repair guidance and builder prompts, with a PDF and private report link. Fix + Guard costs $29 once and adds builder rules, on-demand deploy-hook scans for 30 days and four weekly rechecks you start yourself. These are different deliverables, not different promises that an application is completely secure.
Keep private report URLs out of public issues and commits. If you need shareable evidence, use the owner-verification and publication flow for an eligible receipt. A signature protects the recorded assessment against undetected changes; it does not make the assessment exhaustive, prove a business outcome, or show that a later deployment still matches an earlier result.
Questions builders ask
Is an open redirect a serious vulnerability?
Is checking that the value starts with / enough?
Does ProofForge detect open redirects?
Related checks and fixes
Continue with a related guide
Sources
Scan your app free
See what your live app ships to every visitor, with the first fix free. A clean scan is not a full audit. Run it only on an app you own or have permission to test.
Scan your app free