Evaluate RLS filters against a document. Returns `true` if the document passes all RLS filters (or if no filters). Returns `false` if any filter rejects the document (caller must deny). Used by point-get and key-get handlers after fetching the raw document.
(rls_filters: &[u8], doc: &serde_json::Value)
| 19 | /// |
| 20 | /// Used by point-get and key-get handlers after fetching the raw document. |
| 21 | pub fn rls_check_document(rls_filters: &[u8], doc: &serde_json::Value) -> bool { |
| 22 | if rls_filters.is_empty() { |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | let filters: Vec<ScanFilter> = match zerompk::from_msgpack(rls_filters) { |
| 27 | Ok(f) => f, |
| 28 | Err(_) => { |
| 29 | // Deserialization failure → deny (fail-closed). |
| 30 | tracing::warn!("RLS filter deserialization failed — denying access"); |
| 31 | return false; |
| 32 | } |
| 33 | }; |
| 34 | |
| 35 | let msgpack = nodedb_types::json_to_msgpack_or_empty(doc); |
| 36 | filters.iter().all(|f| f.matches_binary(&msgpack)) |
| 37 | } |
| 38 | |
| 39 | /// Evaluate RLS filters against raw MessagePack document bytes. |
| 40 | /// |
nothing calls this directly
no test coverage detected