From 08a3b960ddc2c5ba29526016850ac8cf7f351348 Mon Sep 17 00:00:00 2001 From: Markus Ahlstrand Date: Fri, 6 Dec 2024 10:43:14 +0100 Subject: [PATCH] fix: increase ip length to 45 characters --- src/authentication-flows/oauth2.tsx | 1 - src/routes/oauth2/authorize.ts | 12 +++--------- src/utils/client-info.ts | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/authentication-flows/oauth2.tsx b/src/authentication-flows/oauth2.tsx index bfdadf6ea..55ade7390 100644 --- a/src/authentication-flows/oauth2.tsx +++ b/src/authentication-flows/oauth2.tsx @@ -28,7 +28,6 @@ export async function socialAuth( client: Client, connectionName: string, authParams: AuthParams, - auth0Client?: string, ) { if (!authParams.state) { throw new HTTPException(400, { message: "State not found" }); diff --git a/src/routes/oauth2/authorize.ts b/src/routes/oauth2/authorize.ts index b4c834493..2a082cc0c 100644 --- a/src/routes/oauth2/authorize.ts +++ b/src/routes/oauth2/authorize.ts @@ -166,18 +166,12 @@ export const authorizeRoutes = new OpenAPIHono<{ client.connections.length === 1 && !UI_STRATEGIES.includes(client.connections[0].strategy || "") ) { - return socialAuth( - ctx, - client, - client.connections[0].name, - authParams, - auth0Client, - ); + return socialAuth(ctx, client, client.connections[0].name, authParams); } // Social login if (connection && connection !== "email") { - return socialAuth(ctx, client, connection, authParams, auth0Client); + return socialAuth(ctx, client, connection, authParams); } else if (login_ticket) { return ticketAuth( ctx, @@ -191,8 +185,8 @@ export const authorizeRoutes = new OpenAPIHono<{ return universalAuth({ ctx, client, - authParams, auth0Client, + authParams, session: session || undefined, connection, login_hint, diff --git a/src/utils/client-info.ts b/src/utils/client-info.ts index e50fdd9b7..a32c3c3fe 100644 --- a/src/utils/client-info.ts +++ b/src/utils/client-info.ts @@ -3,7 +3,7 @@ import { HonoRequest } from "hono"; export function getClientInfo(req: HonoRequest) { return { auth0Client: req.query("auth0Client")?.slice(0, 256), - ip: req.header("x-real-ip")?.slice(0, 29), + ip: req.header("x-real-ip")?.slice(0, 45), useragent: req.header("user-agent")?.slice(0, 256), }; }