SAML: Multi-valued attributes only capture first value (e.g., groups claim)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- go
- Domain
- authentication
Research direction
The issue does not name a file or test; start at the SAML Attribute parsing entry point and reproduce the Azure AD assertion with multiple AttributeValue elements. Verify the resulting custom_claims.groups value and add coverage showing that multiple values are retained as an array while single values remain supported.
Written by the indexing model from the issue text.
Description
Bug Report
Describe the bug
When using SAML 2.0 SSO with an identity provider that sends multi-valued attributes (e.g., Azure AD groups claim), Supabase Auth/gotrue only captures the first <AttributeValue> element and stores it as a string, instead of collecting all values into an array.
To Reproduce
- Configure Azure AD (Microsoft Entra ID) as a SAML 2.0 identity provider
- Enable groups claim in Azure AD with user assigned to multiple groups
- Configure attribute mapping in Supabase to capture groups:
{ "keys": { "groups": { "name": "http://schemas.microsoft.com/ws/2008/06/identity/claims/groups" } } } - Sign in via SSO
- Check
auth.users.raw_user_meta_data.custom_claims.groups
Expected behavior
When Azure AD sends:
<Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/groups">
<AttributeValue>0b430838-9034-454d-ab07-43f8e1b9ff1d</AttributeValue>
<AttributeValue>6e7a4320-6f27-417f-b51d-b9720f537f3d</AttributeValue>
</Attribute>
Supabase should store:
{
"custom_claims": {
"groups": ["0b430838-9034-454d-ab07-43f8e1b9ff1d", "6e7a4320-6f27-417f-b51d-b9720f537f3d"]
}
}
Actual behavior
Supabase stores only the first value as a string:
{
"custom_claims": {
"groups": "0b430838-9034-454d-ab07-43f8e1b9ff1d"
}
}
Evidence
Raw SAML assertion from Azure AD (captured via SAML-tracer):
<AttributeStatement>
<Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/groups">
<AttributeValue>0b430838-9034-454d-ab07-43f8e1b9ff1d</AttributeValue>
<AttributeValue>6e7a4320-6f27-417f-b51d-b9720f537f3d</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/role">
<AttributeValue>ASG-Wiki-Admin</AttributeValue>
<AttributeValue>ASG-Wiki-Owner</AttributeValue>
</Attribute>
</AttributeStatement>
Database query result:
SELECT raw_user_meta_data->'custom_claims'->'groups' as groups_claim,
jsonb_typeof(raw_user_meta_data->'custom_claims'->'groups') as groups_type
FROM auth.users WHERE email = 'user@example.com';
Returns:
groups_claim: "0b430838-9034-454d-ab07-43f8e1b9ff1d"
groups_type: "string"
Configurations tried (all failed)
- Standard groups claim (
http://schemas.microsoft.com/ws/2008/06/identity/claims/groups) - "Emit groups as role claims" (
http://schemas.microsoft.com/ws/2008/06/identity/claims/role) - Various Azure AD
groupMembershipClaimssettings (All,SecurityGroup,ApplicationGroup) - "Expose claim in JWT tokens in addition to SAML tokens" option
Environment
- Supabase Cloud (hosted)
- Identity Provider: Microsoft Entra ID (Azure AD)
- Protocol: SAML 2.0
Impact
Organizations cannot sync multiple IdP group memberships via SSO, breaking role-based access control workflows where users belong to multiple groups. This is a common enterprise requirement.
Suggested Fix
When parsing SAML <Attribute> elements, if there are multiple <AttributeValue> children, collect them into an array instead of taking only the first value.
- Dominant language
- Go
- Stars
- 2.6k
- Forks
- 764
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/auth
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100