Skip to content

Fix adapter tenant and privacy isolation - #15

Open
NeerajCodz wants to merge 1 commit into
mainfrom
codex/fix-adapter-isolation-issues-in-repository
Open

Fix adapter tenant and privacy isolation#15
NeerajCodz wants to merge 1 commit into
mainfrom
codex/fix-adapter-isolation-issues-in-repository

Conversation

@NeerajCodz

Copy link
Copy Markdown
Member

Motivation

  • Qdrant searches were not enforcing VectorSearchRequest.privacy_scope, allowing results with disallowed privacy_level to be returned.
  • Neo4j adapter queries omitted or hardcoded tenant_id, which could mix graph data across tenants that share a user_id and break tenant isolation.

Description

  • Qdrant: enforce the requested privacy scope by converting request.privacy_scope into a privacy_level filter and adding it as a match.any clause in the search payload (src/adapters/qdrant.rs).
  • Neo4j: include tenant_id when matching endpoint nodes used by merge_edge, and when matching traversal start nodes in related_memory_ids to scope traversals to the tenant (src/adapters/neo4j.rs).
  • Neo4j: constrain traversal relationships to the same tenant_id/user_id via WHERE all(rel in relationships(p) WHERE rel.tenant_id = $tenant_id AND rel.user_id = $user_id) and include tenant_id in redact_memory_edges matches and parameters to avoid cross-tenant redaction.
  • Minor formatting/cleanup to align request/response call sites and JSON construction in the updated adapters.

Testing

  • Ran the test suite with cargo test and all unit tests passed (11 passed; 0 failed).
  • No new automated tests were added for the adapters in this change.

Codex Task

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant