Verify wx source provenance before reusing prefix

This commit is contained in:
2026-10-18 21:56:00 -06:00
parent d0ecaea174
commit cb4c56679d
4 changed files with 37 additions and 22 deletions
+1 -6
View File
@@ -38,12 +38,7 @@ jobs:
path: /root/.cache/wx-3.3.3-linux
key: ${{ steps.wx-key.outputs.key }}
- name: Build wxWidgets
run: |
if [ ! -x "$WX_PREFIX/bin/wx-config" ] ||
[ ! -s "$WX_PREFIX/lib/libwx_gtk3u-3.3.a" ]; then
bash scripts/build-wx-linux.sh
fi
[ -s "$WX_PREFIX/lib/libwx_gtk3u-3.3.a" ]
run: bash ci/ensure-wx-prefix.sh
- name: Save vendored wxWidgets build
if: steps.wx-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
+1 -8
View File
@@ -66,14 +66,7 @@ jobs:
key: ${{ steps.wx-key.outputs.key }}
- name: Build wxWidgets (once, then cached)
run: |
if [ ! -x "$WX_PREFIX/bin/wx-config" ] ||
[ ! -s "$WX_PREFIX/lib/libwx_gtk3u-3.3.a" ]; then
bash scripts/build-wx-linux.sh
else
echo "wx prefix restored from cache"
fi
[ -s "$WX_PREFIX/lib/libwx_gtk3u-3.3.a" ]
run: bash ci/ensure-wx-prefix.sh
- name: Save vendored wxWidgets build
if: steps.wx-cache.outputs.cache-hit != 'true'
+1 -8
View File
@@ -68,14 +68,7 @@ jobs:
- name: Build wxWidgets (once, then cached)
if: steps.surface.outputs.surface == 'full'
run: |
if [ ! -x "$WX_PREFIX/bin/wx-config" ] ||
[ ! -s "$WX_PREFIX/lib/libwx_gtk3u-3.3.a" ]; then
bash scripts/build-wx-linux.sh
else
echo "wx prefix restored from cache"
fi
[ -s "$WX_PREFIX/lib/libwx_gtk3u-3.3.a" ]
run: bash ci/ensure-wx-prefix.sh
- name: Save vendored wxWidgets build
if: steps.surface.outputs.surface == 'full' && steps.wx-cache.outputs.cache-hit != 'true'
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# Use the matching image or cache prefix; rebuild after a vendored source bump.
set -euo pipefail
prefix="${WX_PREFIX:?WX_PREFIX is required}"
expected="$(awk '$1 == "sha256:" {print $2}' thirdparty/wxwidgets/VERSION)"
[[ "$expected" =~ ^[0-9a-f]{64}$ ]] || {
echo 'invalid pinned wxWidgets source digest' >&2
exit 1
}
marker="$prefix/.alkane-source-sha256"
if [ -e "$marker" ] && [ "$(cat "$marker")" != "$expected" ]; then
python3 - "$prefix" <<'PY'
from pathlib import Path
import shutil
import sys
prefix = Path(sys.argv[1])
allowed = Path('/root/.cache/wx-3.3.3-linux')
if prefix != allowed or prefix.is_symlink():
raise SystemExit('refusing unsafe wxWidgets prefix reset')
if prefix.is_dir():
shutil.rmtree(prefix)
PY
fi
if [ ! -x "$prefix/bin/wx-config" ] ||
[ ! -s "$prefix/lib/libwx_gtk3u-3.3.a" ]; then
bash scripts/build-wx-linux.sh
else
echo 'wx prefix available from matching image or cache'
fi
[ -s "$prefix/lib/libwx_gtk3u-3.3.a" ]
printf '%s\n' "$expected" > "$marker"