Skip to content

sources/saml: move SAML Response signature verification before decryption#18176

Closed
ikob wants to merge 35 commits intogoauthentik:mainfrom
ant-r-ih:fix-SAML-signed-res-verify
Closed

sources/saml: move SAML Response signature verification before decryption#18176
ikob wants to merge 35 commits intogoauthentik:mainfrom
ant-r-ih:fix-SAML-signed-res-verify

Conversation

@ikob
Copy link
Contributor

@ikob ikob commented Nov 16, 2025

Details

When a SAML Response is encrypted, signature verification may fail because it is performed after decryption, when the original signed structure has changed.
This PR moves the verification step for signed responses to before decryption to handle encrypted signed responses correctly.
For backward compatibility, the post-decryption check remains as a fallback.

Hopefully close 405 errors at the step 4 of #16627


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 has been updated (make gen-build)

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)

authentik-automation bot and others added 22 commits October 20, 2025 23:43
…ntik#17607 to version-2025.10) (goauthentik#17620)

website: fix active menu link background overlap (goauthentik#17607)

Co-authored-by: Dominic R <dominic@sdko.org>
…ion-2025.10) (goauthentik#17627)

Co-authored-by: authentik-automation[bot] <135050075+authentik-automation[bot]@users.noreply.github.com>
…y-pick goauthentik#17625 to version-2025.10) (goauthentik#17626)

ci: use forked release action to deal with large release notes (goauthentik#17625)

* ci: use forked release action to deal with large release notes



* bump build



---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L. <jens@goauthentik.io>
…ry-pick goauthentik#17606 to version-2025.10) (goauthentik#17637)

enterprise: add prometheus metrics for license usage and expiry (goauthentik#17606)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L. <jens@goauthentik.io>
…y-pick goauthentik#17641 to version-2025.10) (goauthentik#17652)

website/docs: rel notes 2025.10: add 3 more integration guides (goauthentik#17641)

* add 3 more int guides

* Apply suggestion from @dominic-r



* is github's suggestion thingy usually this buggy

---------

Signed-off-by: Dominic R <dominic@sdko.org>
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Co-authored-by: Tana M Berry <tana@goauthentik.io>
Co-authored-by: Dominic R <dominic@sdko.org>
…ik#17650 to version-2025.10) (goauthentik#17651)

providers/proxy: drop headers with underscores (goauthentik#17650)

drop any headers with underscores that we set in the remote system

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L. <jens@goauthentik.io>
…hentik#17657 to version-2025.10) (goauthentik#17672)

website/docs: add note about invite link not bound (goauthentik#17657)

* invite link not bound

* marcelo's truth

* jens tweak

---------

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Co-authored-by: Tana M Berry <tana@goauthentik.io>
…hentik#17642 to version-2025.10) (goauthentik#17699)

website/docs: eap add info about custom validation (goauthentik#17642)

* add info about custom validation

* tweaked table

* remove bullet

* remove other bullet

---------

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Co-authored-by: Tana M Berry <tana@goauthentik.io>
…ntik#17700 to version-2025.10) (goauthentik#17701)

Co-authored-by: Dominic R <dominic@sdko.org>
…oauthentik#17628 to version-2025.10) (goauthentik#17633)

website/docs: add short-lived certificate recommendation (goauthentik#17628)

Add certificate recommendation

Co-authored-by: Dewi Roberts <dewi@goauthentik.io>
…k#17704 to version-2025.10) (goauthentik#17708)

website/docs: blueprints: add a bit more info (goauthentik#17704)

* website/docs: blueprints: add a bit more info

* this might be worth mentioning

* fix

* a bit more info

Co-authored-by: Dominic R <dominic@sdko.org>
… to version-2025.10) (goauthentik#17730)

enterprise: handle cached naive timezone (goauthentik#17695)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L. <jens@goauthentik.io>
…to version-2025.10) (goauthentik#17732)

website/docs: update flow context ref (goauthentik#17723)

* website/docs: update flow context ref



* format



* Update website/docs/add-secure-apps/flows-stages/flow/context/index.mdx




* Update website/docs/add-secure-apps/flows-stages/flow/context/index.mdx




---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens L. <jens@beryju.org>
Co-authored-by: Jens L. <jens@goauthentik.io>
Co-authored-by: Dominic R <dominic@sdko.org>
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
…#17728 to version-2025.10) (goauthentik#17733)

website/docs: finalise 2025.10 release notes (goauthentik#17728)

* website/docs: finalise 2025.10 release notes



* format



---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens L. <jens@goauthentik.io>
@ikob ikob requested a review from a team as a code owner November 16, 2025 04:43
@ikob ikob requested a review from rissson November 16, 2025 04:43
@netlify
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 16a290a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/694e7b725b77c6000840682e
😎 Deploy Preview https://deploy-preview-18176--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.

@netlify
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 16a290a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/694e7b72b8a31f00084b4108
😎 Deploy Preview https://deploy-preview-18176--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
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 16a290a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/694e7b723b91510008fba62c
😎 Deploy Preview https://deploy-preview-18176--authentik-integrations.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
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.11%. Comparing base (61e45ca) to head (16a290a).
⚠️ Report is 313 commits behind head on main.

Files with missing lines Patch % Lines
authentik/sources/saml/processors/response.py 92.15% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18176      +/-   ##
==========================================
- Coverage   93.37%   93.11%   -0.27%     
==========================================
  Files         950      950              
  Lines       52229    52271      +42     
==========================================
- Hits        48771    48673      -98     
- Misses       3458     3598     +140     
Flag Coverage Δ
conformance 38.80% <4.10%> (-0.03%) ⬇️
e2e 43.53% <4.10%> (-1.07%) ⬇️
integration 23.32% <0.00%> (-0.07%) ⬇️
unit 91.60% <94.52%> (+<0.01%) ⬆️
unit-migrate 91.64% <94.52%> (+<0.01%) ⬆️

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.

@rissson rissson changed the title sources/SAML: move SAML Response signature verification before decryption sources/saml: move SAML Response signature verification before decryption Nov 25, 2025
Copy link
Contributor

@PeshekDotDev PeshekDotDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a couple comments just saying "This is the fallback verification", etc?

Really appreciate you getting to this @ikob

@github-project-automation github-project-automation bot moved this from Needs review to In Progress in authentik Core Dec 2, 2025
ikob and others added 7 commits December 4, 2025 15:08
We need some more test fixtures for fixing it.

Co-authored-by: Connor Peshek <connor@connorpeshek.me>
Signed-off-by: Katsushi Kobayashi <ikob@acm.org>
…ion-2025.10) (goauthentik#17627)

Co-authored-by: authentik-automation[bot] <135050075+authentik-automation[bot]@users.noreply.github.com>
Signed-off-by: Katsushi Kobayashi <ikob@acm.org>
@ikob ikob requested a review from PeshekDotDev December 9, 2025 10:09
@tfc
Copy link

tfc commented Dec 11, 2025

Hey @ikob is this here fixing #16627 ? If yes - what can I do to help push this further?

@ikob
Copy link
Contributor Author

ikob commented Dec 12, 2025

Hey @ikob is this here fixing #16627 ?

Partially yes as as mentioned...

Hopefully close 405 errors at the step 4 of #16627

If yes - what can I do to help push this further?

I am not sure the review/merging priority, but your interests may help including this conversation.

@tfc
Copy link

tfc commented Dec 12, 2025

@rissson @PeshekDotDev anything we can do to advance this further?

@ikob ikob requested a review from PeshekDotDev January 9, 2026 05:01
@hassidan
Copy link

any update about that?

@tfc
Copy link

tfc commented Jan 15, 2026

Is fixing google login with signed callbacks no priority, or is there anything controversial about this PR?

@PeshekDotDev
Copy link
Contributor

Hey everyone, I have made a different version of this PR that is more in line with our engineering style. I appreciate everyone's patience, and if there are any questions — or especially if there are any other saml source/provider related issues you all have found — please let me know. I am committed to getting our SAML experience as nice as possible

Thank you

Alternate PR — #19593

@github-project-automation github-project-automation bot moved this from In Progress to Done in authentik Core Jan 20, 2026
@ikob
Copy link
Contributor Author

ikob commented Jan 21, 2026

@PeshekDotDev,
I made a PR to add test cases based on this PR. Take look #19647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants