Add request trace classification and pseudonymous ids - #203
cdgamarose-nv merged 5 commits into
Conversation
Greptile SummaryThis PR adds always-on request classification tags ( The implementation is generally clean, but two P2 concerns are worth addressing before relying on the privacy properties in production:
Confidence Score: 5/5Safe to merge; findings are P2 quality-of-life and documentation gaps, not runtime defects. All findings are P2: a missing warning log on shared-secret fallback and an undocumented trusted-proxy dependency for X-Forwarded-For IP extraction. No data loss, auth bypass, or correctness bugs were identified. frontends/aiq_api/src/aiq_api/auth/utils.py — shared secret fallback and IP header trust model. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant UI as Next.js UI Proxy
participant MW as AuthMiddleware
participant Utils as auth/utils.py
participant Tracer as DD/OTEL Tracer
Client->>UI: HTTP request
UI->>MW: Forward + X-AIQ-Access-Channel: ui
MW->>MW: resolve_request_user()
MW->>Utils: attach_request_to_active_trace(headers, scope, user, ...)
Utils->>Utils: _build_common_trace_tags() → caller.type, transport, verified, channel
Utils->>Utils: _build_trace_user_tags() → enduser.id (HMAC) if mode≠none
Utils->>Utils: _build_pseudonymous_trace_client_id() if client_id_mode=ip
Utils->>Tracer: _tag_current_ddtrace_span(tags)
Utils->>Tracer: _tag_current_otel_span(tags)
MW->>MW: user_context(user) → call downstream app
Reviews (5): Last reviewed commit: "restrict access channel overrides" | Re-trigger Greptile |
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
a411dac to
862c491
Compare
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
|
Do we need to add the placeholder variables to Also, nitpick but the |
|
But otherwise, looks good to me |
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
|
@cdgamarose-nv good suggestions, update .env.example and refactored to add utils.py |
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
…prints#203) * add request trace classification and pseudonymous ids Signed-off-by: Ajay Thorve <athorve@nvidia.com> * harden trace user tagging guards Signed-off-by: Ajay Thorve <athorve@nvidia.com> * document trace env examples Signed-off-by: Ajay Thorve <athorve@nvidia.com> * extract auth trace helpers into utils Signed-off-by: Ajay Thorve <athorve@nvidia.com> * restrict access channel overrides Signed-off-by: Ajay Thorve <athorve@nvidia.com> --------- Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Summary
Testing