GeezerVison is showing github.com — mcpx(logging): keep keyword-pair URL values readable in Redact (#2463) by dezren39 · Pull Request #2833 · developing-today/code
Conversation
dezren39
commented
Oct 30, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #2463 — PR #1737's Redact mangled URL values carried under a sensitive keyword.
The bug
sensitiveValue's keyword-pair alternative matches a whole KEY=VALUE token before the URL-userinfo alternative can run. The replacement func then applied the userinfo reconstruction to that pair match: it truncated at the first colon after :// — the port colon of a credential-free URL — producing a fabricated <elided>@ and dropping host/port/path:
AUTH_URL=https://auth.example.com:8443/callback → AUTH_URL=https://auth.example.com:<elided>@
TOKEN_URL=https://deploy:[email protected]:8443/path → TOKEN_URL=https://deploy:<elided>@ (host/port/path lost)
The fix
The replacement func now decides URL-containing matches by shape (redactURLMatch in internal/logging/trace.go): it locates the scheme, preserves any pair prefix (KEY= / KEY:) or bearer lead-in, and then — no userinfo, or userinfo without a password → the URL is credential-free and kept verbatim; userinfo with a password → only the password is elided, keeping scheme, user, host, port and path. The userinfo reconstruction now applies only to userinfo-shaped matches, as #2463's acceptance requires. No regex changes; whole-value elision for sensitive names is untouched; no generic high-entropy detection added (out of scope per #1710).
Tests
- Codex P1 (head
84be0e32): keeping a keyword-pair URL readable must not keep a secret with it. The preserved URL is scanned for credentials of its own — credentialInURL (bearer tokens, token literals) applies to the path, credentialInQuery (KEY=VALUE pairs) applies only from the ?/# separator so auth.example.com:8443 is not read as a pair. AUTH_URL=https://example.com/callback?token=abc123 records as AUTH_URL=https://example.com/callback?token=<elided>. The credential shapes are spelled once as constants and composed into sensitiveValue, credentialInURL and credentialInQuery, so the pair keywords cannot drift between them; pinned in the same test.
- New
TestRedactKeywordPairURLValues pins all four shapes (ported credential-free URL, user-only userinfo, password userinfo under a keyword, pair in surrounding context) — reproduced failing 4/4 on main with exactly the mangled outputs mcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — port printed as an elided password, rest of URL dropped #2463 reported, now passing.
- Full
go test ./internal/logging/ green on the laptop, including every PR mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 regression (TestRedactElidesFullJWTAndReconciledKeywords, TestRedactURLUserinfoKeepsTheRestOfTheURL, …). CI runs the same package suite.
Queue task 3683 · repo-worker-code Lane A.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 30, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 7 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
49d816b9-c8fe-4453-bb35-91074471dfe8
Commits
-
Reviewing files that changed from the base of the PR and between dc9b117 and 84be0e3.
Files selected for processing: 2
-
pkgs/mcpx/internal/logging/redact_test.go
pkgs/mcpx/internal/logging/trace.go
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-30T21:47:37.918120Z |
84be0e3 |
New commits |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0fa59dfb34
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+261
to
+263
|
|
if at < 0 {
|
|
|
// No userinfo: nothing in this URL is a credential.
|
|
|
return m, true
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redact recognized credentials within preserved URL values
When a keyword-pair URL contains a recognized credential in its query or path, this return bypasses redaction of that credential. For example, Redact("MCPX_SCRIPT_ENV", "AUTH_URL=https://example.com/callback?token=abc123") now returns the input verbatim, whereas the previous implementation returned AUTH_URL=<elided>. Because the keyword-pair regex consumes the entire URL, ReplaceAllStringFunc never separately examines the nested token=abc123 match, exposing it in recorded environment metadata. Preserve URL readability while still redacting recognized credentials within it, and cover this permutation with a regression test.
AGENTS.md reference: pkgs/mcpx/internal/AGENTS.md:L9-L10
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 84be0e32. The preserved URL is now scanned for credentials of its own: credentialInURL (bearer tokens and token literals) applies to the path, and credentialInQuery (KEY=VALUE pairs) applies only from the ?/# separator onward, so a hostname such as auth.example.com:8443 is not mistaken for a pair. AUTH_URL=https://example.com/callback?token=abc123 now records as AUTH_URL=https://example.com/callback?token=<elided> — the URL context survives, the credential does not. Pinned in TestRedactKeywordPairURLValues alongside the path-literal case. The credential shapes are spelled once as constants and composed into all three matchers, so the pair keywords cannot drift between Redact and the nested scan.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Keeping a keyword-pair URL readable must not keep a secret with it: a
token pair in its query, or a token literal in its path, is elided now
while the URL context survives. The credential shapes are spelled once
and composed into every matcher so they cannot drift apart.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|