fix(p1-12): redact exception text in deprecated AUTOSEARCH_LEGACY_RESEARCH path#434
fix(p1-12): redact exception text in deprecated AUTOSEARCH_LEGACY_RESEARCH path#434
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughError handling in the MCP Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR addresses a secrets-leak risk in the deprecated MCP research() legacy path (enabled via AUTOSEARCH_LEGACY_RESEARCH=1) by ensuring exception text is redacted before being returned to MCP clients.
Changes:
- Redact exception strings returned from the legacy
research()MCP tool error response. - Add a unit test to ensure secret-shaped tokens in legacy
research()exceptions are replaced with[REDACTED].
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| autosearch/mcp/server.py | Wraps legacy research() exception content with redact() before returning the MCP response. |
| tests/unit/test_research_deprecation.py | Adds coverage asserting legacy research() error responses do not include secret-shaped substrings. |
…d pipeline factory classes
Summary
P1 fix for
reports/autosearch-p0-fix-plan.md§12 —autosearch/mcp/server.pylegacyresearch()tool path (gated onAUTOSEARCH_LEGACY_RESEARCH=1) emitted raw exception text in MCP responses. Same risk as the CLI top-level path (F013): secrets in exception messages leak to MCP clients.Changes
mcp/server.pylegacy_research branch: wrap exception text viaredact()before returning to MCP client.test_legacy_research_exception_redactedverifying secret patterns are stripped.Plan
docs/exec-plans/active/autosearch-0426-p0-fix-plan-execution.md§ F014 (S1-S2).Commits
Test plan
pytest tests/unit/test_research_deprecation.py tests/unit/test_mcp_error_redaction.py— 7 passedpytest tests/unit/ -m "not real_llm and not slow and not network"— 674 passed, 3 skipped🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests