mirror of
https://github.com/penpot/penpot.git
synced 2026-08-05 12:29:00 +00:00
🐛 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
This commit is contained in:
parent
43e05c38bf
commit
6228345cd3
@ -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.
|
||||
|
||||
@ -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")))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user