Skip to content

providers/saml: fix structure of encrypted saml assertion#19592

Merged
PeshekDotDev merged 1 commit intomainfrom
saml-encryption-fix-saml
Jan 20, 2026
Merged

providers/saml: fix structure of encrypted saml assertion#19592
PeshekDotDev merged 1 commit intomainfrom
saml-encryption-fix-saml

Conversation

@PeshekDotDev
Copy link
Contributor

@PeshekDotDev PeshekDotDev commented Jan 20, 2026

Details

A couple errors caused encrypted assertions to miss attributes or accidentally have an extra encrypteddata tag inside them after decryption. This pr fixes both of those errors

Closes #19585
Closes #19586


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)

@PeshekDotDev PeshekDotDev requested a review from a team as a code owner January 20, 2026 02:01
@netlify
Copy link

netlify bot commented Jan 20, 2026

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 76bb57c
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/696ee1f070724e0008d1dd38
😎 Deploy Preview https://deploy-preview-19592--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
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.21%. Comparing base (083b61c) to head (76bb57c).
⚠️ Report is 17 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19592      +/-   ##
==========================================
- Coverage   93.26%   93.21%   -0.05%     
==========================================
  Files         949      949              
  Lines       52069    52068       -1     
==========================================
- Hits        48560    48535      -25     
- Misses       3509     3533      +24     
Flag Coverage Δ
conformance 38.26% <0.00%> (+<0.01%) ⬆️
e2e 44.12% <0.00%> (+0.04%) ⬆️
integration 23.15% <0.00%> (-0.06%) ⬇️
unit 91.50% <100.00%> (+<0.01%) ⬆️
unit-migrate 91.52% <100.00%> (-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.

self._assertion_id,
ns=xmlsec.constants.DSigNs,
)
assertion.append(encryption)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was appending a blank xenc:EncryptedData that showed up in the decrypted SAML #19585


def _encrypt(self, element: Element, parent: Element):
"""Encrypt SAMLResponse EncryptedAssertion Element"""
# Create a standalone copy so namespace declarations are included in the encrypted content
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change prevents us from losing the xmlns:saml declaration #19586

@github-project-automation github-project-automation bot moved this from Todo to In Progress in authentik Core Jan 20, 2026
@PeshekDotDev PeshekDotDev added the backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12 label Jan 20, 2026
@github-actions
Copy link
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-76bb57c2d2f3ca0aeb1333b8f0955a61dec4744c
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-76bb57c2d2f3ca0aeb1333b8f0955a61dec4744c

Afterwards, run the upgrade commands from the latest release notes.

@PeshekDotDev PeshekDotDev merged commit d1a909a into main Jan 20, 2026
143 of 145 checks passed
@PeshekDotDev PeshekDotDev deleted the saml-encryption-fix-saml branch January 20, 2026 14:57
@github-project-automation github-project-automation bot moved this from In Progress to Done in authentik Core Jan 20, 2026
@authentik-automation
Copy link
Contributor

🍒 Cherry-pick to version-2025.12 created: #19613

BeryJu pushed a commit that referenced this pull request Jan 20, 2026
…#19592 to version-2025.12) (#19613)

providers/saml: fix structure of encrypted saml assertion (#19592)

Co-authored-by: Connor Peshek <connor@connorpeshek.me>
kensternberg-authentik added a commit that referenced this pull request Jan 20, 2026
* main: (191 commits)
  sources/saml: Fix signature verification order to accommodate encrypted assertions (#19593)
  providers/saml: fix structure of encrypted saml assertion (#19592)
  providers/saml: allow encryption certificates without private keys (#19526)
  integrations: add saml steps to mattermost (#19590)
  policies: fix Provider's authentication_flow not used when set (#19609)
  web: bump type-fest from 5.4.0 to 5.4.1 in /web (#19473)
  endpoints: fix endpoints stage marked as enterprise (#19607)
  core: bump selenium from 4.39.0 to 4.40.0 (#19564)
  core: bump goauthentik.io/api/v3 from 3.2026020.11 to 3.2026020.12 (#19594)
  core: bump openapitools/openapi-generator-cli from v7.18.0 to v7.19.0 in /scripts/api (#19595)
  core: bump fido2 from 2.1.0 to 2.1.1 (#19596)
  web: bump @sentry/browser from 10.34.0 to 10.35.0 in /web in the sentry group across 1 directory (#19597)
  core: bump aws-cdk-lib from 2.235.0 to 2.235.1 (#19598)
  web: bump the eslint group across 1 directory with 3 updates (#19599)
  web: bump the rollup group across 1 directory with 4 updates (#19600)
  web: bump the swc group across 1 directory with 12 updates (#19601)
  web: bump pino from 10.2.0 to 10.2.1 in /web (#19602)
  web: bump knip from 5.81.0 to 5.82.1 in /web (#19603)
  tests: improve e2e/integration test reliability (#19540)
  web: update @goauthentik/api (#19542)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

SAML assertion missing xmlns:saml declaration SAML contains invalid <xenc:EncryptedData> tag after decryption

2 participants