@@ -3,22 +3,18 @@ inputs:
33 dir :
44 type : string
55 default : " .reviews/.oxlint"
6- oxlintTag :
7- type : string
8- default : " apps_v1.74.0"
9- tsgolintVersion :
10- type : string
11- default : " 0.25.0"
126---
137
148``` bash silent exec
15- # pipefail so a failed download (curl -f) aborts the block instead of being
16- # masked by tar — provisioning must fail loudly, never silently degrade the
17- # review. The workflow guards on the resulting binaries (see review.yml).
9+ # Provisions the pinned oxlint + tsgolint binaries with mandatory sha256
10+ # verification, failing closed — a failed or tampered download must abort the
11+ # review, never silently degrade it. Version pins live next to their hashes so
12+ # neither can change without the other. The workflow guards on the resulting
13+ # binaries (see review.yml).
1814set -euo pipefail
1915DIR=" {dir}"
20- OXLINT_TAG=" {oxlintTag} "
21- TSGOLINT_VERSION=" {tsgolintVersion} "
16+ OXLINT_TAG=" apps_v1.74.0 "
17+ TSGOLINT_VERSION=" 0.25.0 "
2218mkdir -p " $DIR "
2319
2420os=" $( uname -s) "
@@ -34,10 +30,35 @@ case "$arch" in
3430 * ) echo " EnsureOxlint: unsupported arch $arch " >&2 ; exit 1 ;;
3531esac
3632
33+ case " ${ox_arch} -${ox_os} " in
34+ aarch64-apple-darwin) ox_sha=" 768a2d00e7e0a95cbf89837086f475d25dc1a1ba605b8831fb5a1db6d590a643" ;;
35+ x86_64-apple-darwin) ox_sha=" 04ae38d56ae4990ac96320c03f05f38cf1103b5fe64b08cd7203b87e767b45b4" ;;
36+ aarch64-unknown-linux-gnu) ox_sha=" ced0d2433bda2b4295e1ab93b40c3f24224713c32a44e13abcda656590dba1cb" ;;
37+ x86_64-unknown-linux-gnu) ox_sha=" fd3ed5d2dc55ab6f7a243583c69dd5da4ac97cd1f6e10321225ca6343c9451a9" ;;
38+ esac
39+ case " ${tg_os} -${tg_arch} " in
40+ darwin-arm64) tg_sha=" 3ad51d1b88070b491b81a4f5c6169148914127b9da65f8087823b25568431e1e" ;;
41+ darwin-x64) tg_sha=" 6b78caa20db383c055cead96724aeafab3cd277b00b1f95c6f56b4bfcf22fd60" ;;
42+ linux-arm64) tg_sha=" 20bcbab4bb37dd396102566740ee39e67d1e3d16d06096802180426c022bc414" ;;
43+ linux-x64) tg_sha=" f6ea083842395d7439eadbbbf380f23793a1fa890fbda92013ee0f6033e75630" ;;
44+ esac
45+
46+ if command -v sha256sum > /dev/null 2>&1 ; then sha_cmd=" sha256sum" ; else sha_cmd=" shasum -a 256" ; fi
47+
48+ verify () {
49+ actual=" $( $sha_cmd " $1 " | awk ' {print $1}' ) "
50+ if [ " $actual " != " $2 " ]; then
51+ echo " EnsureOxlint: checksum mismatch for $1 (expected $2 , got $actual )" >&2
52+ exit 1
53+ fi
54+ }
55+
3756# oxlint: standalone binary from the oxc release (no Node/npm needed).
3857if [ ! -x " $DIR /oxlint" ]; then
3958 tmp=" $( mktemp -d) "
40- curl -fsSL " https://github.com/oxc-project/oxc/releases/download/${OXLINT_TAG} /oxlint-${ox_arch} -${ox_os} .tar.gz" | tar xz -C " $tmp "
59+ curl -fsSL -o " $tmp /oxlint.tar.gz" " https://github.com/oxc-project/oxc/releases/download/${OXLINT_TAG} /oxlint-${ox_arch} -${ox_os} .tar.gz"
60+ verify " $tmp /oxlint.tar.gz" " $ox_sha "
61+ tar xz -C " $tmp " -f " $tmp /oxlint.tar.gz"
4162 mv " $tmp /oxlint-${ox_arch} -${ox_os} " " $DIR /oxlint"
4263 chmod +x " $DIR /oxlint"
4364 rm -rf " $tmp "
4667# tsgolint (type-aware engine): npm-only, so pull the platform tarball directly.
4768if [ ! -x " $DIR /tsgolint" ]; then
4869 tmp=" $( mktemp -d) "
49- curl -fsSL " https://registry.npmjs.org/@oxlint-tsgolint/${tg_os} -${tg_arch} /-/${tg_os} -${tg_arch} -${TSGOLINT_VERSION} .tgz" | tar xz -C " $tmp "
70+ curl -fsSL -o " $tmp /tsgolint.tgz" " https://registry.npmjs.org/@oxlint-tsgolint/${tg_os} -${tg_arch} /-/${tg_os} -${tg_arch} -${TSGOLINT_VERSION} .tgz"
71+ verify " $tmp /tsgolint.tgz" " $tg_sha "
72+ tar xz -C " $tmp " -f " $tmp /tsgolint.tgz"
5073 mv " $tmp /package/tsgolint" " $DIR /tsgolint"
5174 chmod +x " $DIR /tsgolint"
5275 rm -rf " $tmp "
0 commit comments