Skip to content

host-setup Scripts Swallow Precondition-Check Failures Before Mutating #954

Description

@ptr727

Five host-setup/ sites swallow a precondition-check failure with || true or
2>/dev/null before a mutation runs, recurring finding from CodeRabbit across
PR #951 and PR #952.

The pattern

Each site converts a command failure into an empty or apparently-safe result,
then proceeds into a download, package install, sudoers-file write, or release
upgrade as if the check had passed:

  • host-setup/bootstrap.sh:86: resolve_ref() falls back to the moving $REF
    when commit resolution fails, instead of aborting.
  • host-setup/linux/install-tools.sh:245: apt_install_displacing() treats a
    failed apt-get -s install simulation as "no removals" instead of stopping
    before the real install.
  • host-setup/linux/install-tools.sh:1415-1417: the sudoers scan does not
    distinguish grep exit status 1 (no matches, expected) from a real scan
    error, before writing or deleting sudoers files.
  • host-setup/linux/upgrade-host.sh:245: proceeds into source rewriting and
    the release upgrade even if dpkg --audit itself failed to run, rather than
    only checking for packages the audit found.
  • host-setup/linux/upgrade-host.sh:177: upgradable_count()'s
    apt list --upgradable 2>/dev/null | grep -c '/' || true reports 0
    upgradable packages both when there genuinely are none and when
    apt list itself failed.

Where this was raised

Per pr-review-conduct's outcome 5 ("keeps recurring, so fix the class, not
the instance"), a finding shape raised twice against the same repo is the
signal to resolve the class here rather than keep re-declining each instance
piecemeal.

Ask

Review each site and decide, per site, whether the lenient fallback is
deliberate (and if so, say why inline so this stops resurfacing) or should
fail closed before the mutation it currently guards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions