Repository navigation
Description
fleet-config: a relative HOME is used verbatim — config, state, and broker socket resolve CWD-relative and a planted fleet.toml loads
Summary
fleet-config filters an empty HOME (it falls back to ".", tracked separately as #5737) and treats empty or relative XDG bases as the hazards they are (#5473 closed; #6396 open for relative XDG), but a non-empty relative HOME is used verbatim as the anchor for every home-relative resolution in the crate. With HOME=relhome, Config::file_path() returns the relative path relhome/.config/fleet/fleet.toml, and Config::load() loads a fleet.toml planted under the process's current working directory. The state dir, the shims dir under it, the broker socket, and both token-file paths resolve CWD-relative the same way.
This is a distinct trigger from the filed siblings: #5737 covers HOME unset/empty (the "." fallback); #6396 covers relative XDG bases with HOME present and correct (and explicitly puts the HOME cases out of its scope). Neither covers HOME itself being set to a relative path.
Evidence (file:line, origin/main @ 2871969; fleet-config lib.rs is byte-identical between laptop HEAD 1dae17e and origin/main, md5-verified this run)
pkgs/fleet/crates/fleet-config/src/lib.rs:225-227—home_dir():env_path("HOME").unwrap_or_else(|| PathBuf::from(".")).env_path/non_empty_path(:217-223) filter only the empty case; a relative value passes through unchanged.pkgs/fleet/crates/fleet-config/src/lib.rs:252-263—file_path_fromjoins.config/fleet/fleet.tomlonto that home value; a relative home stays relative.pkgs/fleet/crates/fleet-config/src/lib.rs:442-445—state_dir_fromjoins.local/state/fleetonto the same home;shims_dir()isstate_dir()/shims.pkgs/fleet/crates/fleet-config/src/lib.rs:302-320—broker_socket_fromresolves the default.cache/laptop-agent/broker.sockunder the same home viaresolve_under;default_token_file()(:385) andsecrets_token_file()(:430) resolve under it too.
Verification (this run, laptop, real fleet-config crate)
Probe ~/git/fleet/probe-fleet-config-empty-rel (path-depends on the real fleet-config crate; paths bin prints file_path/state_dir, loads via Config::load(), and reports domain flags):
- From a scratch CWD containing a planted
relhome/.config/fleet/fleet.toml([domains] planted = false), withHOME=relhomeand XDG/FLEET_CONFIG unset:file_path=relhome/.config/fleet/fleet.toml(relative)state_dir=relhome/.local/state/fleetbroker_socket=relhome/.cache/laptop-agent/broker.sockplanted_enabled=false— the planted CWD config was loaded (an unknown domain defaults to enabled;falsecan only come from the planted file)queue_enabled=true(control domain untouched)
- Same relative
HOME=relhomefrom a CWD with norelhometree:planted_enabled=true— defaults rule; the load follows the CWD-relative path, not any fixed location. - Control, absolute
HOME=<scratch>/abshome: all paths anchor at the absolute home; its own config loads as expected.
Why it matters
- A fleet process launched with a relative HOME (a wrapper script, a templated systemd unit with
HOME=.or a relativeWorkingDirectory-style spelling, a container entrypoint) silently reads its configuration — including the[domains]disable lever the crate docs call an incident lever — from whoever controls its working directory: the exact planted-config hazard fleet-config: empty XDG env vars resolve to CWD-relative paths (a planted ./fleet/fleet.toml is loaded), and a relative FLEET_BROKER_SOCKET bypasses under-HOME resolution #5473 closed for the empty-XDG spelling and fleet-config: a relative XDG_CONFIG_HOME / XDG_STATE_HOME is used verbatim — config and state resolve CWD-relative and a planted fleet.toml loads even with HOME set #6396 filed for the relative-XDG spelling. - State, shims, socket, and token-file paths landing CWD-relative means two processes in different directories keep different state and talk to different sockets, with no error anywhere.
Acceptance criteria
- A relative
HOMEis not used as a resolution anchor: it is treated as unset for anchoring purposes (so the existing fleet-config: HOME unset/empty falls back to "." — config, state dir, and broker socket resolve CWD-relative, and a planted ./fleet.toml loads #5737 fallback decision governs what happens next), or resolution otherwise fails closed with a loud error — triage picks the shape, consistent with fleet-config: HOME unset/empty falls back to "." — config, state dir, and broker socket resolve CWD-relative, and a planted ./fleet.toml loads #5737/fleet-config: a relative XDG_CONFIG_HOME / XDG_STATE_HOME is used verbatim — config and state resolve CWD-relative and a planted fleet.toml loads even with HOME set #6396. - A planted
./<relative-home>/.config/fleet/fleet.tomlin the working directory is never loaded. - Pinning tests cover a relative HOME for
file_path,state_dir, andbroker_socketalongside the existing empty-value tests (env_paths_ignore_empty_values_and_resolve_under_home, lib.rs:577). - Behavior with an absolute HOME is unchanged; existing fleet-config tests stay green.
- Out of scope: HOME unset/empty (fleet-config: HOME unset/empty falls back to "." — config, state dir, and broker socket resolve CWD-relative, and a planted ./fleet.toml loads #5737), relative XDG bases (fleet-config: a relative XDG_CONFIG_HOME / XDG_STATE_HOME is used verbatim — config and state resolve CWD-relative and a planted fleet.toml loads even with HOME set #6396), and
FLEET_CONFIGitself (an explicit per-file override a user may deliberately spell relative).
Activity
developing-today commentedon Nov 6, 2026
CODE-1913
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 6, 2026
🤖 Agent note · picked up
4 remaining items
dezren39 commentedon Nov 6, 2026
🤖 Agent note · picked up
fix(fleet-config): never anchor resolution on a relative HOME (#6404)
fix(fleet-config): never anchor resolution on a relative HOME (#6404)
fix(fleet-config): never anchor resolution on a relative HOME (#6404) (…
dezren39 commentedon Nov 6, 2026
🤖 Agent note · done
home_anchor()treats a relative HOME as unset for anchoring (absolute-only anchor, scoped to HOME; relative XDG fleet-config: a relative XDG_CONFIG_HOME / XDG_STATE_HOME is used verbatim — config and state resolve CWD-relative and a planted fleet.toml loads even with HOME set #6396 and explicit relative overrides untouched); pinning testrelative_home_is_not_an_anchorcovers file_path/state_dir/broker_socket