#0904
Your application accepts a redirect URL from a query parameter and uses it in a Location header or href attribute after login.
The current sanitiseRedirectUrl function only blocks the exact string javascript:, so an attacker can bypass it with JAVASCRIPT:, java\tscript:, or data:.
A successful bypass lets an attacker craft a login link that executes JavaScript in the victim's browser when the redirect fires.
javascript: URL injection and open redirects are frequently chained in phishing attacks. A single missing case-normalisation step can render an entire allowlist bypass trivial.
sanitiseRedirectUrl to strip leading whitespace and control characters, then normalise the URL to lowercase before checking its protocol.javascript: or data:, returning "/" as a safe fallback.http://, https://, and relative (/) URLs must be returned unchanged.sanitiseRedirectUrl('JAVASCRIPT:alert(1)')// returns 'JAVASCRIPT:alert(1)' — not blocked!
sanitiseRedirectUrl('JAVASCRIPT:alert(1)')// returns '/'
"/" for any blocked URL.