Skip to content

Commit 7528798

Browse files
committed
update security docs
1 parent 7f3c8d4 commit 7528798

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

docs/safety/security.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,31 @@ A recursive walker traverses the AST to verify that:
2323
* No ambiguous columns (without aliases) are present if multiple tables share the column name.
2424
* *Failures result in `ErrorCode.COLUMN_NOT_FOUND` or `ErrorCode.INVALID_ALIAS_USAGE`.*
2525

26-
## 2. Authorization (RBAC)
26+
## 2. Retrieval Security (Scope)
27+
28+
Before the system even attempts to plan, we limit the **Knowledge Scope** available to the LLM. This prevents the "Decomposer" from hallucinating or planning against tables the user cannot see.
29+
30+
### Vector Store Filtering
31+
32+
The `OrchestratorVectorStore` enforces a strict **Metadata Filter** on every retrieval call.
33+
34+
* **Mechanism**: `query({filter: {'datasource_id': {'$in': allowed_ds_ids}}})`
35+
* **Guarantee**: If a user only has access to `sales_db`, vectors from `hr_db` are physically excluded from the search space. The LLM never sees them.
36+
37+
### Decomposer Fail-Safe
38+
39+
The `DecomposerNode` performs an explicit pre-check:
40+
41+
```python
42+
def _check_user_access(state):
43+
allowed = state.user_context.get("allowed_datasources")
44+
if not allowed:
45+
raise SecurityViolation("Access Denied")
46+
```
47+
48+
If the user context has no allowed datasources, the request is rejected immediately with `ErrorCode.SECURITY_VIOLATION`.
49+
50+
## 3. Authorization (RBAC)
2751

2852
We use a strict **Role-Based Access Control** system defined in `configs/policies.json`.
2953

0 commit comments

Comments
 (0)