feat: Add clientid to add-clientid-to-securityevents#20138
feat: Add clientid to add-clientid-to-securityevents#20138
Conversation
There was a problem hiding this comment.
Pull request overview
Adds optional client_id attribution to recorded security events so logs/metrics can be correlated with relying parties when the originating service is known and allowed.
Changes:
- Extend
recordSecurityEventto extractservicefrom request payload/query, validate it against an allowlist (or legacy"sync"), and include it asadditionalInfo.client_id. - Emit
client_idas a StatsD tag forAccountEventsManager.recordSecurityEventwrite/error metrics when present. - Add/update local tests to cover
client_idinclusion/exclusion behavior and metric tagging.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/fxa-auth-server/lib/routes/utils/security-event.ts | Extracts/validates service and attaches client_id into security event additionalInfo. |
| packages/fxa-auth-server/lib/account-events.ts | Adds optional client_id to security event additionalInfo type and tags StatsD metrics with it. |
| packages/fxa-auth-server/test/local/routes/utils/security-event.ts | Adds unit tests for recordSecurityEvent client_id allowlist behavior and request source precedence. |
| packages/fxa-auth-server/test/local/account-events.js | Updates/adds tests asserting StatsD tagging behavior for security events with/without client_id. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a115d65 to
20da018
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d166d39 to
151ac46
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
151ac46 to
bc3c3b0
Compare
Because: * It would be helpful to see relying parties associated with logs This commit: * Adds the client id when it is available
bc3c3b0 to
9321dee
Compare
|
@clouserw Do you just want this info on security events and statsd metrics reported from security events? Or do you want client_id on logs and statsd metrics in general? |
|
@dschom I don't remember opening this PR 😬 I thought we filed an issue. But yes, everywhere would be ideal but anything is better than nothing. |
|
yeah, the real fix for this is #20213 . closing |
Because:
This commit: