Whether a change touches the vault — which a sandbox may submit only with `vault.write` as well.
(bytes: &[u8])
| 198 | /// Whether a change touches the vault — which a sandbox may submit only with |
| 199 | /// `vault.write` as well. |
| 200 | fn touches_vault(bytes: &[u8]) -> bool { |
| 201 | let Ok((change, _)) = atomic_core::change::Change::deserialize(&mut &bytes[..]) else { |
| 202 | // Not a change: the kernel refuses it as malformed. |
| 203 | return false; |
| 204 | }; |
| 205 | let vault = |p: &str| p == ".vault" || p.starts_with(".vault/"); |
| 206 | change.hunks().iter().filter_map(|h| h.path()).any(vault) |
| 207 | || change.file_ops().iter().map(|ops| ops.path()).any(vault) |
| 208 | } |
| 209 | |
| 210 | #[tonic::async_trait] |
| 211 | impl sandbox_service_server::SandboxService for SandboxImpl { |
no test coverage detected