Skip to content

Ignore unknown authncontext#11362

Merged
Sgtpluck merged 12 commits intomainfrom
dmm/ignore-unknown-authncontext
Oct 22, 2024
Merged

Ignore unknown authncontext#11362
Sgtpluck merged 12 commits intomainfrom
dmm/ignore-unknown-authncontext

Conversation

@Sgtpluck
Copy link
Contributor

@Sgtpluck Sgtpluck commented Oct 18, 2024

🎫 Ticket

Link to the relevant ticket:
Ignore unknown authentication contexts
Link to 1-pager

🛠 Summary of changes

This change updates our SAML integration to allow and ignore unknown authentication context class reference (ACR) values that are sent via the request, as long as there is at least one valid AuthnContext value that we can assert. (OIDC already allowed arbitrary values to be passed in.)

SAML spec line 1820

If Comparison is set to "exact" or omitted, then the resulting authentication context in the authentication
statement MUST be the exact match of at least one of the authentication contexts specified.

This change also:

  • Includes any unknown ACR values in authentication events
  • Adds/updates associated tests

Open questions:
I am currently handling the case of a partner passing in only unknown ACR values as invalid.

However, we do allow SAML partners to pass in no ACR values, in which case we use their service provider defaults, so an argument could be made that if we get only unknown ACR values, we should default to the SP's defaults.

My thinking is that if they are purposefully sending ACR values, that should override any defaults we have -- if they are only sending one, unknown ACR values that is more likely a mistake. Am open to arguments in favor/against this approach!

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

@Sgtpluck Sgtpluck requested review from a team and jmhooper October 21, 2024 15:53
end
end

def raise_unsupported_component_exception(component_value_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remark here that this may be a deviation from the spec since we are accepting vectors we do not recognize that are not described by our trustmark. However, that may not be a huge deal since this API should be going away soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for that note! i could probably update it to only raise when vectors of trust are passed in, if you have any feelings about it! (although i think we are deviating from the spec in some ways anyways, like having implied vectors, and as you said, it's hopefully not long for our code base.)

Comment on lines +237 to +240
(requested_authn_contexts -
Saml::Idp::Constants::VALID_AUTHN_CONTEXTS).reject do |authn_context|
authn_context.match(req_attrs_regexp)
end.join(' ').presence
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is kinda funky here, WDYT of breaking this out into a variable?

Suggested change
(requested_authn_contexts -
Saml::Idp::Constants::VALID_AUTHN_CONTEXTS).reject do |authn_context|
authn_context.match(req_attrs_regexp)
end.join(' ').presence
unmatched_contexts = Saml::Idp::Constants::VALID_AUTHN_CONTEXTS).reject do |authn_context|
authn_context.match(req_attrs_regexp)
end
(requested_authn_contexts - unmatched_contexts).join(' ').presence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! updated in 52a697b (i pulled it into a separate method to make it easier to read)

Copy link
Contributor

@ajfarkas ajfarkas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a Login-wide position on whether we primarily focus on Partners (ie, breaking errors when they pass invalid values, with the assumption they test their integrations), or on End Users (ie, be as forgiving as possible with integrations within the bounds of the relevant specifications).
These kinds of questions pop up constantly.

IdentityConfig.store.use_vot_in_sp_requests
end
authn_contexts.all? do |classref|
# SAML requests are allowed to "default" to the integration's IAL default.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

Copy link
Contributor

@nprimak nprimak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some very minor nitpicks, otherwise LGTM! Always excited to help unblock partners.

Sgtpluck and others added 2 commits October 22, 2024 08:10
Co-authored-by: Nadya Primak <nadya.primak@gsa.gov>
Co-authored-by: Nadya Primak <nadya.primak@gsa.gov>
@Sgtpluck Sgtpluck merged commit 21455dc into main Oct 22, 2024
@Sgtpluck Sgtpluck deleted the dmm/ignore-unknown-authncontext branch October 22, 2024 17:07
Sgtpluck added a commit that referenced this pull request Oct 24, 2024
Sgtpluck added a commit that referenced this pull request Oct 24, 2024
Sgtpluck added a commit that referenced this pull request Oct 24, 2024
changelog: User-Facing Improvements, Integration Experience, Allowing and ignoring unknown authn_context values
Sgtpluck added a commit that referenced this pull request Oct 25, 2024
changelog: User-Facing Improvements, Integration Experience, Allowing and ignoring unknown authn_context values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants