From 6228345cd3499cad9cfa2e4a669e5b6cb4f31b81 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 4 Aug 2026 12:07:26 +0000 Subject: [PATCH] :bug: Enable SSRF check for organization SSO provider (#11064) Remove :skip-ssrf-check? true from prepare-organization-sso-provider so SSRF protection is active when validating organization SSO configs. The endpoint is already protected by shared-key authentication (admin-console), but enabling SSRF protection prevents potential misuse of internal network resources if the shared key were ever compromised (defense-in-depth). Add test prepare-organization-sso-provider-does-not-skip-ssrf-check to verify the SSRF check is not skipped. AI-assisted-by: qwen3.7-plus --- backend/src/app/auth/oidc.clj | 5 ++--- backend/test/backend_tests/auth_oidc_test.clj | 13 +++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/src/app/auth/oidc.clj b/backend/src/app/auth/oidc.clj index 09d34532b9..ecf8b658a5 100644 --- a/backend/src/app/auth/oidc.clj +++ b/backend/src/app/auth/oidc.clj @@ -776,7 +776,7 @@ (defn prepare-organization-sso-provider "Build an OIDC provider map dynamically from the Nitrate organization SSO config. - Uses OIDC discovery via :issuer when token/auth/user URIs are absent." + Uses OIDC discovery via :issuer when token/auth/user URIs are absent." [cfg {:keys [client-id client-secret issuer]}] (prepare-oidc-provider cfg {:type "oidc" @@ -785,8 +785,7 @@ :base-uri (some-> (non-blank-uri issuer) (str/rtrim "/") (str "/")) - :scopes default-oidc-scopes - :skip-ssrf-check? true})) + :scopes default-oidc-scopes})) (defn build-organization-sso-auth-redirect-uri "Build the OIDC authorization redirect URI for an organization SSO config. diff --git a/backend/test/backend_tests/auth_oidc_test.clj b/backend/test/backend_tests/auth_oidc_test.clj index 22ccb624fe..62f04fd546 100644 --- a/backend/test/backend_tests/auth_oidc_test.clj +++ b/backend/test/backend_tests/auth_oidc_test.clj @@ -518,3 +518,16 @@ loc (redirect-location result)] (t/is (= 302 (::yres/status result))) (t/is (.contains loc "error=unable-to-auth"))))))) + +(t/deftest prepare-organization-sso-provider-does-not-skip-ssrf-check + (t/testing "organization SSO provider must use SSRF protection" + (let [captured-params (atom nil)] + (with-redefs [oidc/prepare-oidc-provider (fn [_cfg params] + (reset! captured-params params) + {:type "oidc" :id "test"})] + (#'oidc/prepare-organization-sso-provider {} + {:client-id "test-client" + :client-secret "test-secret" + :issuer "https://idp.example.com"}) + (t/is (not (true? (:skip-ssrf-check? @captured-params))) + "SSRF protection must be disabled for organization SSO")))))