authentik icon indicating copy to clipboard operation
authentik copied to clipboard

sources/saml: move SAML Response signature verification before decryption

Open ikob opened this issue 1 year ago • 4 comments

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 https://github.com/goauthentik/authentik/issues/16627


Checklist

  • [x] Local tests pass (ak test authentik/)
  • [x] 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

  • [x] The code has been formatted (make web)

If applicable

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

ikob avatar Nov 16 '25 04:11 ikob

Deploy Preview for authentik-docs ready!

Name Link
Latest commit 5a34eb4ea72b65be25845946d2999c1692abaeca
Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69339987a2c63d0008c419ac
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 avatar Nov 16 '25 04:11 netlify

Deploy Preview for authentik-storybook ready!

Name Link
Latest commit 5a34eb4ea72b65be25845946d2999c1692abaeca
Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6933998722b0030008641a38
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 avatar Nov 16 '25 04:11 netlify

Deploy Preview for authentik-integrations ready!

Name Link
Latest commit 5a34eb4ea72b65be25845946d2999c1692abaeca
Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/69339987473fff0008269fdb
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.

netlify avatar Nov 16 '25 04:11 netlify

Codecov Report

:x: Patch coverage is 95.31250% with 3 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 93.18%. Comparing base (dbbfb3c) to head (5a34eb4). :warning: Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
authentik/sources/saml/processors/response.py 92.85% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18176      +/-   ##
==========================================
- Coverage   93.22%   93.18%   -0.04%     
==========================================
  Files         933      933              
  Lines       51227    51264      +37     
==========================================
+ Hits        47754    47768      +14     
- Misses       3473     3496      +23     
Flag Coverage Δ
e2e 44.73% <7.81%> (+<0.01%) :arrow_up:
integration 22.74% <0.00%> (-0.07%) :arrow_down:
unit 91.45% <95.31%> (+0.01%) :arrow_up:
unit-migrate 91.49% <95.31%> (+<0.01%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Nov 16 '25 04:11 codecov[bot]

Hey @ikob is this here fixing https://github.com/goauthentik/authentik/issues/16627 ? If yes - what can I do to help push this further?

tfc avatar Dec 11 '25 09:12 tfc

Hey @ikob is this here fixing https://github.com/goauthentik/authentik/issues/16627 ?

Partially yes as as mentioned...

Hopefully close 405 errors at the step 4 of https://github.com/goauthentik/authentik/issues/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.

ikob avatar Dec 12 '25 09:12 ikob

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

tfc avatar Dec 12 '25 10:12 tfc