Add security setting to more strictly enforce audience validation #622
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
READY
Migrations
NO
Description
Per the SAML 2.0 Core specification, Section 2.5.1.4, a service provider should expect SAML responses to include an
<AudienceRestriction>
element containing an<Audience>
element with a URI reference that uniquely identifies the service provider.Ruby SAML contains logic to validate that responses contain an
<Audience>
element matchingsettings.sp_entity_id
. However, if the<AudienceRestriction>
contains only empty<Audience>
elements, Ruby SAML skips that validation per #444. It seems incorrect that we'd consider a response with a non-empty<Audience>
element not matchingsettings.sp_entity_id
to be invalid, but we'd consider a response with an empty<Audience>
element (which also wouldn't matchsettings.sp_entity_id
) to be valid.This PR adds a new security option that will consider SAML responses containing only empty
<Audience>
elements to be invalid. By default, this option is not enabled, so it should not be a breaking change.