Skip to content

fix(memory,a2a)!: harden Qdrant search limits and A2A trust defaults - #6615

Merged
bug-ops merged 1 commit into
mainfrom
fix/6553-memory-a2a-trust-hardening
Jul 20, 2026
Merged

fix(memory,a2a)!: harden Qdrant search limits and A2A trust defaults#6615
bug-ops merged 1 commit into
mainfrom
fix/6553-memory-a2a-trust-hardening

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Four low-severity, defense-in-depth hardening fixes from a security audit sweep of zeph-memory Qdrant query construction and zeph-a2a trust boundary. None were independently exploitable — each closes a footgun that becomes real only if a future call site omits a safeguard that currently exists exactly once.

  • zeph-memory: clamp caller-supplied limit/top_k to [1, 100] directly inside EmbeddingStore::search/search_collection, EmbeddingRegistry::search_raw, and ReasoningMemory::retrieve_by_embedding, instead of relying on the sole external MCP-tool clamp. Logs a one-shot warning when the clamp actually reduces a caller's requested value (covers config-driven pools like memory.retrieval.depth exceeding the ceiling).
  • zeph-config: non-fatal warning when memory.qdrant_url is non-loopback and lacks TLS and/or an API key.
  • zeph-a2a: kept CardTrustPolicy::Ignore as the default (behavior-preserving), but now log a warning (and surface it in the TUI chat pane) when it's in effect, so operators know peer AgentCard verification is off.
  • zeph-a2a: A2aClient::new now requires an explicit SecurityPolicy argument instead of silently defaulting to permissive(). Added A2aClient::new_insecure() for callers that want the old behavior explicitly.

Closes #6553

Breaking change

A2aClient::new(client)A2aClient::new(client, policy) or A2aClient::new_insecure(client). zeph-a2a is a published crate; no workspace version bump in this PR (handled separately via /rust-release), consistent with prior precedent for this crate.

Test plan

  • Unit tests for the 4 search-limit clamp sites (count assertions where a test seam exists, log assertions elsewhere)
  • Unit tests for the Qdrant TLS/auth config-validation warning (loopback skip, non-loopback fire)
  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins (15000 passed)
  • Rustdoc gate (RUSTFLAGS=-D warnings + RUSTDOCFLAGS=--deny rustdoc::broken_intra_doc_links)
  • gitleaks protect --staged
  • Adversarial implementation critique (2 rounds — found and fixed a silent recall-pool truncation gap before merge)
  • Independent code review with a fresh full check-suite run

@github-actions github-actions Bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes dependencies Dependency updates bug Something isn't working size/XL Extra large PR (500+ lines) labels Jul 20, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 20, 2026 21:29
@bug-ops
bug-ops force-pushed the fix/6553-memory-a2a-trust-hardening branch from ee459a9 to be7aa58 Compare July 20, 2026 21:30
Address four low-severity defense-in-depth findings from a security
audit: clamp caller-supplied search limits inside zeph-memory itself
instead of relying on the sole external MCP-tool clamp, warn when a
non-loopback Qdrant endpoint lacks TLS/an API key, warn (in logs and
the TUI chat pane) when CardTrustPolicy resolves to the permissive
ignore default, and require A2aClient::new callers to pass an explicit
SecurityPolicy instead of silently inheriting a permissive one.

BREAKING CHANGE: A2aClient::new now requires a SecurityPolicy argument.
Callers of A2aClient::new(client) must migrate to
A2aClient::new(client, policy) or A2aClient::new_insecure(client) for
the previous permissive-by-default behavior.
@bug-ops
bug-ops force-pushed the fix/6553-memory-a2a-trust-hardening branch from be7aa58 to 43a3d22 Compare July 20, 2026 21:39
@bug-ops
bug-ops merged commit e0af1f7 into main Jul 20, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/6553-memory-a2a-trust-hardening branch July 20, 2026 21:49
bug-ops added a commit that referenced this pull request Jul 20, 2026
The MAX_SEARCH_LIMIT clamp added in #6553/PR #6615 only covered the
EmbeddingStore/EmbeddingRegistry/ReasoningMemory wrapper methods. A
caller reaching a VectorStore implementor directly bypassed the clamp
entirely — confirmed live in zeph-index's CodeStore::search and
zeph-core's generic RetrievalStep<P, V: VectorStore>.

Add a shared clamp_search_limit helper and call it first-thing inside
search on all three production implementors (QdrantOps, DbVectorStore,
InMemoryVectorStore). Wrapper-level clamps are left in place since
re-clamping an already-clamped value is a no-op.

Closes #6616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Dependency updates documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Low: four hardening observations in zeph-memory Qdrant search / zeph-a2a trust defaults

1 participant