Skip to content

Conversation

@tvernum
Copy link
Contributor

@tvernum tvernum commented Jul 14, 2025

Sometimes SAML IdPs send what should be a list of values as a single comma-separated string.

That is, we expect something using SAML's multi-valued attribute feature:

<saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
   Name="http://idp.example.org/attributes/groups" FriendlyName="groups">
   <saml:AttributeValue>engineering</saml:AttributeValue>
   <saml:AttributeValue>elasticsearch-admins</saml:AttributeValue>
   <saml:AttributeValue>employees</saml:AttributeValue>
</saml:Attribute>

but we get

<saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
   Name="http://idp.example.org/attributes/groups" FriendlyName="groups">
   <saml:AttributeValue>engineering,elasticsearch-admins,employees</saml:AttributeValue>
</saml:Attribute>

In order to help detect these cases, this commit changes the toString() on SamlAttribute to include the length (e.g. (len=1)) at the end

Relates: #84379, #102769

Sometimes SAML IdPs send what _should_ be a list of values as a single
comma-separated string.

That is, we expect something using SAML's multi-valued attribute
feature:

    <saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
       Name="http://idp.example.org/attributes/groups" FriendlyName="groups">
       <saml:AttributeValue>engineering</saml:AttributeValue>
       <saml:AttributeValue>elasticsearch-admins</saml:AttributeValue>
       <saml:AttributeValue>employees</saml:AttributeValue>
    </saml:Attribute>

but we get

    <saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
       Name="http://idp.example.org/attributes/groups" FriendlyName="groups">
       <saml:AttributeValue>engineering,elasticsearch-admins,employees</saml:AttributeValue>
    </saml:Attribute>

In order to help detect these cases, this commit changes the
`toString()` on `SamlAttribute` to include the length (e.g. `(len=1)`)
at the end

Relates: elastic#84379, elastic#102769
@tvernum tvernum requested a review from ankit--sethi July 14, 2025 02:41
@tvernum tvernum added >enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v9.2.0 labels Jul 14, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label Jul 14, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@elasticsearchmachine
Copy link
Collaborator

Hi @tvernum, I've created a changelog YAML for you.

@tvernum
Copy link
Contributor Author

tvernum commented Jul 16, 2025

Ping @ankit--sethi

@tvernum tvernum enabled auto-merge (squash) July 16, 2025 02:14
@tvernum tvernum merged commit dc48b4b into elastic:main Jul 16, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants