Skip to content

providers/saml: catch InvalidVersion from cryptography when parsing metadata - #21185

Merged
BeryJu merged 1 commit into
goauthentik:mainfrom
M-Slanec:SAML-metadata-exception
Jul 13, 2026
Merged

BeryJu merged 1 commit into
goauthentik:mainfrom
M-Slanec:SAML-metadata-exception

Conversation

@M-Slanec

Copy link
Copy Markdown
Contributor

Details

Currently if you have a v2 x509 certificate inside of the metadata, the raised InvalidVersion exception is not caught. This PR catches that exception.


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema and clients have been updated (make gen)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make docs)

…etadata certificates to prevent 500 errors
@M-Slanec
M-Slanec requested a review from a team as a code owner March 27, 2026 03:55
@netlify

netlify Bot commented Mar 27, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 5d42022
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/69c5ffbe8642630008f30f65
😎 Deploy Preview https://deploy-preview-21185--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 27, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 5d42022
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69c5ffbe1eccdc0008ce3073
😎 Deploy Preview https://deploy-preview-21185--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Mar 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.76%. Comparing base (432bbb0) to head (5d42022).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...entik/providers/saml/processors/metadata_parser.py 33.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21185      +/-   ##
==========================================
- Coverage   92.80%   92.76%   -0.05%     
==========================================
  Files        1000     1000              
  Lines       56627    56633       +6     
  Branches      425      425              
==========================================
- Hits        52555    52535      -20     
- Misses       4072     4098      +26     
Flag Coverage Δ
conformance 37.36% <11.11%> (-0.01%) ⬇️
e2e 42.86% <11.11%> (-0.01%) ⬇️
integration 22.16% <0.00%> (-0.05%) ⬇️
rust 0.23% <ø> (ø)
unit 90.22% <33.33%> (+1.15%) ⬆️
unit-migrate 91.80% <33.33%> (+0.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BeryJu
BeryJu merged commit 71a8531 into goauthentik:main Jul 13, 2026
102 of 103 checks passed
kensternberg-authentik added a commit that referenced this pull request Jul 13, 2026
* main: (30 commits)
  providers/saml: catch InvalidVersion from cryptography when parsing metadata (#21185)
  stages/user_login: refuse to log in an unsaved pending user (#21691)
  web/admin: hide previous loglist when no previous logs available (#23954)
  stages/email: fix ungrammatical expiry time in password reset templates (#22758)
  tests/openid_conformance: Add more conformance coverage (#22174)
  sources/ldap: derive TLS SNI name from hostname, not full server URI (#22456)
  core: bump github.com/grafana/pyroscope-go from 1.3.1 to 1.4.0 (#23885)
  web: Fix Log Viewer Intersection Observer. (#23861)
  web: bump the goauthentik group across 1 directory with 2 updates (#23926)
  ci: bump regclient/actions/regctl-login from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23890)
  ci: bump regclient/actions/regctl-installer from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23891)
  core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /website (#23930)
  core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /lifecycle/container (#23927)
  core: bump github.com/sethvargo/go-envconfig from 1.3.0 to 1.3.1 (#23921)
  core: bump goauthentik/selenium from 149.0-ak-0.50.1 to 149.0-ak-0.50.2 in /tests/e2e (#23924)
  core: bump uvicorn[standard] from 0.49.0 to 0.50.0 (#23925)
  core: bump ruff from 0.15.20 to 0.15.21 (#23928)
  core: bump goauthentik/fips-python from `aaaab46` to `0798f3b` in /lifecycle/container (#23929)
  ci: bump actions/stale from 10.3.0 to 10.4.0 (#23935)
  ci: bump github/codeql-action/autobuild from 4.36.3 to 4.37.0 (#23931)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 13, 2026
* main: (48 commits)
  web/bug: harmonize and make routine the display of tasks (part 2: description list abuse) (#23839)
  providers/oauth2: fix iframe logout stage progression (#23919)
  providers/scim: improve error display when error doesn't conform to scim schema (#23955)
  providers/saml: catch InvalidVersion from cryptography when parsing metadata (#21185)
  stages/user_login: refuse to log in an unsaved pending user (#21691)
  web/admin: hide previous loglist when no previous logs available (#23954)
  stages/email: fix ungrammatical expiry time in password reset templates (#22758)
  tests/openid_conformance: Add more conformance coverage (#22174)
  sources/ldap: derive TLS SNI name from hostname, not full server URI (#22456)
  core: bump github.com/grafana/pyroscope-go from 1.3.1 to 1.4.0 (#23885)
  web: Fix Log Viewer Intersection Observer. (#23861)
  web: bump the goauthentik group across 1 directory with 2 updates (#23926)
  ci: bump regclient/actions/regctl-login from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23890)
  ci: bump regclient/actions/regctl-installer from 4b4db1dcc7dad75ad67a788a380f75a20cc8a040 to 39bf30ced4be9d147faaabbde2682e9725fb8bd1 (#23891)
  core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /website (#23930)
  core: bump pnpm/pnpm from 11.10.0 to 11.11.0 in /lifecycle/container (#23927)
  core: bump github.com/sethvargo/go-envconfig from 1.3.0 to 1.3.1 (#23921)
  core: bump goauthentik/selenium from 149.0-ak-0.50.1 to 149.0-ak-0.50.2 in /tests/e2e (#23924)
  core: bump uvicorn[standard] from 0.49.0 to 0.50.0 (#23925)
  core: bump ruff from 0.15.20 to 0.15.21 (#23928)
  ...
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

Successfully merging this pull request may close these issues.

2 participants