Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProviderConfig._load_federation_metadata loads expired certificates #340

Open
erfaan opened this issue May 21, 2024 · 1 comment
Open

ProviderConfig._load_federation_metadata loads expired certificates #340

erfaan opened this issue May 21, 2024 · 1 comment

Comments

@erfaan
Copy link

erfaan commented May 21, 2024

The ADFS Server 2012 R2 configuration looks like this:
Screenshot 2024-05-21 at 5 10 21 PM

Please note that the first certificate is active whereas the second one is expired.

The Federation metadata lists both certificates under fed:SecurityTokenServiceType.

Following code loads all certificates including the expired one.

# Extract token signing certificates
xml_tree = ElementTree.fromstring(response.content)
cert_nodes = xml_tree.findall(
"./{urn:oasis:names:tc:SAML:2.0:metadata}RoleDescriptor"
"[@{http://www.w3.org/2001/XMLSchema-instance}type='fed:SecurityTokenServiceType']"
"/{urn:oasis:names:tc:SAML:2.0:metadata}KeyDescriptor[@use='signing']"
"/{http://www.w3.org/2000/09/xmldsig#}KeyInfo"
"/{http://www.w3.org/2000/09/xmldsig#}X509Data"
"/{http://www.w3.org/2000/09/xmldsig#}X509Certificate")
signing_certificates = [node.text for node in cert_nodes]

This causes the callback to fail with "Signature verification failed" error.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@tim-schilling
Copy link
Member

Thank you for opening an issue, would you be able to create a PR to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants