Skip to content

fix(web): redact malformed URL secrets in MCP validator#542

Merged
JSONbored merged 3 commits into
mainfrom
codex/propose-fix-for-mcp-url-redaction-issue
May 28, 2026
Merged

fix(web): redact malformed URL secrets in MCP validator#542
JSONbored merged 3 commits into
mainfrom
codex/propose-fix-for-mcp-url-redaction-issue

Conversation

@JSONbored
Copy link
Copy Markdown
Owner

Motivation

  • Fix a regression where malformed url strings or URL-like args were returned unchanged by redactUrlValue() and could leak recognizable secrets into reportText and fixedConfigText.

Description

  • Change redactUrlValue() to fall back to redactEnvValue("url", value) when new URL(value) throws so malformed URL-like values are still subject to generic secret-pattern redaction.
  • Ensure the fallback reports a non-zero redactedCount when the fallback actually redacts content.
  • Add a regression test it("redacts malformed URL-like values that contain secrets") in tests/mcp-config-validator.test.ts that exercises a malformed top-level url and a malformed URL-like args entry.
  • Preserve existing behavior for valid URLs and URL parsing paths so previously-covered cases remain redacted via the URL-specific logic.

Testing

  • Ran pnpm exec vitest run tests/mcp-config-validator.test.ts and all tests passed (12 tests).
  • Ran git diff --check to validate whitespace/formatting and it reported no issues.

Codex Task

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@JSONbored, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f8acac06-d094-4798-ab69-de15bebfc934

📥 Commits

Reviewing files that changed from the base of the PR and between b990a4f and e23eecc.

📒 Files selected for processing (2)
  • apps/web/src/lib/mcp-config-validator.ts
  • tests/mcp-config-validator.test.ts
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/propose-fix-for-mcp-url-redaction-issue

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 and usage tips.

@JSONbored JSONbored self-assigned this May 27, 2026
@JSONbored JSONbored added the bug Something isn't working label May 27, 2026
@JSONbored JSONbored merged commit aace540 into main May 28, 2026
20 of 21 checks passed
@JSONbored JSONbored deleted the codex/propose-fix-for-mcp-url-redaction-issue branch May 28, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant