Repository navigation
Harden docker-sbx install: remove curl|sudo sh root install #62991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
cca9839
daab099
63b999e
820506d
56149e1
3c476df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,32 @@ set +o histexpand | |
| # | ||
| # Usage: sudo_docker_sbx_install.sh | ||
| # No arguments required. | ||
| # | ||
| # Key notes: | ||
| # - Adds the Docker apt repository deterministically (pinned GPG key fetched to a | ||
| # file, signed-by apt source line) instead of piping the get.docker.com | ||
| # convenience script into a root shell. See: | ||
| # https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| echo "::group::Install docker-sbx" | ||
| # Add Docker apt repo without installing Docker Engine (already present). | ||
| curl -fsSL https://get.docker.com | sudo REPO_ONLY=1 sh | ||
| KEYRING_PATH="/etc/apt/keyrings/docker.asc" | ||
| SOURCE_LIST="/etc/apt/sources.list.d/docker.list" | ||
| DISTRO_ID="$(. /etc/os-release && echo "$ID")" | ||
| DISTRO_CODENAME="$(. /etc/os-release && echo "$VERSION_CODENAME")" | ||
|
|
||
| echo "Adding Docker apt repository for ${DISTRO_ID} ${DISTRO_CODENAME}..." | ||
| sudo install -m 0755 -d /etc/apt/keyrings | ||
| # runner-guard:ignore RGS-012 -- fetches Docker's GPG signing key to a file (never piped to a shell); the key is used only to verify the signed-by apt repository below. | ||
| curl -fsSL "https://download.docker.com/linux/${DISTRO_ID}/gpg" -o /tmp/docker.asc | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in 820506d:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/diagnosing-bugs] 💡 Suggested fixUse KEY_TMP="$(mktemp)"
trap 'rm -f "$KEY_TMP"' EXIT
curl -fsSL "(download.docker.com/redacted) -o "$KEY_TMP"
sudo install -m 0644 "$KEY_TMP" "${KEYRING_PATH}"This closes the same class of predictable-path risk the PR is otherwise fixing (unverified root-trust material), and is consistent with treating @copilot please address this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in 820506d: the downloaded key now uses
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Symlink/TOCTOU risk with predictable The sibling @copilot please address this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in 820506d: the installer now uses a private |
||
| sudo install -m 0644 /tmp/docker.asc "${KEYRING_PATH}" | ||
| rm -f /tmp/docker.asc | ||
|
|
||
| echo "deb [arch=$(dpkg --print-architecture) signed-by=${KEYRING_PATH}] https://download.docker.com/linux/${DISTRO_ID} ${DISTRO_CODENAME} stable" \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hard-codes 💡 Why this matters and how to harden itThe old
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in 820506d: the installer now validates non-empty |
||
| | sudo tee "${SOURCE_LIST}" > /dev/null | ||
|
|
||
| sudo apt-get update -qq | ||
| sudo apt-get install -y docker-sbx | ||
| sbx version | ||
| # Fix KVM permissions so the runner user can create microVMs. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in 820506d: the downloaded key is verified with
gpg --show-keysagainst the pinned Docker fingerprint before installation. The inline rotation instruction requires verifying any replacement against Docker's published signing-key documentation.