Group
  • Security

    Fix open redirects in my app

    Audits every redirect that takes a URL from user input and restricts them to safe relative paths.

    • Improve quality
    • Debug & fix
    • Beginner
    • General

Free Prompt

Find and fix open redirect vulnerabilities in my app. Look for every redirect where the destination comes from user input: query parameters like ?next=, ?redirect=, ?returnTo=, or ?url=, especially after login, logout, and email verification links. For each one, restrict the destination to a relative path within my app (starting with / but not //) or to an explicit whitelist of allowed external URLs. Reject or ignore anything else by falling back to a safe default page. Watch for the sneaky variants: //evil.com parses as protocol-relative and goes off-site, and backslash tricks like /\evil.com can fool naive checks. Do not remove the redirect-after-login feature; users expect to land back where they were. Just validate the destination. Do not change any URL structure. List each redirect point, what it accepted before, and the validation you added. Give me test cases: a normal internal path that still works, an absolute external URL that gets refused, and the protocol-relative and backslash variants.

What This Does / How This Helps

Finds every redirect that trusts a user-supplied destination and clamps it to paths inside your app. Open redirects are phishing fuel. An attacker sends a link to yourapp.com/login?next=evil-clone.com, the victim sees your real domain, logs in, and gets bounced to a lookalike site that steals their credentials. Your domain's trust does the attacker's work. The prompt covers the bypasses too, like protocol-relative URLs that slip past naive starts-with checks, and gives you the test cases to prove each variant is handled.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts