Return a restrictive default policy suitable for sandboxes that have no explicit policy configured. This policy grants filesystem access to standard system paths, runs as the `sandbox` user, enables Landlock in best-effort mode, and **blocks all network access** (no network policies, no inference routing).
()
| 1041 | /// `sandbox` user, enables Landlock in best-effort mode, and **blocks all |
| 1042 | /// network access** (no network policies, no inference routing). |
| 1043 | pub fn restrictive_default_policy() -> SandboxPolicy { |
| 1044 | SandboxPolicy { |
| 1045 | version: 1, |
| 1046 | filesystem: Some(FilesystemPolicy { |
| 1047 | include_workdir: true, |
| 1048 | read_only: vec![ |
| 1049 | "/usr".into(), |
| 1050 | "/lib".into(), |
| 1051 | "/proc".into(), |
| 1052 | "/dev/urandom".into(), |
| 1053 | "/app".into(), |
| 1054 | "/etc".into(), |
| 1055 | "/var/log".into(), |
| 1056 | ], |
| 1057 | read_write: vec!["/sandbox".into(), "/tmp".into(), "/dev/null".into()], |
| 1058 | }), |
| 1059 | landlock: Some(LandlockPolicy { |
| 1060 | compatibility: "best_effort".into(), |
| 1061 | }), |
| 1062 | process: Some(ProcessPolicy { |
| 1063 | run_as_user: "sandbox".into(), |
| 1064 | run_as_group: "sandbox".into(), |
| 1065 | }), |
| 1066 | network_policies: HashMap::new(), |
| 1067 | } |
| 1068 | } |
| 1069 | |
| 1070 | /// Ensure the policy has `run_as_user: sandbox` and `run_as_group: sandbox`. |
| 1071 | /// |
no outgoing calls