Repository navigation
endpoints/agent: fix Secure Enclave key dropped on first Platform SSO user registration - #24587
Conversation
… user registration
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24587 +/- ##
==========================================
- Coverage 91.20% 91.16% -0.05%
==========================================
Files 1128 1128
Lines 70501 70515 +14
Branches 3798 3798
==========================================
- Hits 64302 64282 -20
- Misses 6164 6198 +34
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-296443c98599502e7de01cd648e9ef6449d06f29
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your 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-296443c98599502e7de01cd648e9ef6449d06f29Afterwards, run the upgrade commands from the latest release notes. |
|
🍒 Cherry-pick to |
|
🍒 Cherry-pick to |
… user registration (cherry-pick #24587 to version-2026.8) (#24590) endpoints/agent: fix Secure Enclave key dropped on first Platform SSO user registration (#24587) Co-authored-by: Connor Peshek <[email protected]>
… user registration (cherry-pick #24587 to version-2026.5) (#24589) endpoints/agent: fix Secure Enclave key dropped on first Platform SSO user registration (#24587) Co-authored-by: Connor Peshek <[email protected]>
Details
What does this PR change?
RegisterUserViewpassed the Secure Enclave fields toupdate_or_create()indefaultsonly, with
create_defaultsholding justis_primaryandorder. Django'supdate_or_create()returns immediately when it creates the object, sodefaultsis neverapplied on the create path — the enclave key and key ID were silently discarded the first
time a user registered, and the endpoint still returned 200.
The fields are now passed in both
create_defaultsanddefaults.test_register_userpreviously asserted only the response status and username, which is whythis went unnoticed. It now asserts that the enclave key and key ID are persisted on create,
and that re-registering replaces them.
Why is this change needed?
Platform SSO is unusable after a first-time registration. The binding is written with an
empty
apple_enclave_key_id, sovalidate_embedded_assertion()inapple_token.pycannotmatch the assertion to a binding or an independent enclave, and the token exchange fails.
The bug only bites on the create path — a second registration takes the update branch, where
defaultsdoes apply and the key is written correctly. That makes it easy to miss in manualtesting and is likely why it survived review.
How was this tested?
Reproduced end to end against a live macOS 26.6 device with authentik Agent 0.50.5, before
applying the fix:
POST /api/v3/endpoints/agents/psso/register/user/→ 200apple_enclave_key_id = ''and a zero-lengthapple_secure_enclave_keyPOST /endpoints/agent/psso/token/failed, loggingCould not find device user binding or independent enclave for userLinked issues
Checklist
make all)make docs)