Skip to content

Commit 1897cc3

Browse files
committed
Update OIDC id_token_signing_alg_values_supported for wider algo support
Previously the message verification required RS256 with no other checks on algo. While technically RS256 MUST be supported, some implementations have abandoned it's use as insecure and instead require for example ES256 as a minimum baseline. This change slightly relaxes the check in a future compatible way while still making sure an actual alg is specified instead of `none`. ```python >>> bad = ["none"] >>> good = ["ES256"] >>> dodgy = ["none", "RS256"] >>> empty = [] >>> any(i.lower() != "none" for i in dodgy) True >>> any(i.lower() != "none" for i in empty) False >>> any(i.lower() != "none" for i in good) True >>> any(i.lower() != "none" for i in bad) False ```
1 parent 0290fb0 commit 1897cc3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/idpyoidc/message/oidc/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,14 @@ def verify(self, **kwargs):
942942
"token_endpoint_auth_signing_alg_values_supported"
943943
)
944944

945-
if "RS256" not in self["id_token_signing_alg_values_supported"]:
946-
raise ValueError("RS256 missing from id_token_signing_alg_values_supported")
945+
# Check that any alg that is not "none" is supported.
946+
# While OpenID Connect Core 1.0 says RS256 MUST be supported,
947+
# reality has moved on and more modern alg values may be required.
948+
if not any(i.lower() != "none" for i in self["id_token_signing_alg_values_supported"]):
949+
raise ValueError(
950+
"Secure signing algorithm (for example RS256 or ES256) missing from id_token_signing_alg_values_supported: %s"
951+
% self["id_token_signing_alg_values_supported"]
952+
)
947953

948954
if not parts.query and not parts.fragment:
949955
pass

0 commit comments

Comments
 (0)