Skip to content

feat: forward MaxMind device tracking_token to minFraud#39

Merged
mattdjenkinson merged 1 commit into
mainfrom
feat/maxmind-tracking-token
May 11, 2026
Merged

feat: forward MaxMind device tracking_token to minFraud#39
mattdjenkinson merged 1 commit into
mainfrom
feat/maxmind-tracking-token

Conversation

@mattdjenkinson
Copy link
Copy Markdown
Contributor

@mattdjenkinson mattdjenkinson commented May 11, 2026

Merge order (2 of 5)

Part of a cross-repo rollout enabling MaxMind device fingerprinting in the signup fraud check.

  1. auth-provider-zitadel — datum-cloud/zitadel-provider#109
  2. fraud (this PR) — adds device.tracking_token plumbing
  3. datum.net — datum-cloud/datum.net#1289
  4. auth-ui — datum-cloud/auth-ui#77
  5. infra — datum-cloud/infra#2412

Safe to merge in isolation; the new field is optional and an empty annotation is a no-op.


Summary

  • Add TrackingToken to provider.Input and forward it as device.tracking_token in the minFraud request body.
  • datasource.Resolver.resolveSession now reads the iam.miloapis.com/maxmind-tracking-token annotation on the latest milo Session (populated by auth-provider-zitadel from Zitadel session metadata) and populates input.TrackingToken.
  • MaxMind client builds the device block when the token is the only device-side signal present (e.g. fresh signup with no IP/UA yet).
  • Resolve logs hasTrackingToken=bool so we can spot misses in flight logs without leaking the token itself.
  • Unit tests cover both the all-fields case and a token-only input.

End-to-end the token reaches MaxMind:

auth-ui (browser) → Zitadel session metadata → milo Session annotation
  → fraud Resolver → minFraud device.tracking_token

Missing annotation is non-fatal — fraud evaluation continues with IP/email/UA signals only.

Test plan

  • go test ./internal/provider/maxmind/... ./internal/datasource/... passes.
  • Verify staging FraudEvaluation logs show device.tracking_token in the outbound minFraud body once a User is created via a session with the annotation.
  • Confirm MaxMind portal records the device-info fields on the resulting score.

JoseSzycho
JoseSzycho previously approved these changes May 11, 2026
Plumb the browser-collected MaxMind trackingToken into the minFraud
request body so the score reflects the device fingerprint captured at
signup, not just IP and email. The token rides on the milo Session
(annotation iam.miloapis.com/maxmind-tracking-token, populated by
auth-provider-zitadel from Zitadel session metadata) — device
fingerprinting is intrinsically session-scoped, not user-scoped.

Key features/changes:
- Add TrackingToken to provider.Input as an optional field
- Resolver reads the iam.miloapis.com/maxmind-tracking-token Session
  annotation on the latest session for the user and populates input
- MaxMind client adds device.tracking_token to the request body and
  builds the device block when the token is the only device-side
  signal present (e.g. session API was unavailable)
- Test coverage: assert tracking_token is sent in the all-fields
  case and that a token-only input still produces a device block
- Log resolved input with hasTrackingToken=bool to surface presence
  without leaking the token itself

Missing annotation is non-fatal — fraud evaluation continues with
the existing IP/email/UA signals from the User and Session.
@mattdjenkinson mattdjenkinson force-pushed the feat/maxmind-tracking-token branch from 3528be9 to 3512015 Compare May 11, 2026 13:32
@ecv ecv self-requested a review May 11, 2026 15:48
@mattdjenkinson mattdjenkinson merged commit 7a6b61f into main May 11, 2026
13 of 14 checks passed
@mattdjenkinson mattdjenkinson deleted the feat/maxmind-tracking-token branch May 11, 2026 15:52
@mattdjenkinson mattdjenkinson restored the feat/maxmind-tracking-token branch May 18, 2026 15:09
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