Learn why retrieval scope needs one gateway
Status: Ready
Article ID: 118
Truth label: Historical
Audience: Retrieval and security architect
Reader outcome: Find bypasses created by direct and automatic search paths.
Related articles: 068, 073, 079
Target week: 47
Last verified: 2026-09-13
Technical reviewer: Codex incident evidence audit
Editorial reviewer: Codex editorial audit
Problem
Scope filtering was added to selected HTTP searches, while chat auto-retrieval, agent tools, direct record reads, and document operations could still reach the stores through different paths.
Misleading success signal
Positive and negative tests for the filtered endpoint passed. Scope-audit logs showed denials for calls that reached it. Neither proved that every retrieval consumer used that endpoint.
Evidence
The security audit enumerates implemented scoped paths and direct or automatic bypasses. It also records incomplete run-token binding for worker task-scope resolution.
Correction
The required design places search and record reads behind one gateway with a structured scope context, fail-closed resolution, task-and-run binding, audited all-scope use, and operator-only direct collection access.
Mechanical prevention
Inventory every store caller in code. Add two-client negative tests for HTTP, chat, tools, workers, direct record reads, and CRUD. Make bypass calls fail code review and CI through a constrained store interface.
Current status
Selected paths are scoped, but the complete gateway is not implemented. The lesson is Historical because the audit discovered the pattern; the documented P0 gap remains current.
Current limits
Client scope is not tenant isolation. Passing known-path tests cannot prove no future or indirect bypass, and scope audit records only calls that reached the filter.
Next lesson
Continue with Why a green working tree is not a green commit.
Derivative map
- Weekly package: WEEK-47
- Long video: VIDEO-W47-LONG
- Shorts: SHORT-W47-PROBLEM, SHORT-W47-MECHANISM, SHORT-W47-WARNING
- Email: EMAIL-W47
- LinkedIn: LI-W47-A, LI-W47-B
- X: X-W47-A, X-W47-B
- Visual: VISUAL-W47
Review record
- Discovered bypass pattern and incomplete current status remain distinct.
- Endpoint success and audit logs are rejected as whole-system proof.
- Gateway and multi-consumer negative tests are specified.
- Tenant-isolation and future-bypass limits remain explicit.
Review completed: 2026-08-27
Re-audited against the running product: 2026-09-13