Skip to content

stages/user_write: Fix user attributes are not sanitized under certains conditions - #17890

Merged
BeryJu merged 2 commits into
goauthentik:mainfrom
se7kn8:fix-user-write
Dec 1, 2025
Merged

BeryJu merged 2 commits into
goauthentik:mainfrom
se7kn8:fix-user-write

Conversation

@se7kn8

@se7kn8 se7kn8 commented Nov 1, 2025

Copy link
Copy Markdown
Contributor

Details

This PR fixes a case where certain prompt types (like the date prompt) lead to a failure in the user write stage, because of unsanitized attributes. The original issue was reported in #8708 and later fixed in #8926. However, the fix in #8926 only worked if the prompt would write to attributes_foo or attributes.foo.bar. If the normal syntax is used attributes.foo the stage would try to directly update the user attributes, which lead to unsanitized values. This PR fixes that case.


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)

@netlify

netlify Bot commented Nov 1, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 198e2f8
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/692d8eeecc76e800085c5def
😎 Deploy Preview https://deploy-preview-17890--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

netlify Bot commented Nov 1, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 198e2f8
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/692d8eee88063e00088d7ac2
😎 Deploy Preview https://deploy-preview-17890--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 Nov 1, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 198e2f8
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/692d8eeec3c68c0008ad1677
😎 Deploy Preview https://deploy-preview-17890--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.

@rissson
rissson requested a review from BeryJu November 3, 2025 13:57
@rissson rissson moved this from Todo to Needs review in authentik Core Nov 3, 2025
@BeryJu BeryJu self-assigned this Nov 27, 2025
@BeryJu

BeryJu commented Nov 27, 2025

Copy link
Copy Markdown
Member

needs tests @BeryJu

@codecov

codecov Bot commented Nov 27, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.97%. Comparing base (9763cf3) to head (198e2f8).
⚠️ Report is 305 commits behind head on main.

Files with missing lines Patch % Lines
authentik/stages/user_write/stage.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17890      +/-   ##
==========================================
+ Coverage   92.64%   92.97%   +0.32%     
==========================================
  Files         869      911      +42     
  Lines       47960    49775    +1815     
==========================================
+ Hits        44431    46276    +1845     
+ Misses       3529     3499      -30     
Flag Coverage Δ
e2e 45.31% <14.28%> (+1.29%) ⬆️
integration 22.86% <4.76%> (-0.34%) ⬇️
unit 91.19% <95.23%> (+0.11%) ⬆️
unit-migrate 91.24% <95.23%> (+0.11%) ⬆️

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.

@github-project-automation github-project-automation Bot moved this from Needs review to In Progress in authentik Core Dec 1, 2025
@BeryJu
BeryJu merged commit 3ff7332 into goauthentik:main Dec 1, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Dec 1, 2025
@se7kn8
se7kn8 deleted the fix-user-write branch December 1, 2025 14:40
kensternberg-authentik added a commit that referenced this pull request Dec 11, 2025
* main: (53 commits)
  core, web: update translations (#18380)
  web: re-add en.xlf locale (#18469)
  stages/user_write: Fix user attributes are not sanitized under certains conditions (#17890)
  providers/scim: compare users/groups before sending update request (#18456)
  enterprise/endpoints/connectors/agent: fix Apple JWE encryption when FIPS is enabled (#18464)
  website: bump @types/react from 19.2.6 to 19.2.7 in /website (#18357)
  core: bump goauthentik/fips-debian from `ac4c80b` to `de70579` (#18419)
  core: bump github.com/getsentry/sentry-go from 0.39.0 to 0.40.0 (#18416)
  website: bump prettier-plugin-packagejson from 2.5.19 to 2.5.20 in /website (#18460)
  core: bump goauthentik.io/api/v3 from 3.2025120.7 to 3.2025120.11 (#18461)
  website/integrations: add GLPI (#17937)
  website/integrations: small fixes (#18423)
  enterprise: Apple Platform SSO (#15318)
  crypto: only generate managed keypair if non-existent (#18457)
  ci: remove translation-rename (#18444)
  translate: Updates for project authentik and language tr (#18438)
  translate: Updates for project authentik and language fr (#18431)
  translate: Updates for project authentik and language ru (#18442)
  translate: Updates for project authentik and language cs_CZ (#18443)
  translate: Updates for project authentik and language pt (#18437)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants