feat(#2302): thread &Ident through agent path builders

This commit is contained in:
damocles 2026-07-20 00:22:06 +02:00 committed by mara
commit bf644cc126
23 changed files with 168 additions and 85 deletions

View file

@ -31,9 +31,13 @@ pub const HOST_SOCKET: &str = "/run/hyperhive/host.sock";
pub const AGENTS_ROOT: &str = "/var/lib/hyperhive/agents";
/// `agents/<name>` — one agent's persistent state root.
///
/// Takes a validated [`Ident`] (not a raw `&str`) so a per-agent state path
/// can never be built from an unvalidated name — the `../` traversal guard is
/// the type, enforced at the one place every agent path is rooted.
#[must_use]
pub fn agent_state_dir(name: &str) -> PathBuf {
PathBuf::from(AGENTS_ROOT).join(name)
pub fn agent_state_dir(name: &Ident) -> PathBuf {
PathBuf::from(AGENTS_ROOT).join(name.as_str())
}
/// `gateway/gateway.htpasswd` — nginx basic-auth credential store for the