mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-27 07:16:40 +00:00
verify redirects are safe before redirecting
This commit is contained in:
@@ -481,11 +481,7 @@ export default function ResourceAuthPortal(props: ResourceAuthPortalProps) {
|
||||
className={`${numMethods <= 1 ? "mt-0" : ""}`}
|
||||
>
|
||||
<LoginForm
|
||||
redirect={
|
||||
typeof window !== "undefined"
|
||||
? window.location.href
|
||||
: ""
|
||||
}
|
||||
redirect={`/auth/resource/${props.resource.id}`}
|
||||
onLogin={async () =>
|
||||
await handleSSOAuth()
|
||||
}
|
||||
|
||||
@@ -55,7 +55,17 @@ export default async function ResourceAuthPage(props: {
|
||||
);
|
||||
}
|
||||
|
||||
const redirectUrl = searchParams.redirect || authInfo.url;
|
||||
let redirectUrl = authInfo.url;
|
||||
// if (searchParams.redirect) {
|
||||
// try {
|
||||
// const serverResourceHost = new URL(authInfo.url).host;
|
||||
// const redirectHost = new URL(searchParams.redirect).host;
|
||||
//
|
||||
// if (serverResourceHost === redirectHost) {
|
||||
// redirectUrl = searchParams.redirect;
|
||||
// }
|
||||
// } catch (e) {}
|
||||
// }
|
||||
|
||||
const hasAuth =
|
||||
authInfo.password ||
|
||||
|
||||
Reference in New Issue
Block a user