metrics: sanitize RPC URLs before recording latency labels#103
metrics: sanitize RPC URLs before recording latency labels#103
Conversation
Strip userinfo and query, redact path segments that look like API keys, and apply sanitization inside RecordRequest so Prometheus and OpenTelemetry never receive full credentials. Add synthetic table tests mirroring common provider URL shapes and an optional RPC_URL_SANITIZE_FIXTURES env-driven test for local validation without committing secrets.
|
👋 guandali, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
📊 API Diff Results
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33eebb506a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !isOpaqueURLPathToken(seg) { | ||
| return false |
There was a problem hiding this comment.
Redact base64-style API key path segments
The sensitive-segment detector returns early unless the segment is strictly alphanumeric plus -/_, so path tokens containing common credential characters like + or = are treated as non-sensitive and exported unchanged. In environments where an RPC provider uses base64/base64-like keys in the URL path, RecordRequest will still emit full credentials into Prometheus and OpenTelemetry labels, which defeats the security goal of this change.
Useful? React with 👍 / 👎.
Strip userinfo and query, redact path segments that look like API keys, and apply sanitization inside RecordRequest so Prometheus and OpenTelemetry never receive full credentials. Add synthetic table tests mirroring common provider URL shapes.
Description
Requires Dependencies
Resolves Dependencies