Skip to content

fix(mcp-use): redact home paths in file URIs - #600

Merged
nik13 merged 2 commits into
devfrom
fix/mcp-use-home-uri-privacy
Nov 5, 2026
Merged

nik13 merged 2 commits into
devfrom
fix/mcp-use-home-uri-privacy

Conversation

@nik13

@nik13 nik13 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Closes the MCP-use file:// home-path redaction gap that survived merged #569. The shared text scrubber now recognizes file URIs, decodes URI percent escapes and JSON-escaped slashes for path matching, and replaces sensitive filesystem URIs with [path]. It preserves non-sensitive file URIs, HTTP(S) URLs, neighboring non-home paths, and ordinary trace content.

No version, dependency range, release configuration, or merged history changes.

Why?

On current dev 3ed4a3d4abdd6133a5823875e671f4e141481659, a synthetic local model identifier file:///data/synthetic-tenant-user/models/local.gguf remained in the span name and model attributes even with TraceConfig(hide_inputs=True, hide_outputs=True). A real MCP stdio echo tool also exported a file URI in its result with content capture enabled. This demonstrates a home-directory/file-layout privacy leak, not a credential leak.

The entire implicated runtime tree was still c11874645c9a1679350dd698f8b9e5837fd6b266, identical to the independently reproduced defect before #569 merged. No existing open PR addressing this defect was found, so this is a small follow-up into dev.

How was it tested?

All execution used fresh E2B sandboxes with synthetic fixtures only; no real model account, user home, credential store, or production collector was accessed.

  • Baseline on unchanged dev: recovered original reproducer 4 failed; added regression suite 29 failed / 14 passed. Failures included real upstream SDK HTTP/SSE processing, MCP stdio agents, and decoded OTLP exports, not only direct string matching.
  • Final full package suite: 269 passed / 0 failed / 0 skipped in each of three fresh environments: Python 3.11.18 at dependency floors; Python 3.12.16 and 3.13.18 at newest compatible dependencies. Each environment separately passed the recovered original reproducer 4/4 and focused new regression suite 43/43; the 43 are also included in the 269, not additional unique cases.
  • Floor dependencies: mcp-use 1.7.1, LangChain Core 1.6.12, LangChain Anthropic 1.7.7, fi-instrumentation-otel 1.1.0. Newest: mcp-use 1.7.1, LangChain Core 1.7.6, LangChain Anthropic 1.7.10, fi-instrumentation-otel 1.2.2. Both used MCP 1.30.0, Anthropic 2.5.0, LangGraph 1.2.19, checkpoint 4.3.1, OpenTelemetry SDK 1.45.2; pip check passed.
  • Final E2B runs: cont1105-mcp-uri-green-v2-floor, cont1105-mcp-uri-green-v2-latest, cont1105-mcp-uri-green-v2-py313. All returned exit 0 and verified sandbox deletion (kill_returned=true, get_info_404=true). Installed _text.py SHA-256 in all three was 92dc8e5cc085d687f4e7ce56548c1651d6b95bfcd0ce176da713df9accc9d1fd.
  • The regression matrix covers file:/, file:///, mixed-case schemes, localhost authority, percent-encoded paths and Unicode/space-containing homes, JSON-escaped slashes, Windows drive forms, tool-output prefixes, both content-hide modes, and benign URL/sibling controls.
  • Real upstream SDK mocks exercise run, stream, and stream_events. The loopback OTLP test asserts retained parent/child relationships, model metadata, usage, ordinary content, and tool-result privacy.
  • Every cloud run records source SHA-256 hashes, exact resolved versions, JUnit XML, and sandbox kill/get-info-404 receipts. Earlier failed correction attempts remain in the evidence; no expectation was weakened.

Supported range is unchanged: Python >=3.11,<3.14, mcp-use>=1.7.1,<2, langchain-core>=1.6.12,<2, and fi-instrumentation-otel>=1.1.0. Qualification uses the declared floors and current newest compatible releases, not every possible transitive combination.

Checklist

  • Unit and integration regressions added without weakening existing expectations.
  • Conventional commit; scoped follow-up off dev, as required by CONTRIBUTING.md.
  • No real API keys or secrets in the diff.
  • Existing documented privacy behavior repaired; no new public API or configuration.
  • Independent verification and GitHub CI completion.

Notes for reviewers

GitHub CI for head c8760362bb429f7ab1d5f9c90797930cf6d6cc89 has not yet been fully verified. See the current checks; Python/Integration workflows rerun on body edits, so superseded cancelled runs are not passing results. Required human review and independent verification remain outstanding; this is not an all-green or release-ready claim.

This does not release or merge anything. Upstream MCP-use console logging is outside trace redaction, unchanged from the documented contract. Synthetic/loopback validation is not a live paid-provider test. Unrelated Strands and Java limitations are unchanged.

Generated with Claude Code

nik13 and others added 2 commits November 4, 2026 17:48
Handle URI percent encoding, JSON slash escapes and local file URI forms without changing benign URLs or ordinary tracing. Cover provider streams, stdio tools and OTLP with content enabled and hidden.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Match the complete known HOME before URI punctuation boundaries, preserving surrounding text and benign URLs. Cover literal and encoded delimiters in provider streaming and actual OTLP exports.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@nik13
nik13 merged commit a77a269 into dev Nov 5, 2026
13 checks passed
@nik13
nik13 deleted the fix/mcp-use-home-uri-privacy branch November 5, 2026 09:17
@nik13 nik13 mentioned this pull request Nov 5, 2026
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.

1 participant