Summary
app.module.ts applies geolocation enrichment globally:
consumer.apply(GeolocationMiddleware).forRoutes('*');
This means every request pays a geoip-lite lookup, including:
/health (hit continuously by load balancers and referenced by the graceful-shutdown probe in main.ts),
/api Swagger document routes,
- all pre-auth
auth/* traffic.
Infrastructure probes get geolocation side effects for IPs that will never be users, and the lookup cost lands on the hottest paths.
Proposal
- Exclude infrastructure paths:
consumer.apply(GeolocationMiddleware)
.exclude('health', 'api/(.*)')
.forRoutes('*');
- Audit what consumes the enriched fields downstream (the analytics module recently gained PII hashing in event metadata - confirm country/city granularity is intentional there).
- Add unit tests mirroring the style used for
CorrelationIdMiddleware, including exclusion cases.
Acceptance criteria
Summary
app.module.tsapplies geolocation enrichment globally:This means every request pays a
geoip-litelookup, including:/health(hit continuously by load balancers and referenced by the graceful-shutdown probe inmain.ts),/apiSwagger document routes,auth/*traffic.Infrastructure probes get geolocation side effects for IPs that will never be users, and the lookup cost lands on the hottest paths.
Proposal
CorrelationIdMiddleware, including exclusion cases.Acceptance criteria