Skip to content

fix: escape qdrant-find entry fields - #183

Closed
mikemikimike wants to merge 2 commits into
qdrant:masterfrom
mikemikimike:fix/179-escape-find-output
Closed

fix: escape qdrant-find entry fields#183
mikemikimike wants to merge 2 commits into
qdrant:masterfrom
mikemikimike:fix/179-escape-find-output

Conversation

@mikemikimike

@mikemikimike mikemikimike commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Fixes #179.

Stored content and metadata are interpolated directly into the XML-like response returned by qdrant-find. If either value contains structural tags such as </content><metadata>, the response becomes ambiguous and a consumer cannot reliably distinguish stored values from the server-generated boundaries.

This change:

  • escapes &, <, and > in content and serialized metadata before interpolation;
  • preserves the existing <entry>, <content>, and <metadata> response structure;
  • adds parameterized offline regression coverage for plain text, &/</>, metadata=None, nested JSON metadata, and injected structural tags.

The formatter is a pure transformation: it does not mutate entries, shared state, or connector state, so the fix introduces no new race or partial-update path.

Verification

  • uv run --frozen pytest tests/test_mcp_server.py -q — 3 passed
  • uv run --frozen ruff format --check . — passed
  • uv run --frozen ruff check . — passed
  • git diff --check — passed
  • uv run --frozen pytest -q — interrupted after more than 70 seconds without output while entering the integration path; no failure was reported before interruption
  • uv run --frozen mypy src tests — existing repository errors (9 errors in fastembed.py, qdrant.py, common/filters.py, and existing mcp_server.py filter typing)

The focused tests exercise the exact formatter used by qdrant-find; a full Qdrant/MCP integration test was not added because the tool closure is local to setup_tools() and introducing test-only production seams would broaden this focused fix.

@mikemikimike
mikemikimike deleted the fix/179-escape-find-output branch August 31, 2026 12:57
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.

Bug: qdrant-find does not escape structural tags in stored content

1 participant