Skip to content

fleet-config: empty/blank config-file strings are used verbatim — broker_socket="" resolves to the home directory itself, and a blank dispatch url overrides as Some("") #6405

Closed

Description

@dezren39

fleet-config: empty/blank config-file strings are used verbatim — broker_socket="" resolves to the home directory itself, and a blank dispatch url overrides as Some("")

Summary

fleet-config is careful about empty environment values: env_path filters them out (#5473), and dispatch_url()'s own doc says of FLEET_DISPATCH_URL that "empty counts as unset, as with every env path here". Empty or blank config-file strings get no such treatment: the accessors use them verbatim. A fleet.toml with broker_socket = "" makes the broker socket path the home directory itself; token_file = "" does the same to the secrets token-file path; [dispatch] url = "" (or all-whitespace) is returned as a configured URL, Some(""); token_name = "", target_host = "", and connect_udp_listen = "" likewise surface as empty values instead of their documented defaults.

This breaks the crate's stated config policy (crate docs, lib.rs:14-16): "a malformed file is a loud error, never a silent fallback". An empty string in a path/URL/name field is a misspelling-class error — a templated config rendering a variable that came out empty — and every env-side equivalent in this same crate is already treated as unset for exactly that reason.

Distinct from the filed siblings: #6397 covers [[proxy.services]] row values (duplicate/zero ports, empty service names); #6396/#5737 cover env-base resolution. No filed issue covers the scalar string fields of [proxy]/[secrets]/[dispatch].

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:302-320 — broker_socket_from: the env source goes through env_path (empty filtered), but Some(p) => resolve_under(home, &PathBuf::from(p)) for the config value has no empty check; resolve_under(home, "") is home itself.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:430-436 — secrets_token_file: Some(p) => resolve_under_home(p) — same empty-to-home resolution.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:390-396 — dispatch_url: the env branch trims and rejects empty (Ok(v) if !v.trim().is_empty()), the config branch is self.dispatch.url.clone() verbatim.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:324-330 — target_host: as_deref().unwrap_or(DEFAULT_TARGET_HOST) — Some("") wins over the default.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:350-356 — connect_udp_listen: same shape against DEFAULT_CONNECT_UDP_LISTEN.
  • pkgs/fleet/crates/fleet-config/src/lib.rs:398-403 — dispatch_token_name: same shape against DEFAULT_DISPATCH_TOKEN_NAME.
  • Contrast inside the same file: search_url() (:415-421) and search_via() (:406-412) do trim/filter their config values — the scalar fields above are the inconsistent remainder.

Verification (this run, laptop, real fleet-config crate)

Probe ~/git/fleet/probe-fleet-config-empty-rel (cfg bin; path-depends on the real fleet-config crate; HOME=/home/tester; each case is a real Config::load_from on a written temp fleet.toml):

empty broker_socket        -> "/home/tester/"     (the home directory itself)
empty secrets token_file   -> "/home/tester/"     (the home directory itself)
empty dispatch url         -> Some("")
blank dispatch url "   "   -> Some("   ")
empty dispatch token_name  -> ""
empty target_host          -> ""
empty connect_udp_listen   -> ""
control broker_socket "sock/b.sock"   -> "/home/tester/sock/b.sock"
control dispatch url "http://127.0.0.1:9" -> Some("http://127.0.0.1:9")
control dispatch token_name "tok.name"  -> "tok.name"

Every empty/blank case loads with no error and surfaces the empty value; every control resolves as documented.

Why it matters

  • A templated or generated fleet.toml that renders a variable empty (the routine failure the env-side filtering exists for) does not fail loudly: the session broker tries to use the operator's home directory as a Unix socket path, the secrets flow names a directory as its token file, and the dispatch client is handed an empty base URL that outranks the working default — each surfacing later as an opaque connect/read error far from the config mistake, or, for target_host = "", as a dial to an empty host.
  • The crate already decided this question for env values and for [search]; the remaining fields are an inconsistency, not a design choice.

Acceptance criteria

  • Empty or all-whitespace values for broker_socket, secrets.token_file, dispatch.url, dispatch.token_name, proxy.target_host, and proxy.connect_udp_listen in the config file are either treated as unset (falling back to the documented default, matching the env-side rule) or rejected at load with a loud ConfigError — one consistent shape, triage's call.
  • No accessor can return the home directory itself as a socket/token-file path, an empty string as a configured dispatch URL, or an empty token name / target host / listen address.
  • Pinning tests cover empty and blank spellings for each affected accessor alongside the existing dispatch_settings_* / proxy_settings_* tests; valid values resolve exactly as before.
  • No change to env-var handling (already correct) or to valid configs.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. added
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a run 2026-11-05 18:35 CST
    • Found via: filed this run
    • Task: Filed after verifying on the laptop with probe ~/git/fleet/probe-fleet-config-empty-rel (real fleet-config crate): empty/blank config-file strings are used verbatim — broker_socket="" and token_file="" resolve to the home directory itself, dispatch url=""/" " surfaces as Some(""), and token_name/target_host/connect_udp_listen "" override their defaults — while every env-side equivalent in the same crate is filtered as unset.
    • Expectation: effort s — triage via the enqueued repo-task/v1 packet; done = one consistent empty/blank shape (treat as unset or loud load error) with pinning tests, per the issue's acceptance criteria.
    • Links: queue packet packet-6405-triage.json (repo-health-code-pilot)
  5. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 6, 2026
  7. 143 remaining items

  8. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    🤖 Triage complete — Task 10832 completed. Source review and recommended validation approach are recorded above; implementation follow-up task 14872 is queued. The executable probe was not rerun during triage.

  9. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 11, 2026
  10. added a commit that references this issue on Nov 11, 2026
  11. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleetpkgs/fleet multicall binary + platform crateskind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions