[Integration]: NeedToKnow — permission-aware retrieval (AccessFilter)

Open
#773 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 13 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
54/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with the published needtoknow-haystack repository and its AccessFilter component; the issue also names examples/leak_benchmark.py and the unit and pipeline tests. Check how the component filters documents by user, groups, and public metadata, then run the tests and benchmark. Done means the integration is listed with its repository, description, and evidence of working behavior.

Written by the indexing model from the issue text.

Description

Stage

Ready: integration exists and works, proposing to list it

Integration or project name

needtoknow-haystack

Integration type

Custom Component

Published package or repo (if it exists)

https://github.com/Sanoer11/needtoknow-haystack

Need or proof of use

Why Haystack users need it: most RAG pipelines retrieve from one shared index, and retrieval ranks by relevance, not by who is asking. Whatever the retriever returns reaches the prompt, so one user can get another team's restricted documents. LangChain (Permit, Auth0 FGA retrievers) and LlamaIndex (Auth0 FGA) have permission-aware retrieval; I couldn't find a store-agnostic equivalent among the listed Haystack integrations.

Proof it works:

  • Leak benchmark (examples/leak_benchmark.py, offline, synthetic company corpus, 5 users x 10 probing queries, BM25 top-5): 58% of retrieved documents leaked across departments without the filter, 0% with AccessFilter.
  • 22 unit and pipeline tests, including YAML pipeline serialization round-trips.
  • CI on every push: Python 3.10 and 3.13 x Haystack 2.31 and 3.x (all green).

It grew out of NeedToKnow (https://github.com/Sanoer11/needtoknow), my permission-aware RAG project, where the same per-user filtering took cross-user leakage from 43.2% to 0% on 250 adversarial probe results. It doesn't have external users yet; I'm happy to publish it to PyPI if that's preferred before listing.

Short description

AccessFilter is a component that sits after any Haystack retriever and removes documents the requesting user may not read. Each document declares access in its metadata (allowed_users, allowed_groups, or an optional public flag), and the filter keeps a document only if the user, one of their groups, or the public flag matches.

It fails closed: documents without access metadata are denied by default, and an empty user_id raises an error. It works with any document store, returns denied_count for auditing, supports top_k after filtering, and serializes with pipelines (in Haystack 3, via allowed_modules=["needtoknow_haystack"]).

Dominant language
Python
Stars
114
Forks
324
Avg merge
7d 2h
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from deepset-ai/haystack-integrations

All issues in deepset-ai/haystack-integrations

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.