Conversation
3f5df3a to
b48e9d3
Compare
83ad72d to
022df58
Compare
…urity events Because: * We need to differentiate traffic by oauth client ID and service, as Fx currently uses the same client ID across multiple in-browser services This commit: * Creates @fxa/accounts/oauth shared lib with OAuthNativeClients and OAuthNativeServices enums (moved from fxa-settings) to validate tags and prevent infinite cardinality * Adds clientId/service tags to the url_request timing metric and all StatsD calls in user-flow routes (account, password, session, totp, mfa, passwordless, recovery-phone, oauth) * Adds client_id and service to security events via the existing additionalInfo JSON column closes FXA-13225
vbudhram
approved these changes
Mar 19, 2026
| utmSource?: string; | ||
| utmTerm?: string; | ||
| clientId?: string; | ||
| service?: string; |
| additionalInfo: { | ||
| userAgent: opts?.request.headers['user-agent'], | ||
| location: opts?.request.app.geo.location, | ||
| ...(clientId && { client_id: clientId }), |
Contributor
There was a problem hiding this comment.
Glad we are using additionalInfo!
Contributor
There was a problem hiding this comment.
I would be nice to update the tests to verify entries are added but meh.
| const hasLinkedAccount = (account.linkedAccounts?.length || 0) > 0; | ||
| const isExistingPasswordless = account.verifierSetAt === 0 && !hasLinkedAccount; | ||
| result.passwordlessSupported = isExistingPasswordless || | ||
| const isExistingPasswordless = |
Contributor
There was a problem hiding this comment.
Hm wonder if we have different prettier settings.
Contributor
|
Just noting here that this will only register for these clients https://mozilla-hub.atlassian.net/browse/FXA-13225?focusedCommentId=1306114, not all clients since that can make the statsd have a high cardinality. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Because:
This commit:
closes FXA-13225
--
Verify the security event table changes by logging in, signing up etc. through Sync or another service (or RP to just capture the client IDs), and checking the security events table locally to see
additionalInfopopulated.I threw this in temporarily:
And I see the events coming into Sentry locally, filterable by service or client ID. You can see them if you filer in Sentry by local env.