Skip to content

Commit 266cf78

Browse files
committed
test(tier4): simplify the digest-tamper fixture (ponytail-review)
Drop the dead pre-existence guard around the bundle extraction (WORK is always a fresh mktemp -d, so the dir can never already exist) and replace the last-hex-char-flip case statement with a fixed all-zero 64-char digest — same effect (a well-formed but mismatched sha256), fewer lines.
1 parent 7411733 commit 266cf78

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

scripts/release-smoke.sh

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,8 @@ verify_release() {
187187
verify_release_images_direct() {
188188
stage "verify_release_images() direct exercise (#376/#459) — the real host-path function"
189189
local bundle_dir="$WORK/pithead"
190-
if [ ! -d "$bundle_dir" ]; then
191-
tar -xzf "$WORK/pithead.tar.gz" -C "$WORK" ||
192-
die "Could not extract the published bundle to exercise verify_release_images()."
193-
fi
190+
tar -xzf "$WORK/pithead.tar.gz" -C "$WORK" ||
191+
die "Could not extract the published bundle to exercise verify_release_images()."
194192
[ -x "$bundle_dir/pithead" ] || die "Extracted bundle has no executable pithead at $bundle_dir."
195193

196194
if [ "$SIGNED" -eq 1 ]; then
@@ -220,18 +218,13 @@ verify_release_images_direct() {
220218
rm -rf "$tdir"
221219
cp -a "$bundle_dir" "$tdir"
222220
cp "$pub_src" "$tdir/cosign.pub"
223-
local orig_sha bad_sha last_char new_char
221+
local orig_sha bad_sha
224222
orig_sha="$(grep -oE 'pithead-tor:[^[:space:]]*@sha256:[0-9a-f]+' "$tdir/docker-compose.yml" | grep -oE 'sha256:[0-9a-f]+' | head -1)"
225223
[ -n "$orig_sha" ] ||
226224
die "Could not find a digest-pinned pithead-tor image in the bundle's docker-compose.yml to tamper — the bundle isn't digest-pinned (#461 regression)."
227-
# Flip the last hex character so the digest keeps its real shape (64 hex chars) but names a
228-
# manifest that exists nowhere in the registry — a mismatched, not malformed, digest.
229-
last_char="${orig_sha: -1}"
230-
case "$last_char" in
231-
0) new_char=1 ;;
232-
*) new_char=0 ;;
233-
esac
234-
bad_sha="${orig_sha%?}${new_char}"
225+
# A fixed all-zero 64-hex-char digest: the right SHAPE (a sha256 never legitimately hashes to
226+
# it) so verify_release_images sees a well-formed-but-mismatched digest, not a parse error.
227+
bad_sha="sha256:$(printf '%064d' 0)"
235228
sed -E "s#(pithead-tor:[^[:space:]]*@)$orig_sha#\\1$bad_sha#" "$tdir/docker-compose.yml" >"$tdir/docker-compose.yml.tmp" &&
236229
mv "$tdir/docker-compose.yml.tmp" "$tdir/docker-compose.yml"
237230
grep -qF "$bad_sha" "$tdir/docker-compose.yml" ||

0 commit comments

Comments
 (0)