diff --git a/.github/actions/setup-rusty-v8/action.yml b/.github/actions/setup-rusty-v8/action.yml index 5779fca149..909c4ef0b9 100644 --- a/.github/actions/setup-rusty-v8/action.yml +++ b/.github/actions/setup-rusty-v8/action.yml @@ -41,8 +41,10 @@ runs: checksum_command=(shasum -a 256 --check -) fi + # A fresh query avoids cached GitHub redirects with expired signatures. + query="cache_bust=$(date +%s)" mkdir -p "${binding_dir}" - curl -fsSL "${base_url}/${checksums_name}" -o "${checksums_path}" + curl -fsSL "${base_url}/${checksums_name}?${query}" -o "${checksums_path}" # Check the original manifest bytes even when either checksum file uses CRLF. expected_manifest_checksum="$(grep -F " ${checksums_name}" "${trusted_checksums}" | cut -d ' ' -f 1)" actual_manifest_checksum="$(python3 -c 'import hashlib, pathlib, sys; print(hashlib.sha256(pathlib.Path(sys.argv[1]).read_bytes()).hexdigest())' "${checksums_path}")" @@ -50,8 +52,8 @@ runs: echo "Checksum mismatch for ${checksums_name}: expected ${expected_manifest_checksum}, got ${actual_manifest_checksum}" >&2 exit 1 fi - curl -fsSL "${base_url}/${archive_name}" -o "${archive_path}" - curl -fsSL "${base_url}/${binding_name}" -o "${binding_path}" + curl -fsSL "${base_url}/${archive_name}?${query}" -o "${archive_path}" + curl -fsSL "${base_url}/${binding_name}?${query}" -o "${binding_path}" if [[ "$(wc -l < "${checksums_path}")" -ne 2 ]]; then echo "Expected exactly two checksums for ${TARGET} in ${checksums_path}" >&2 diff --git a/.github/scripts/setup-voice-windows.ps1 b/.github/scripts/setup-voice-windows.ps1 index a24d29b1f0..6f7f2ce491 100644 --- a/.github/scripts/setup-voice-windows.ps1 +++ b/.github/scripts/setup-voice-windows.ps1 @@ -32,7 +32,8 @@ $Inputs = @( digest = "6acea47c59781c9e7f544a18d53935d59df6e44d5d52ac95ee165671b8e388820455eebf30ccc7d254b00c3d0eb694269a0f8dc84b17944c1f355dac9c5aafcc" }, @{ - url = "https://github.com/pkgconf/pkgconf/releases/download/pkgconf-3.0.6/pkgconf-$($PkgHashes[$Target][0])-3.0.6.msi" + # A fresh query avoids cached GitHub redirects with expired signatures. + url = "https://github.com/pkgconf/pkgconf/releases/download/pkgconf-3.0.6/pkgconf-$($PkgHashes[$Target][0])-3.0.6.msi?cache_bust=$([guid]::NewGuid())" file = "pkgconf.msi" algorithm = "SHA256" digest = $PkgHashes[$Target][1] diff --git a/scripts/codex_package/dotslash.py b/scripts/codex_package/dotslash.py index 8b2d6bcde3..32b6d48554 100644 --- a/scripts/codex_package/dotslash.py +++ b/scripts/codex_package/dotslash.py @@ -3,10 +3,12 @@ import gzip import hashlib import json +import re import shutil import stat import tarfile import tempfile +import time import zipfile from dataclasses import dataclass from pathlib import Path @@ -168,6 +170,12 @@ def download_archive(url: str, archive_path: Path) -> None: temp_path = archive_path.with_suffix(f"{archive_path.suffix}.tmp") temp_path.unlink(missing_ok=True) try: + # A fresh query avoids cached GitHub redirects with expired signatures. + if re.fullmatch( + r"https://github\.com/[^/?#]+/[^/?#]+/releases/download/[^/?#]+/[^/?#]+", + url, + ): + url = f"{url}?cache_bust={time.time_ns()}" request = Request(url, headers={"User-Agent": "codex-package"}) with urlopen(request, timeout=DOWNLOAD_TIMEOUT_SECS) as response: with open(temp_path, "wb") as out: diff --git a/scripts/codex_package/v8.py b/scripts/codex_package/v8.py index 5208377cca..6c777fe61f 100644 --- a/scripts/codex_package/v8.py +++ b/scripts/codex_package/v8.py @@ -6,6 +6,7 @@ import hashlib import os import shutil import tempfile +import time from collections.abc import Mapping from dataclasses import dataclass from pathlib import Path @@ -59,6 +60,8 @@ def fetch_codex_v8_artifacts( release_url = ( f"https://github.com/openai/codex/releases/download/rusty-v8-v{version}" ) + # A fresh query avoids cached GitHub redirects with expired signatures. + query = f"cache_bust={time.time_ns()}" target = spec.target cache_dir = (cache_root or default_cache_root()) / f"rusty-v8-{version}-{target}" @@ -85,14 +88,14 @@ def fetch_codex_v8_artifacts( except (OSError, RuntimeError, ValueError): pass if not cached_manifest_valid: - download_file(f"{release_url}/{checksums.name}", checksums) + download_file(f"{release_url}/{checksums.name}?{query}", checksums) verify_release_checksum_manifest(checksums, version=version) expected_checksums = load_checksums(checksums, {archive.name, binding.name}) for artifact in [archive, binding]: ensure_valid_artifact( artifact, expected_checksums[artifact.name], - f"{release_url}/{artifact.name}", + f"{release_url}/{artifact.name}?{query}", ) return RustyV8ArtifactPair(archive=archive, binding=binding)