mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 14:38:59 +02:00
fix: hash with sha256sum before shasum on Linux (config slugs + setup verify)
shasum is perl/macOS; coreutils-only Linux ships sha256sum. Two call sites hard-coded shasum: gstack-config's sha8_of/sha16 (so resolve-user-slug exited 127 for any Linux user with a git email, the Layer-3 fallback) and the generated bun-installer checksum snippet in the browse/qa NEEDS_SETUP flow (spurious "checksum mismatch" on the same distros). Both now resolve sha256sum first and fall back to shasum -a 256. New shim-PATH tests pin BOTH hasher branches of sha8_of to a known vector and cover the sha8->sha16 collision escalation end to end.
This commit is contained in:
@@ -138,7 +138,13 @@ If \`NEEDS_SETUP\`:
|
||||
BUN_INSTALL_SHA="bab8acfb046aac8c72407bdcce903957665d655d7acaa3e11c7c4616beae68dd"
|
||||
tmpfile=$(mktemp)
|
||||
curl -fsSL "https://bun.sh/install" -o "$tmpfile"
|
||||
actual_sha=$(shasum -a 256 "$tmpfile" | awk '{print $1}')
|
||||
# shasum is macOS/perl; coreutils-only Linux ships sha256sum instead —
|
||||
# resolve whichever exists so the verify never fails on a missing tool.
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
actual_sha=$(sha256sum "$tmpfile" | awk '{print $1}')
|
||||
else
|
||||
actual_sha=$(shasum -a 256 "$tmpfile" | awk '{print $1}')
|
||||
fi
|
||||
if [ "$actual_sha" != "$BUN_INSTALL_SHA" ]; then
|
||||
echo "ERROR: bun install script checksum mismatch" >&2
|
||||
echo " expected: $BUN_INSTALL_SHA" >&2
|
||||
|
||||
Reference in New Issue
Block a user