git-gate gateway bakes in wrong-arch gitleaks (Exec format error on push) #407
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Dockerfile.gatewayhardcoded the x86_64 gitleaks release asset (gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz). An image built on/for aarch64 (Apple Silicon) therefore bakes in an x86_64 gitleaks binary.The mismatch is silent at build time. It only surfaces when the git-gate pre-receive hook first invokes gitleaks, where the kernel refuses to exec the foreign-arch binary:
Every push through an arm64-built gateway then fails. This is not a per-sandbox / push-logic issue — it is the gateway image being built for the wrong architecture. Branches that "pushed fine" did so through an x86_64 gateway or a cached layer.
Fix
Select the gitleaks asset + pinned SHA256 from the build's target architecture:
TARGETARCH(auto-populated by BuildKit), with adpkg --print-architecturefallback for a legacy builderThe existing integration test
test_gateway_image.py::test_gitleaks_binary_present_and_versionedexecsgitleaks versioninside the built image, so it now passes on arm64 instead of hitting the same error.Verified end-to-end on an arm64 host: build resolves
TARGETARCH=arm64->linux_arm64, SHA checks OK, and/usr/bin/gitleaks version->8.30.1(no exec-format error).