ReviewOS

also looking at this

craft-native/craft

fix(release): prevent the standalone macOS CLI sandbox crash

#291
Merged glennmichael123 wants to merge codex/macos-cli-signing into main
5 files +120 -31
.github/workflows/release.ymlmodified+40-7
Changes to .github/workflows/release.yml
@@ -237,14 +237,9 @@ jobs:
237237
238238 - name: Sign macOS binary
239239 if: runner.os == 'macOS' && env.SIGNING_AVAILABLE == 'true'
240 env:
241 # Default to the strict distribution entitlements; CI can opt in to
242 # the dev plist (sandbox off, library validation off) by setting
243 # CRAFT_ENTITLEMENTS=dev for local debugging — never for release.
244 ENTITLEMENTS_VARIANT: ${{ vars.CRAFT_ENTITLEMENTS || 'distribution' }}
245240 run: |
246241 set -euo pipefail
247 ENTITLEMENTS="scripts/entitlements-${ENTITLEMENTS_VARIANT}.plist"
242 ENTITLEMENTS="scripts/entitlements-distribution.plist"
248243 if [ ! -f "$ENTITLEMENTS" ]; then
249244 echo "::error file=$ENTITLEMENTS::missing — required for hardened-runtime signing"
250245 exit 1
@@ -253,12 +248,21 @@ jobs:
253248 for binary in \
254249 packages/zig/zig-out/bin/craft \
255250 packages/zig/zig-out/cross/darwin-x64/craft; do
256 codesign --force --options runtime --sign "$APPLE_SIGNING_IDENTITY" \
251 codesign --force --options runtime --timestamp --sign "$APPLE_SIGNING_IDENTITY" \
257252 --entitlements "$ENTITLEMENTS" "$binary"
258253 codesign --verify --deep --strict "$binary"
259254 done
260255 echo "macOS ARM64 and x64 binaries signed successfully"
261256
257 - name: Verify standalone macOS launch and signatures
258 if: runner.os == 'macOS'
259 env:
260 VERSION: ${{ steps.version.outputs.version }}
261 run: |
262 bun test scripts/macos-release.test.ts
263 bun scripts/verify-macos-release.ts packages/zig/zig-out/bin/craft "$VERSION"
264 bun scripts/verify-macos-release.ts packages/zig/zig-out/cross/darwin-x64/craft "$VERSION" --no-execute
265
262266 - name: Notarize macOS binaries
263267 if: runner.os == 'macOS' && env.SIGNING_AVAILABLE == 'true'
264268 run: |
@@ -399,6 +403,35 @@ jobs:
399403 cat /tmp/index.out || true
400404 fi
401405
406 verify-macos-downloads:
407 name: verify downloaded ${{ matrix.platform.name }}
408 needs: [pantry]
409 if: ${{ !cancelled() }}
410 strategy:
411 fail-fast: false
412 matrix:
413 platform:
414 - { os: macos-15, name: darwin-arm64 }
415 - { os: macos-15-intel, name: darwin-x64 }
416 runs-on: ${{ matrix.platform.os }}
417 permissions:
418 contents: read
419 steps:
420 - uses: actions/checkout@v6
421 - name: Setup Pantry
422 uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777
423 - name: Verify the final downloadable executable
424 env:
425 GH_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
426 TAG: ${{ github.ref_name }}
427 PLATFORM: ${{ matrix.platform.name }}
428 run: |
429 set -euo pipefail
430 DOWNLOAD_DIR=$(mktemp -d)
431 gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "craft-$PLATFORM.zip" --dir "$DOWNLOAD_DIR"
432 ditto -x -k "$DOWNLOAD_DIR/craft-$PLATFORM.zip" "$DOWNLOAD_DIR/extracted"
433 bun scripts/verify-macos-release.ts "$DOWNLOAD_DIR/extracted/craft" "${TAG#v}"
434
402435 npm:
403436 name: npm
404437 # Ordered after the binaries, not gated on them.