Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

7.7 KB
Raw Blame

The egress policy no longer assumes a library / collection_* search engine is always contained. A collection is now classified by the vector store its index actually lives in: a local-file store (FAISS) stays local exactly as before, while a server-backed store is treated as local only while its configured endpoint resolves to a local host or a filesystem path. Otherwise the collection loses containment (is_local=False) but keeps its real, already-resolved is_public flag — it is NOT reclassified as public. A private (non-public-flagged) collection whose store is not contained is therefore denied under every scope (private_only, public_only, adaptive/both, strict), with reason unclassified, fail-closed, exactly like any other engine the policy cannot positively classify as local or public. Only a collection_* explicitly marked is_public stays eligible under public-scope runs once its store leaves the box (library, the all-collections aggregate, cannot opt in this way — see "Future work" below). This differs from how Paperless/Elasticsearch fail up: those engines are reclassified fully public on a public endpoint, so private_only alone blocks them while public_only/adaptive-public still allow them; a non-contained private collection is blocked everywhere instead, because losing containment must only ever add restriction, never grant new eligibility.

For the common single-engine run, the two-axis run-start audit (ADR-0007) is NOT an independent second line of defence here: audit_run_from_snapshot (the only production entry point, called from web/routers/research.py and web/services/research_service.py) always classifies just the run's primary engine. When that primary is a private, non-contained collection, it is the SOLE sensitive source in the audited set, so the quadrant-4 self-exclusion in classification.py applies (a component may reach a sink that is its own data) and the audit returns an ALLOW ("sensitive_contained"), not a denial — provided the run's inference sinks are themselves contained; an exposing LLM/embeddings sink denies the run first ("sensitive_to_exposing_inference", checked in classification.py before the self-exclusion is considered). For a single-engine run the audit therefore adds nothing: it evaluates the primary engine only (its LLM/embeddings entries are inference sinks, not sensitive sources), so a second sensitive source can never appear in the audited set. Two independent guards still cover the case. The unclassified block above governs ENGINE ELIGIBILITY — the collection is denied under every scope. Separately, on the SCOPE side, a primary engine that classifies as neither public nor local resolves adaptive to the restrictive private_only rather than the permissive both, which keeps the rest of the run (LLM and embeddings included) local as well. Neither guard depends on the other.

A non-local-file store whose endpoint cannot be resolved is treated as remote (not contained).

Future work: today the only way to keep a library/collection engine usable once its vector store is server-backed and off-box is to mark the individual collection is_public (or run unprotected) — there is no opt-in for the library aggregate, and policy.trusted_search_engines is not wired into this containment check. A deliberate opt-in mechanism (e.g. extending trusted_search_engines to cover vector-store endpoints, or a per-collection "trusted remote store" flag) is a maintainer decision that should land before server-backed vector stores (tracked in #5331) are expected to be usable under anything other than unprotected.

A rejected network-share path in a file URI remains non-contained even when its nominal authority resolves locally, and that rejection is now applied to every entry of the endpoint setting rather than only to a plain-string value — a list-shaped setting (the shape an Elasticsearch-style endpoint list uses, and the shape a {"value": [...]} snapshot unwraps to) no longer reaches hostname classification with a rejected path still in it. A single rejected entry makes the whole setting non-contained, matching the existing "any public entry wins" fail-up. Current FAISS configurations are unaffected.

Windows drive-absolute store paths written with a doubled or mixed separator after the drive letter (C:\\data\store.db, C:/\data, C:\/data) are recognised as local again: a drive letter always wins over a UNC prefix on Windows and none of these forms can name a remote host. Known limitation: the forward-slash form C://data/store.db stays non-contained, because it is byte-for-byte a single-letter-scheme URL (scheme c, hostname data) and cannot be told apart from the x://host authority form the classifier must reject. Write such a path as C:/data/store.db or C:\data\store.db. Second known limitation: because the decoded path is what decides whether a file:// URI names a network share, a file:// URI whose FIRST path segment literally begins with an unescaped %2f or %5c (file:///%2fdir/store.db) is treated as non-contained. %252f (the correct RFC 3986 encoding of a literal %2f) and %2f in any later segment stay contained. This only affects URIs built by concatenating "file://" with a raw path; pathlib.Path.as_uri() never produces one.

Whether a store URI is a local filesystem path, and whether it is a file:// URI naming a network share, are now decided the way urllib.parse.urlsplit itself reads the value rather than from the raw setting string. urlsplit follows the WHATWG URL parser: it deletes every tab, CR and LF from anywhere in the URL and strips leading C0 control characters. str.strip() does neither of the two things that matter here — it never touches a tab, CR or LF in the middle of a value, and it leaves a leading non-whitespace C0 character such as \x00 or \x01 in place. Deciding the path question on the raw string while the host was decided on the parsed one let a control character split the two readings apart: x:/<TAB>/host:19530 and /<TAB>/host/share/db were "a local drive path" / "an ordinary absolute path" to the raw tests but a host:19530 / host authority to the parser, so the endpoint short-circuited to contained without any host classification. The path tests now run on the same string the parser sees, and the "is this a file:// URI?" question is answered by the parsed scheme, so fi<TAB>le://localhost//host/share — not a file:// URI to a raw startswith, but one with a local-looking authority to every real parser — no longer slips past the network-share rejection. For the characters named above — a tab, CR or LF anywhere, and a leading C0 control — such values are now classified exactly as their control-character-free equivalents are. That scope is the claim: an interior \x00 is not covered, because urlsplit does not delete it either, so it stays in the path and such a value can still classify differently from its NUL-free equivalent. That difference is not a route off the box — ntpath.normpath resolves /\x00//host/share to a single leading separator, not to a \\host\share UNC prefix.

A Windows drive-absolute store path must now begin with an ASCII drive letter. str.isalpha() is Unicode-wide, so с:/data/store.db (Cyrillic "es"), C:/data/store.db (fullwidth) and é:/data/store.db previously short-circuited to "local file" and skipped host classification entirely. None of them is a drive path to any resolver. This matches the ASCII requirement already applied to the file://<letter>:/path authority form; real A:–Z: paths in either case are unaffected.

This release does not change how .local and RFC1918 authorities are classified: they continue to count as contained, exactly as they did before this fix, and revisiting that is out of scope here.