Files
dotfiles-public/.tests/mutations/26-docker-script-piped-to-root-shell.mut
T
bcherb2 9b81bfb616 test: mutations for the docker script channel
One pipes get.docker.com straight into a root shell; one reports the plugin rows as covered after a failed install. Both are killed by the unit suite.
2026-11-18 01:41:43 -05:00

19 lines
1021 B
Plaintext

# what: get.docker.com piped straight into a root sh instead of downloaded and checked
# why: no pipefail in sh: a 404 or truncated body runs as root AND reports success
# kills: a failed download is reported, not swallowed
# run: unit
<<<OLD
run_sh "curl -fsSL https://get.docker.com -o '$WORKDIR/get-docker.sh' && [ -s '$WORKDIR/get-docker.sh' ]" \
|| { note_fail "$key" "the Docker install script download failed or arrived empty"
DOCKER_SCRIPTED=fail; continue; }
# get.docker.com escalates on its own when it is not run as root,
# but this box may have no sudo at all and dotup already knows
# which -- so pass it explicitly and keep the command that is
# printed identical to the one that runs.
run_sh "${SUDO:+$SUDO }sh '$WORKDIR/get-docker.sh'" \
|| { note_fail "$key" "the official Docker install script failed"
<<<NEW
run_sh "curl -fsSL https://get.docker.com | ${SUDO:+$SUDO }sh" \
|| { note_fail "$key" "the official Docker install script failed"
<<<END