From 8912f71afb9697c8645209ec0e67f67098bb16a1 Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 15:15:53 +0000 Subject: config: the sandbox backend is an enum, not a string with a fallthrough MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `sandbox_backend` was a free-form string and `backend_for` matched it with `_ => loopback`. So `sandbox_backend = "kata"` — a real, intended backend, documented in the design — meant "run the untrusted PKGBUILD as the hub's own user", and nothing anywhere said so. There was also no validation of any kind in the crate: an empty `agent_token` with a remote backend, or a missing listen address, parsed fine and failed later as something else. The four flat fields become one tagged `sandbox` object with three kinds: `loopback` (needs nothing, still the default, so every config on disk keeps working), `remote` (listen + token), and `agent-sandbox` (api, namespace, bearer, image, listen, token). Required fields are required by the type, an unknown kind is a parse error naming the valid set, and `deny_unknown_fields` means a misspelled field is named rather than read as absent. `agent-sandbox` parses and is refused at backend construction until it is wired up — a valid kind that is not implemented is an error, never a substitution. Retired keys are refused when they carry intent: a config saying `sandbox_backend: "remote"` errors and names the replacement shape, because quietly reinterpreting it as loopback is the bug being removed. A config saying `"loopback"` with the empty strings `init` wrote is noise, not intent, and loads unchanged. The token and the cluster bearer are redacted in `Debug`, so a config that reaches a log line cannot leak them. --- src/sandbox/kata.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sandbox') diff --git a/src/sandbox/kata.rs b/src/sandbox/kata.rs index 9592dca..5c92557 100644 --- a/src/sandbox/kata.rs +++ b/src/sandbox/kata.rs @@ -311,7 +311,7 @@ impl SandboxBackend for KataBackend { hub_addr: self.addr.clone(), token: self.token.clone(), ttl: spec.ttl, - image: self.cfg.sandbox_image.clone(), + image: self.cfg.sandbox_image(), }; if let Err(e) = self.provisioner.provision(&req) { self.pending.lock().unwrap().remove(&id); -- cgit v1.2.3