mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Stop nefarious redirects during sign in (#16034)
This commit is contained in:
@@ -101,7 +101,19 @@ const onEmailPasswordSubmitted = async (form: EmailOrLdapLoginIdAndPassword) =>
|
||||
|
||||
const isRedirectSafe = () => {
|
||||
const redirect = getRedirectQueryParameter();
|
||||
return redirect.startsWith('/') || redirect.startsWith(window.location.origin);
|
||||
|
||||
// Allow local redirects
|
||||
if (redirect.startsWith('/')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// Only allow origin domain redirects
|
||||
const url = new URL(redirect);
|
||||
return url.origin === window.location.origin;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const getRedirectQueryParameter = () => {
|
||||
|
||||
Reference in New Issue
Block a user