Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking AAL attribute value differences #11817

Merged
merged 4 commits into from
Feb 4, 2025
Merged

Conversation

Sgtpluck
Copy link
Contributor

🎫 Ticket

Link to the relevant ticket:
Add tracking for AAL resolution

🛠 Summary of changes

This change:

  • Adds a method to determine the asserted AAL level via the AuthnContextResolver
  • Adds tracking in the OIDC and SAML attributes presenters in order to indicate when there is a mismatch

Note: In the OIDC code flow, this attribute is set in the authorization_form class. My hope is that once this bug is fixed, we will be able to remove that value and associated code.

Comment on lines +44 to +46
def analytics
Analytics.new(user: identity.user, request: nil, session: {}, sp: nil)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like our typical pattern is to log analytics from the controller level. is there a way that we can have this class expose an analytics_attributes or something that we can leverage from the controller? then we can attribute the right request, SP, session info as needed as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i found some examples of this pattern, so thought that it would be okay in this scenario, especially since it's a short-term event that will be removed when it's safe to implement the actual fix.

but i don't feel that strongly about it, and can try to figure out how to expose the needed data at the controller level -- just means it will have to wait until after i'm back!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think some of the context such as SP is valuable, maybe as another option we could popular sp: from that data here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i agree that we could populate sp data -- i'm not sure what "as another option" means exactly here? do you mean keeping this event in the presenter with the included data?

Copy link
Contributor

@mitchellhenke mitchellhenke Feb 3, 2025

Choose a reason for hiding this comment

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

I think the suggestion is to use identity and pass in sp: identity.service_provider or similar. In this case, it is probably less useful since we pass in client_id: service_provider.issuer, to the event itself.

Copy link
Contributor Author

@Sgtpluck Sgtpluck Feb 4, 2025

Choose a reason for hiding this comment

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

i know that the Analytics object adds some extra details if the sp value is there, so i can add it in, in case any of those details end up being useful! actually, when i look a little closer, i think that's only the case if there's also a session object. so maybe it's not that useful

Comment on lines +62 to +64
def analytics
Analytics.new(user:, request: nil, session: {}, sp: nil)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto about logging from the controller layer if possible! SAML idp controller is a mess but is there a way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is actually way messier than the OIDC code path, since the AttributeAsserter object is used in private methods in the SamlIdpAuthConcern and is comingled with methods in the SamlIdp gem so i think it's not worth it here, especially for a temporary event.

Copy link
Contributor

@lmgeorge lmgeorge left a comment

Choose a reason for hiding this comment

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

Nice work! I like the analytics stuff to track the asserted and response AAL values.

@Sgtpluck
Copy link
Contributor Author

Sgtpluck commented Feb 4, 2025

Note: I created a ticket to analyze the data in a few weeks https://gitlab.login.gov/lg-teams/Melba/protocols-backlog/-/issues/147

@Sgtpluck Sgtpluck merged commit 1bf4a74 into main Feb 4, 2025
2 checks passed
@Sgtpluck Sgtpluck deleted the dmm/default-aal-resolution branch February 4, 2025 17:52
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.

4 participants