Skip to content

RAG: actor-scoped visibility enforcement on retrieval #177

Description

@qiuethan

Sub-issue of the RAG retrieval epic (#125).

Why

The LLM is not a trust boundary. A user must never retrieve a chunk from a document they cannot read, regardless of how the question is phrased.

Scope

  • Retrieval is actor-scoped: every query carries the asking user, and results are filtered by the per-doc grants built in Document visibility: per-doc grants (person/team) + actor-scoped enforcement #74.
  • Filtering happens in the query, not after ranking — otherwise top-k is computed over documents the user cannot see and returns fewer results than it should.
  • Reuse doc_visible() / doc_grants rather than reimplementing visibility.

Acceptance

  • Two users with different grants issue the same query and receive different results.
  • A user with no grants receives nothing.
  • Tests cover the filter-before-rank behaviour, not just the final result set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docs-systemdocumentation-system service & content pipelinearea/serviceBackend API services (generic/cross-cutting)type/featureNew capability or enhancement

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions