Repository navigation
Conversation
OAuth2 claims and outgoing sync data were merged with deepmerge's always_merger, which appends lists. A list returned by two mappings therefore contained every item twice, for example `groups` from the stock `profile` mapping and a custom `groups` mapping. Merge with MERGE_LIST_UNIQUE instead, as source property mappings already do. The discovery document listed such claims twice in `claims_supported` for the same reason. The stock `profile` mapping keeps its `groups` claim. It has been there since the mapping was created, the docs list group membership as part of `profile`, and integrations rely on it. Closes: #25842
✅ 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 #27283 +/- ##
=======================================
Coverage 93.00% 93.01%
=======================================
Files 1226 1226
Lines 85284 85345 +61
Branches 4894 4894
=======================================
+ Hits 79322 79384 +62
+ Misses 5875 5874 -1
Partials 87 87
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 41862923311 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-ce1a6c96dd63e461d176d8e5aa088fa4eac6525f
# Distroless image: AUTHENTIK_TAG=gh-ce1a6c96dd63e461d176d8e5aa088fa4eac6525f-distroless
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-ce1a6c96dd63e461d176d8e5aa088fa4eac6525f
# Distroless image: tag: gh-ce1a6c96dd63e461d176d8e5aa088fa4eac6525f-distrolessAfterwards, run the upgrade commands from the latest release notes. |
BeryJu
left a comment
There was a problem hiding this comment.
no matter what we change this to, its always gonna be the incorrect way for certain use-cases
one way around this would be to make the merging configurable (I think the most sensible location for that would be on the mapping, but that might have some impact performance wise for using different methods for merging per mapping, but probably negligable..?)
No single rule for combining lists that several mappings return fits every setup: appending duplicates groups when two scope mappings return them, while de-duplicating drops repeated values that some services expect. Scope, synchronization and source property mappings now have a list merge mode (append, append unique, or replace) that decides how the lists a mapping returns merge into the results of the mappings evaluated before it. Defaults keep today's behavior: scope and synchronization mappings append, and source mappings append unique items. Scope mappings that share a scope name are now also ordered by name, so which mapping is evaluated later is stable.
…ing-merge-unique-lists
…ing-merge-unique-lists
Details
What does this PR change?
Scope mappings, synchronization mappings (SCIM, Google Workspace, Microsoft Entra) and source property mappings get a List merging setting. It decides how a list that the mapping returns is combined with the list under the same key that mappings evaluated before it returned:
The setting applies to lists at any depth. Dictionaries and other values merge as before. Defaults keep today's behavior: scope and synchronization mappings append, and source mappings append unique items. Existing mappings get the same defaults through the migrations.
Because the mode of the mapping evaluated later decides, scope mappings that share a scope name are now ordered by name too, so the order is stable. The OpenID discovery document also lists each claim once in
claims_supported.The admin forms for those mapping types show the setting with the type's default. SAML, RADIUS, RAC and notification mappings don't merge results, so they don't get the field. The docs for provider and source property mappings describe the setting.
Why is this change needed?
The stock
profilescope mapping and a customgroupsscope mapping both returngroups, so the userinfo response and the ID token listed every group twice (#25842). Outgoing sync had the same problem: two SCIM mappings that each return the core user schema inschemassent it twice.No single rule fits every setup. Append duplicates values, while de-duplicating drops repeated values that some services expect. Making it a setting on the mapping lets admins fix the duplicate groups by setting the
profilemapping to Append unique items, without changing what other setups receive. Replace also lets an OAuth source mapping substitute plain identifiers for object-shapedgroupsclaims instead of adding them to the collected list.The issue also suggests removing
groupsfrom the stockprofilemapping. This PR keeps it. Integration guides such as Dashy, Homarr and NetBox rely on it, so removing it would silently drop the group claim for those applications.How was this tested?
Added regression tests:
profilemapping and a customgroupsmapping returns the groups twice with Append, once with Append unique items, and only theprofilemapping's groups with Replace;schemaslists it twice with the default and once with Append unique items;subandgroupsonce when a custom mapping also returns them.The existing OAuth2, SCIM, Google Workspace, Entra, LDAP, OAuth, SAML and SCIM source tests pass. I couldn't run the Kerberos source tests, which need a local Kerberos install, and I didn't test the admin form or a live OIDC client in a browser.
Linked issues
Closes #25842
refs #27284 (docs)
Checklist
make all)make docs)