Codex CLI install.sh: verify_archive_digest overwrites global archive_path
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 80/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- bash
- Domain
- cli
Research direction
Inspect install.sh at verify_archive_digest and the package download flow around the archive_path and checksum_path assignments. Reproduce the package-layout path using the issue's pre-downloaded files, then verify that checksum validation does not change the archive destination and that installation reads the downloaded archive from the intended temporary path.
Written by the indexing model from the issue text.
Description
What version of Codex CLI is running?
Unrelated
What subscription do you have?
Unrelated
Which model were you using?
Unrelated
What platform is your computer?
Linux 6.8.0-124-generic x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
bash
Codex doctor report
Unrelated
What issue are you seeing?
This is not a CLI bug, but a bug in install.sh.
Root cause
verify_archive_digest reuses the global name archive_path for its first parameter:
verify_archive_digest() { archive_path="$1" ... }
In install.sh, the verify_archive_digest function assigns its first argument to the global variable archive_path. When install_layout="package", the script first verifies the checksum manifest file, which overwrites archive_path with the checksum file path. It then downloads the tarball to archive_path—which now points to the checksum file location. Because the tarball overwrites the checksum file in place, the install may still appear to succeed even though $tmp_dir/$asset is never written to.
Execution flow
archive_path="$tmp_dir/$asset"— e.g./tmp/.../codex-package-<target>.tar.gzchecksum_path="$tmp_dir/$checksum_asset"— e.g./tmp/.../codex-package_SHA256SUMSdownload_file "$checksum_url" "$checksum_path"— checksum manifest downloaded correctlyverify_archive_digest "$checksum_path" "$checksum_digest"— overwrites globalarchive_pathtochecksum_pathdownload_file "$download_url" "$archive_path"— package is downloaded to the checksum file path, overwriting the manifestverify_archive_digest "$archive_path" "$expected_digest"— verifies the tarball at the checksum path (may still pass)install_package_release "$release_dir" "$archive_path"— extracts from the checksum path (may still succeed)
The intended path $tmp_dir/$asset is never written to.
What steps can reproduce the bug?
Pre-download the checksum file and tarball, and place them alongside install.sh. Echo checksum_url and download_url from the script to obtain the download URLs.
Modify install.sh approximately as follows:
#archive_path="$tmp_dir/$asset"
archive_path="$asset"
#checksum_path="$tmp_dir/$checksum_asset"
checksum_path="$checksum_asset"
echo "asset: $asset"
echo "checksum_asset: $checksum_asset"
echo "previous archive_path: $archive_path"
step "Downloading Codex CLI"
if [ "$install_layout" = "package" ]; then
checksum_digest="$(release_asset_digest "$checksum_asset")"
#download_file "$checksum_url" "$checksum_path"
verify_archive_digest "$checksum_path" "$checksum_digest"
echo "later archive_path: $archive_path"
expected_digest="$(package_archive_digest "$asset" "$checksum_path")"
else
expected_digest="$(release_asset_digest "$asset")"
fi
#download_file "$download_url" "$archive_path"
verify_archive_digest "$archive_path" "$expected_digest"
You can observe both path variable values in the output and the checksum verification failure from verify_archive_digest.
What is the expected behavior?
Checksum verification should not overwrite the global archive_path variable.
Additional information
How this was discovered
The machine that needed Codex CLI could not download the two URLs referenced by the install script. I echoed checksum_url and download_url, downloaded both files manually on another machine, then placed them in the same directory as install.sh. I changed lines ~1000–1001 from $tmp_dir/$asset / $tmp_dir/$checksum_asset to "$asset" and "$checksum_asset" so the script would use the pre-downloaded local files.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- Avg merge
- 1m
- Merged PRs (30d)
- 1k
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·