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

LG-14198: AAGUID logging #11138

Merged
merged 10 commits into from
Sep 3, 2024
Merged

Conversation

mdiarra3
Copy link
Member

@mdiarra3 mdiarra3 commented Aug 22, 2024

🎫 Ticket

Link to the relevant ticket:
LG-14198

🛠 Summary of changes

This will add aaguid to the webauthn configuration, this will allow us to keep track of what kind of devices are used to create passkeys.

*note it seems like we dont have a way to check this in verification ,and also aaguid is nil for security keys right now, but Fido seems to imply that that shouldnt be?

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

I'd expect we'd do this entirely on the backend without any JavaScript, because we're already sending authenticator data (through attestationObject), which is available for us to access through the webauthn-ruby gem.

@mdiarra3 mdiarra3 marked this pull request as ready for review August 26, 2024 16:51
@mdiarra3 mdiarra3 requested review from aduth and a team August 26, 2024 20:53
Copy link
Member

@aduth aduth Aug 27, 2024

Choose a reason for hiding this comment

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

This migration will need to happen in a separate deploy to avoid 50/50 state issues.

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 that part of that guide is for a field that is expected to be backfilled

AFAICT this PR is OK because we're writing to the column but not reading from it. And the boxes that spin up and write to the column will have the correct code, and the migration completed, and the old boxes that don't know about the field will ignore it

Copy link
Member

Choose a reason for hiding this comment

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

Okay, that makes sense. Part of the ticket is to include the database value in authentication attempts, where I'd expect we'd be reading from the record. Need more clarity on the issues raised in #11138 (comment) .

Copy link
Member Author

Choose a reason for hiding this comment

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

okay ill make a separate pr since im reading from it now. with just the migration.

@aduth
Copy link
Member

aduth commented Aug 27, 2024

note it seems like we dont have a way to check this in verification

Can you elaborate on what you mean by this?

@aduth
Copy link
Member

aduth commented Aug 27, 2024

.aaguid is nil for security keys right now

Interesting, I'm seeing the same when testing on other debugging sites [1] [2] as well, so I assume it's expected.

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Works in my testing 👍 Left a couple comments. We'll want to make sure the migration is already ran in production before merging this.

@@ -110,6 +110,7 @@ def valid_attestation_response?(protocol)
)

begin
@aaguid = attestation_response.authenticator_data.aaguid
Copy link
Member

Choose a reason for hiding this comment

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

Couple minor comments:

  • If we're not expecting this to raise an exception, I think it'd be best to limit the rescue'd begin block to code which is expected to raise.
  • Assigning it as a side-effect of validation feels like it creates a fragile relationship between assignment and use. Since we have attestation_response as a consumed parameter in submit and the value is derived from that, we could create a method which derives directly from that and avoids another instance variable.
def aaguid
  attestation_response&.authenticator_data&.aaguid
end

@@ -172,6 +174,7 @@ def extra_analytics_attributes
pii_like_keypaths: [[:mfa_method_counts, :phone]],
authenticator_data_flags: authenticator_data_flags,
unknown_transports: invalid_transports.presence,
aaguid: aaguid,
Copy link
Member

Choose a reason for hiding this comment

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

Can we add corresponding YARDoc updates for method documentation in analytics_events.rb?

I would have also expected this to be enforced by UndocumentedParamsChecker and fail the build, which makes me worried we might not have full coverage for the code which would log this event.

@mdiarra3
Copy link
Member Author

note it seems like we dont have a way to check this in verification

Can you elaborate on what you mean by this?

Looking at this aaguid throws an error when I attempt to call for it in webauthn verification form. I think this is due to https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data#attestedcredentialdata, we are verifying the credentials and thus aaguid doesnt exist and throws a formating error.

@aduth
Copy link
Member

aduth commented Aug 27, 2024

note it seems like we dont have a way to check this in verification

Can you elaborate on what you mean by this?

Looking at this aaguid throws an error when I attempt to call for it in webauthn verification form. I think this is due to https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data#attestedcredentialdata, we are verifying the credentials and thus aaguid doesnt exist and throws a formating error.

Oh, I was expecting that we'd log the value from the database record, not what's given to us from the client-side authentication.

@mdiarra3
Copy link
Member Author

note it seems like we dont have a way to check this in verification

Can you elaborate on what you mean by this?

Looking at this aaguid throws an error when I attempt to call for it in webauthn verification form. I think this is due to https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data#attestedcredentialdata, we are verifying the credentials and thus aaguid doesnt exist and throws a formating error.

Oh, I was expecting that we'd log the value from the database record, not what's given to us from the client-side authentication.

Ah got you. I have no problem with that

@mdiarra3 mdiarra3 force-pushed the LG-14198-store-aaguid-in-webauthn-configuration branch from f07d030 to eb1209e Compare August 28, 2024 18:31
@mdiarra3 mdiarra3 mentioned this pull request Aug 29, 2024
@mdiarra3 mdiarra3 merged commit e82d6c9 into main Sep 3, 2024
2 checks passed
@mdiarra3 mdiarra3 deleted the LG-14198-store-aaguid-in-webauthn-configuration branch September 3, 2024 14:38
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.

3 participants