diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/ory/callback.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/ory/callback.ts index 214d782040..64fe2dd61a 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/ory/callback.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/ory/callback.ts @@ -62,7 +62,9 @@ export default async function GET(req: NextRequest): Promise { }; const expires = token.exp == null ? undefined : new Date(token.exp * 1000); // TODO: validate allowlist of domains to prevent open redirects - const res = redirectLocation ? FernNextResponse.redirect(req, redirectLocation.toString()) : NextResponse.next(); + const res = redirectLocation + ? FernNextResponse.redirect(req, redirectLocation.toString()) + : NextResponse.next(); res.cookies.set( COOKIE_FERN_TOKEN, await signFernJWT(fernUser), diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/webflow/callback.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/webflow/callback.ts index e5d8c39d52..64da3c7fc5 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/webflow/callback.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/oauth/webflow/callback.ts @@ -57,7 +57,9 @@ export default async function GET(req: NextRequest): Promise { code, }); - const res = redirectLocation ? FernNextResponse.redirect(req, redirectLocation.toString()) : NextResponse.next(); + const res = redirectLocation + ? FernNextResponse.redirect(req, redirectLocation.toString()) + : NextResponse.next(); res.cookies.set("access_token", accessToken, withSecureCookie(withDefaultProtocol(host))); return res; } catch (error) { diff --git a/packages/ui/docs-bundle/src/server/FernNextResponse.ts b/packages/ui/docs-bundle/src/server/FernNextResponse.ts index 23de18f3b7..b9df816ed0 100644 --- a/packages/ui/docs-bundle/src/server/FernNextResponse.ts +++ b/packages/ui/docs-bundle/src/server/FernNextResponse.ts @@ -12,12 +12,10 @@ export class FernNextResponse { let redirectLocation = new URL(destination); // sanitize potentially problematic open redirects - if ( - new URL(destination).host !== new URL(withDefaultProtocol(domain)).host - ) { + if (new URL(destination).host !== new URL(withDefaultProtocol(domain)).host) { redirectLocation = new URL(withDefaultProtocol(domain)); } return NextResponse.redirect(redirectLocation); } -} \ No newline at end of file +}