This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Unexpected error if an OIDC IdP is configured without jwks_uri
#12980
Labels
A-Social Login
Login via external identity providers
S-Minor
Blocks non-critical functionality, workarounds exist.
T-Defect
Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
If an IdP is configured with
user_profile_method: "userinfo_endpoint"
, we allow it to not specify ajwks_uri
property.jwks_uri
is used if the IdP gives us anid_token
, which is a JWT including profile information about the user being authenticated.Initially, we would ignore
id_token
if the configured method to retrieve the user profile isuserinfo_endpoint
, which means in this case we don't care whetherjwks_uri
is defined. However, #11482 changed this logic so that we always validate and parse theid_token
, regardless of whatuser_profile_method
is set to.This means that if an IdP is configured to use the userinfo endpoint and doesn't have
jwks_uri
set, authenticating via this IdP will fail with this error:This error is raised in this function:
synapse/synapse/handlers/oidc.py
Lines 502 to 514 in 6ff99e3
Which still seems to think that it's impossible to reach it if the userinfo endpoint is used.
I chatted with @sandhose about this and the reasoning behind this logic is that if the IdP sends an
id_token
, it expects it to be validated.I see a few ways to fix this issue:
id_token
but we don't have ajwks_uri
in the configjwks_uri
set if theopenid
scope is listed inscopes
id_token
if we're using the userinfo endpoint (we do nothing with it apart from validating it in this case anyway)I would lean towards 2, as it looks like the
openid
scope basically tells the IdP it should send anid_token
. However, I don't have much context or knowledge around the OIDC spec and its implementation in Synapse, so I'd be happy to read others' opinions.The text was updated successfully, but these errors were encountered: