Skip to content

fix(config): redact URL secrets structurally via the url crate#305

Merged
mfw78 merged 1 commit into
developfrom
fix/44-redact-url-secrets
Jul 9, 2026
Merged

fix(config): redact URL secrets structurally via the url crate#305
mfw78 merged 1 commit into
developfrom
fix/44-redact-url-secrets

Conversation

@mfw78

@mfw78 mfw78 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

Replace the hand-rolled path-segment redact_url heuristic with a structural redactor built on the url crate. It blanks userinfo, query strings, fragments, and long API-key path segments before an RPC url reaches a log line.

Why

Closes #44

The previous heuristic only split on / and rewrote long path segments, so it leaked secrets that do not live in the path: a bare query flag (?token), a ?key=secret query value, and a #fragment bearer token all sailed through untouched. Parsing with url::Url and clearing each credential-bearing component closes those gaps, and an unparseable url now yields a <unparseable-url> placeholder rather than being logged verbatim.

Credit to @jean-neiverth, who raised #44 (originally via #163).

Testing

cargo test -p nexum-runtime --lib redact (9 cases: userinfo, query value, bare ?token flag, #fragment, @-in-path, long path segment -> KEY, clean url intact, unparseable -> placeholder).
cargo clippy -p nexum-runtime --all-targets -- -D warnings, cargo fmt --all.

AI Assistance

AI Assistance: Claude (Opus) used for extracting the redactor and its tests, and drafting this PR.

@mfw78 mfw78 merged commit 79985b4 into develop Jul 9, 2026
11 checks passed
@mfw78 mfw78 deleted the fix/44-redact-url-secrets branch July 9, 2026 13:37
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.

config: redact RPC secrets for non-standard URL shapes

1 participant