From f71afc2bf5cc9c67fbd14e61c835daca79170815 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 5 Apr 2025 23:12:14 -0400 Subject: [PATCH] refactor --- app/components/OAuthClient/OAuthClientForm.tsx | 3 ++- app/scenes/Settings/Application.tsx | 4 +++- server/utils/oauth/OAuthInterface.test.ts | 8 -------- server/utils/oauth/OAuthInterface.ts | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/components/OAuthClient/OAuthClientForm.tsx b/app/components/OAuthClient/OAuthClientForm.tsx index 5f00a903e2..74dc48e6e7 100644 --- a/app/components/OAuthClient/OAuthClientForm.tsx +++ b/app/components/OAuthClient/OAuthClientForm.tsx @@ -106,10 +106,11 @@ export const OAuthClientForm = observer(function OAuthClientForm_({ placeholder="https://example.com/callback" ref={field.ref} value={field.value.join("\n")} - rows={Math.max(2, field.value.length)} + rows={Math.max(2, field.value.length + 1)} onChange={(event) => { field.onChange(event.target.value.split("\n")); }} + required /> )} /> diff --git a/app/scenes/Settings/Application.tsx b/app/scenes/Settings/Application.tsx index 2ff3790317..55818ca36b 100644 --- a/app/scenes/Settings/Application.tsx +++ b/app/scenes/Settings/Application.tsx @@ -173,6 +173,7 @@ const Application = observer(function Application({ oauthClient }: Props) { { field.onChange(event.target.value.split("\n")); }} + required /> )} /> diff --git a/server/utils/oauth/OAuthInterface.test.ts b/server/utils/oauth/OAuthInterface.test.ts index 4ee8061c52..053e673ccc 100644 --- a/server/utils/oauth/OAuthInterface.test.ts +++ b/server/utils/oauth/OAuthInterface.test.ts @@ -21,14 +21,6 @@ describe("OAuthInterface", () => { ); expect(result).toBe(true); }); - it("should return false for insecure redirect URI", async () => { - const redirectUri = "http://example.com/callback"; - const result = await OAuthInterface.validateRedirectUri( - redirectUri, - client - ); - expect(result).toBe(false); - }); it("should return false for invalid redirect URI", async () => { const redirectUri = "invalid_uri"; const result = await OAuthInterface.validateRedirectUri( diff --git a/server/utils/oauth/OAuthInterface.ts b/server/utils/oauth/OAuthInterface.ts index e96d27a3e6..8368e16ed0 100644 --- a/server/utils/oauth/OAuthInterface.ts +++ b/server/utils/oauth/OAuthInterface.ts @@ -220,7 +220,7 @@ export const OAuthInterface: RefreshTokenModel & return false; } - return !uri.startsWith("http://"); + return true; }, /**