Skip to content

setup-host.sh: pipes Rust install script directly to sh — no checksum, no version pin #236

@jelloee

Description

@jelloee

scripts/setup-host.sh:

say "Installing Rust (if missing)..."
if ! command -v cargo >/dev/null; then
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
    source "$HOME/.cargo/env"
fi

This is the upstream-recommended Rust install path, so it's not unusual. But for a project that takes operator security seriously elsewhere (the systemd unit is hardened, the audit log story is in place), the curl-pipe-sh pattern stands out:

  1. No checksum. A compromise of sh.rustup.rs (TLS termination at Cloudflare, etc.) would inject arbitrary shell into every developer's machine running this script.
  2. No version pin. A new Rust release that breaks the project's rust-toolchain.toml would silently land in the host environment.

Both are mitigated by the fact that rust-toolchain.toml exists and cargo honors it — so the project builds with the right toolchain anyway. The installed cargo itself doesn't matter much, since rustup will fetch the pinned toolchain on first cargo build.

Still, two pragmatic improvements:

  1. Mention in the comment that the project pin comes from rust-toolchain.toml, so installing the latest rustup is intentional and safe.
  2. If a future operator-paranoid mode is wanted, switch to the rustup-init binary download + sha256 verify pattern.

Severity: Low / supply-chain hygiene.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions