MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / inject_rls

Function inject_rls

nodedb/src/control/planner/rls_injection.rs:35–45  ·  view source on GitHub ↗

Inject RLS predicates into physical tasks after plan conversion. This is the read-path RLS enforcement entry point. For each task: 1. Extracts the collection name from the physical plan. 2. Fetches RLS read policies for `(tenant_id, collection)`. 3. Substitutes `$auth.*` references using the `AuthContext`. 4. Injects the resulting concrete filters into the plan: - **Scans**: merged into the exist

(
    tasks: &mut [PhysicalTask],
    rls_store: &RlsPolicyStore,
    auth: &AuthContext,
)

Source from the content-addressed store, hash-verified

33///
34/// Returns `Err` if a required `$auth` field is missing (fail-closed).
35pub fn inject_rls(
36 tasks: &mut [PhysicalTask],
37 rls_store: &RlsPolicyStore,
38 auth: &AuthContext,
39) -> crate::Result<()> {
40 for task in tasks.iter_mut() {
41 let tenant_id = task.tenant_id.as_u64();
42 inject_rls_for_plan(tenant_id, &mut task.plan, rls_store, auth)?;
43 }
44 Ok(())
45}
46
47/// Inject RLS into a single physical plan (public for native protocol dispatch).
48pub fn inject_rls_for_single_plan(

Calls 3

inject_rls_for_planFunction · 0.85
iter_mutMethod · 0.80
as_u64Method · 0.45

Tested by

no test coverage detected