Skip to content

setup() headless on a deployed box: refuse loudly instead of silently reporting success - #951

Merged
VijitSingh97 merged 2 commits into
develop-v2from
fix/924-headless-setup
Aug 14, 2026
Merged

setup() headless on a deployed box: refuse loudly instead of silently reporting success#951
VijitSingh97 merged 2 commits into
develop-v2from
fix/924-headless-setup

Conversation

@VijitSingh97

Copy link
Copy Markdown
Collaborator

Closes #924. The bug: read -r -p ... || true swallowed the headless EOF into an empty answer — read as decline, exit 0 — so a headless retry believed setup succeeded while nothing ran.

The first cut made headless PROCEED; the security pass caught that this turned a long-safe automation probe (pithead setup on a deployed box via ssh/cron) into an unattended re-provision — Tor recreate, full re-render, a possible GRUB edit. And the appliance's own headless paths never reach this guard at all (a failed provisioning attempt is not deployed). So the shipped fix is the honest one: headless + deployed refuses loudly — nonzero exit, a message naming how to proceed (run './pithead setup' from a terminal; apply for config changes). Interactive behavior unchanged. The sibling GRUB prompt gets the same treatment: headless skips the GRUB edit loudly instead of silently, so the operator learns the hugepage reservation is boot-only.

Tier-1 black-box pins the refusal (nonzero, actionable text, never "skipped"-as-success): stack suite 2274/0 solo. Security re-review of the redesign: the refusal path introduces no new capability. Ponytail: one tty-split reused twice.

🤖 Generated with Claude Code

VijitSingh97 and others added 2 commits August 13, 2026 23:53
…less

is_deployed()'s re-run prompt used `read -r -p ... || true`: with stdin on
/dev/null (systemd units), read hits EOF immediately, `|| true` swallows the
failure, RERUN stays empty, and the ^[Yy] check reads that as a decline —
setup exits 0 having done nothing, reporting success.

Give the prompt the same [ -t 0 ] no-tty rule resolve_dashboard_host already
applies: no terminal means proceed, never silently decline, because every
caller that reached setup() headlessly already made that call before
invoking it. Checked both headless callers:

- firstboot_wizard's `--cli` re-run (systemd unit, stdin /dev/null) — the
  unit exists specifically to run setup unattended; proceeding is the whole
  point of invoking it that way.
- firstboot_wizard's own retry after a failed provisioning attempt (the
  operator already confirmed the config on the setup page; a retry here is
  driven by the wizard loop, not a second terminal prompt) — is_deployed()
  can already be true at this point because render_env writes
  DEPLOYMENT_COMPLETED=true before the steps that can still fail, so this is
  exactly the path #924 named as silently reporting success on a
  half-deployed box.

A real terminal ([ -t 0 ] true) keeps the interactive prompt exactly as
before.

Adds a tier-1 black-box case in tests/stack/run.sh pinning the headless
branch: re-running 'pithead setup' with stdin on /dev/null after a completed
setup must not print "Setup skipped" and must re-provision.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…y rework)

The security pass on the first cut caught that proceed-on-headless
turned a long-safe automation probe (pithead setup on a deployed box)
into an unattended re-provision — Tor recreate, full re-render, a
possible GRUB edit — for any caller without a tty. The appliance's own
headless paths never reach this guard (a failed provisioning attempt is
not deployed), so nothing legitimate needed proceed. The bug in the
issue was the silent FALSE SUCCESS (EOF swallowed as decline, exit 0);
the fix is a loud refusal: nonzero exit, a message naming how to
proceed. The sibling GRUB prompt gets the same treatment — headless
skips the GRUB edit loudly instead of silently.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit 9f21dbc into develop-v2 Aug 14, 2026
15 checks passed
@VijitSingh97
VijitSingh97 deleted the fix/924-headless-setup branch August 14, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant