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

Allow user_presence param in AuthenticatorResponse#verify to override silent_authentication config #434

Merged
merged 5 commits into from
Oct 18, 2024

Conversation

santiagorodriguez96
Copy link
Contributor

@santiagorodriguez96 santiagorodriguez96 commented Oct 18, 2024

Motivation

After #432 was merged it is possible to call AuthenticatorResponse#verify with user_presence being true while having enabled silent_authentication for the Relying Party and the method would not verify user presence which it can be confusing for users.

Details

This PR changes this behavior so that the user_presence param, when passed, will always override the silent_authentication config.

@@ -35,7 +35,8 @@ def verify(expected_challenge, expected_origin = nil, user_presence: true, user_
verify_item(:authenticator_data)
verify_item(:rp_id, rp_id || rp_id_from_origin(expected_origin))

if !relying_party.silent_authentication && user_presence
user_presence = !relying_party.silent_authentication if user_presence.nil?
Copy link
Member

Choose a reason for hiding this comment

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

I think I would do:

# Fallback to RP configuration unless user_presence is passed in explicitely
if user_presence.nil? && !relying_party.silent_authentication || user_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.

Updated in 74daca7!

Copy link
Member

@brauliomartinezlm brauliomartinezlm left a comment

Choose a reason for hiding this comment

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

Great work @santiagorodriguez96 👏
Thank you for handling this.

@santiagorodriguez96 santiagorodriguez96 merged commit b12bc58 into master Oct 18, 2024
9 checks passed
@santiagorodriguez96 santiagorodriguez96 deleted the sr--skip-user-presence branch October 18, 2024 19:36
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.

2 participants