element-hq / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://element-hq.github.io/synapse
GNU Affero General Public License v3.0
1.25k stars 152 forks source link

New OIDC user registrations do not bind email addresses when user consent is required at registration time. #16317

Open matrixbot opened 8 months ago

matrixbot commented 8 months ago

This issue has been migrated from #16317.


This is a bit of an edge case, so please bear with. The parameters are:

When this is set, the mapped email is always ignored on registration. Specifically you'll get a log line like:

2023-09-12 23:08:50,238 - synapse.handlers.sso - 1074 - INFO - GET-219194- [session vsrKfTioDugwCcQw] Registered userid @foo:example.com with attributes UserAttributes(localpart='foo', confirm_localpart=False, display_name='Mr Foo', picture=None, emails=())

The OIDC code is quite hard to follow, but I have done my best to understand it. The flow I believe is as follows:

/_synapse/client/oidc/callback

/_synapse/client/new_user_consent

/_synapse/client/sso_register

Proposal

We should probably fall back to session.emails when session.emails_to_use has not been defined.

thebalaa commented 2 months ago

I am seeing this behavior even without consent being enabled. Using keyloak oidc provider.