Repository navigation
Description
Bug: SSO claim rules cannot read a claim whose name contains dots (Auth0 namespaced claims, SAML URIs)
P2. Locally reproduced at current main 4e3c8e40fe05706a5e8796bb30b024b58c1038f9 by the TALE-223 coordinator, with an independent read-only review.
Reproduction and result
Role rules with the source claim and the OIDC/OAuth2 claim mappings for name, email and groups resolve a path with resolveClaimPath. It splits the configured name on every dot. A top-level claim whose name itself contains dots therefore can never be read:
| Identity data | Rule or mapping | Result on main | Expected |
|---|---|---|---|
OIDC userinfo {"https://tale.example.com/roles": ["admin"]} (Auth0 namespaced custom claim) |
path https://tale.example.com/roles |
undefined |
["admin"] |
SAML attribute http://schemas.microsoft.com/ws/2008/06/identity/claims/role = Tale.Admin (Microsoft's role claim URI) |
claim rule Tale.Admin → admin |
default role member |
admin |
SAML attribute urn:oid:1.3.6.1.4.1.5923.1.1.1.1 (eduPersonAffiliation) = staff |
claim rule staff → editor |
default role member |
editor |
The member signs in with the default role instead of the mapped one. The module itself names Auth0's namespaced URLs as a case its dot-paths cover (services/platform/backend/core/enterprise_sso/claims.ts:1-8). The SAML adapter hands the attribute bag, keyed by these URIs, to the same rules as rawClaims (backend/core/enterprise_sso/saml/attributes.ts:106-112). The guide only says "claim paths can use dots, such as realm_access.roles" (docs/en/platform/admin/enterprise-sso.md:34), and the rule form's help reads "Dot-path into the token claims, e.g. realm_access.roles." (services/platform/messages/en/settings.yml:719). Nothing says that a name containing dots cannot be addressed, and nothing logs a rule that fails to resolve.
Root
backend/core/enterprise_sso/claims.ts:16-24: resolveClaimPath walks path.split('.') from the root and never tries the full name as a key. Callers:
entra_id/role_mapping.ts:49-52, claim rules for every protocol;generic_oidc/adapter.ts:99and:153, OIDC name, email and groups mappings;oauth2/adapter.ts:97and:134, the same for OAuth2.
Evidence and controls
The probe below ran in an admitted, bounded check under Node vitest (server project, pure functions). The three cases fail. The control (a nested realm_access.roles path) still resolves, and so does a SAML group rule, because groups are looked up by exact key.
Probe (uncommitted test in backend/core/enterprise_sso/)
import { describe, expect, it } from 'vitest';
import { resolveClaimPath } from './claims';
import { mapEntraRoleToPlatformRole } from './entra_id/role_mapping';
import { mapSamlIdentity } from './saml/attributes';
import type { SsoUserInfo } from './types';
const saml = (attributes: Record<string, unknown>) =>
mapSamlIdentity('[email protected]', attributes, undefined) as SsoUserInfo;
describe('claim names that contain dots', () => {
it('OIDC: reads an Auth0-style namespaced claim', () => {
const claims = { 'https://tale.example.com/roles': ['admin'] };
expect(resolveClaimPath(claims, 'https://tale.example.com/roles')).toEqual(['admin']);
});
it('SAML: a claim rule on the Microsoft role claim URI maps the role', () => {
const uri = 'http://schemas.microsoft.com/ws/2008/06/identity/claims/role';
const role = mapEntraRoleToPlatformRole(
[{ source: 'claim', claim: uri, pattern: 'Tale.Admin', targetRole: 'admin' }],
'member',
saml({ [uri]: ['Tale.Admin'] }),
);
expect(role).toBe('admin');
});
it('SAML: a claim rule on a urn:oid attribute maps the role', () => {
const oid = 'urn:oid:1.3.6.1.4.1.5923.1.1.1.1';
const role = mapEntraRoleToPlatformRole(
[{ source: 'claim', claim: oid, pattern: 'staff', targetRole: 'editor' }],
'member',
saml({ [oid]: ['staff'] }),
);
expect(role).toBe('editor');
});
it('control: nested dot-paths and SAML group rules still work', () => {
expect(resolveClaimPath({ realm_access: { roles: ['user'] } }, 'realm_access.roles')).toEqual(['user']);
const role = mapEntraRoleToPlatformRole(
[{ source: 'group', pattern: 'Finance', targetRole: 'editor' }],
'member',
saml({ 'http://schemas.microsoft.com/ws/2008/06/identity/claims/groups': ['Finance'] }),
);
expect(role).toBe('editor');
});
});Deduplication and acceptance
All 1,385 issues were searched for claim paths, claimMappings, Auth0, namespaced claims and resolveClaimPath. #1506 (closed) introduced the dot-paths. #3669 (open) is about saving OIDC settings erasing stored claim mappings, which is a different defect. No issue reports this one.
Acceptance:
- A configured claim name that exists verbatim as a top-level key is read as that key before the dot-path walk, or an escape or bracket syntax is supported and documented.
- The three cases above map, and
realm_access.roles-style nested paths keep working.
Limits: pure functions only. No identity provider, browser sign-in or database was involved.
Activity
fix(platform): read SSO claims whose names contain dots
fix(platform): read SSO claims whose names contain dots