OIDC: increase length of generated nonce
parameter from 30->32 chars
#18109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR slightly increases the character length (and thus the entropy) of the
nonce
value (from the default 30 characters -> 32 characters) that Synapse generates when performing an OIDC login.This is so that Synapse's OIDC implementation complies with the relevant portion of the TI-Messenger spec - which aims to standardise Matrix as the communication layer for healthcare in Germany.
The spec requires (translation via Google Translate):
We clarified with Gematik (the German government body in charge of writing this spec) what they meant exactly by "an entropy of at least 43". They replied that they meant to write "43 characters".
When sent to the Identity Provider, the
nonce
value is encoded using base64url. A 32 character string encoded to base64url results in a 43 character length string. Thus, this change aligns Synapse's generatednonce
value with the spec.While this change is intended to satisfy an external spec, the change only increases security (while only adding three extra bytes to a request). The matrix spec does not cover this flow, instead (rightly) offloading it to RFC7636. That RFC only demands a 43 character length for the
code_verifier
parameter, which Synapse does comply with. Whereas Gematik have opted to adapt that length requirement to thenonce
parameter as well.