feat(run): auto-resolve Linux binary for cross-platform security scan - #662
Conversation
Review: #662Head SHA: 287c431 SummaryThis PR adds a well-structured cross-platform binary resolution system for running security scans inside Linux sandboxes from macOS hosts. The security hardening is solid: SHA256 checksum verification on downloads, path traversal protection in tar extraction, size limits on both compressed and extracted data, ELF validation, and a strict architecture allowlist. Two medium-severity findings are worth addressing but neither blocks merge: (1) when binary resolution fails in open mode, the sandbox-side scan is attempted but fails with confusing warnings rather than being explicitly skipped, and (2) on Linux hosts with FindingsCriticalNone. HighNone. Medium
Low
Info
FooterOutcome: comment-only Previous runReview: #662Head SHA: b30573e SummaryThis PR adds a well-structured cross-platform binary resolution system for the pre-agent security scan. The implementation is solid: path traversal protection in tar extraction, size limits via FindingsMedium
Low
Info
FooterOutcome: comment-only Previous run (2)Review: #662Head SHA: c105b7f SummaryWell-structured feature that solves a real cross-platform problem with solid security hardening (path traversal protection, size limits, ELF validation, arch whitelist). The fallback chain is sensible and well-documented. Three non-blocking observations: the binary-resolution failure path doesn't check FindingsMedium
Low
Info
FooterOutcome: comment-only |
When running fullsend on macOS with a Linux sandbox, the pre-agent security scan fails because the host Mach-O binary cannot execute inside the Linux container. Add automatic Linux binary resolution with a 4-priority fallback chain: 1. --fullsend-binary <path> (explicit, skips auto-resolution) 2. Download from GitHub Release matching CLI version 3. Cross-compile from source (requires Go toolchain) 4. Download latest release (fallback when cross-compile fails) Security hardening: - Path traversal protection in tar extraction (reject ".." and absolute) - io.LimitReader on compressed stream (200 MB) and extracted binary (500 MB) - HTTP client with 120s timeout (replaces http.DefaultClient) - ELF validation: OS/ABI + architecture match against sandbox target - FULLSEND_SANDBOX_ARCH whitelist (amd64, arm64 only) - GOMOD=/dev/null edge case handling in cross-compilation - Oversized binary cleanup on error path Update local-dev.md with binary resolution docs and FULLSEND_SANDBOX_ARCH usage. Signed-off-by: Wayne Sun <gsun@redhat.com>
b30573e to
07acd77
Compare
When resolveLinuxBinary() fails and the harness has fail_mode: closed (the default), bootstrapSandbox() now returns a hard error instead of silently skipping the security scan. Only fail_mode: open harnesses get warning-and-continue behavior. Downloaded release binaries are now verified against the GoReleaser checksums.txt before extraction. Checksum mismatch is a hard failure. Signed-off-by: Wayne Sun <gsun@redhat.com>
Add hex.DecodeString validation and strings.ToLower normalization to downloadChecksumForAsset. Produces a clear "invalid hex hash" error instead of a misleading "checksum mismatch" when checksums.txt contains non-hex characters or uppercase hex. Signed-off-by: Wayne Sun <gsun@redhat.com>
Summary
fullsend runon macOS with a Linux sandbox, the pre-agent security scan (fullsend scan context) fails because the host Mach-O binary cannot execute inside the Linux container--fullsend-binary, download from matching GitHub Release, cross-compile from source, download latest releaseio.LimitReaderon compressed stream (200 MB) and extracted binary (500 MB), HTTP client with 120s timeout, ELF validation (OS/ABI + architecture),FULLSEND_SANDBOX_ARCHwhitelist,GOMOD=/dev/nullhandlingdocs/guides/dev/local-dev.mdwith binary resolution docs andFULLSEND_SANDBOX_ARCHusageA companion user-facing guide (
docs/guides/user/running-agents-locally.md) is split into a separate PR: #663.Test plan
go test -short ./internal/cli/— all tests passgo test -short ./...— full suite passes, no regressionsgo vet ./internal/cli/— cleanmake lint— cleanfullsend run reviewon macOS/arm64 with podman Linux sandbox auto-downloads Linux binary and completes security scan--fullsend-binarywith explicit cross-compiled binaryos.Executable()directly)