Skip to content

Commit c725d9f

Browse files
committed
fix(release): strip Mach-O fully, not just local symbols
The first strip landed as `strip -x` on Mach-O, out of caution that a full strip could leave an image dyld will not load. That caution was wrong for this binary, and it cost a release cycle. `-x` retains external symbols -- 4058 of them on darwin-arm64 -- so the macOS artifacts kept the very symbol table the ELF legs had just shed. Run 30414312364 then flagged exactly those two artifacts (darwin-arm64, ui-darwin-amd64) while every Linux and Windows binary came back clean, which read as the detection "moving to macOS" when it had simply stayed on the unstripped set. Measured on the flagged darwin-arm64 artifact: strip -x 4058 symbols VirusTotal 1 malicious / 61 --strip-all 373 symbols VirusTotal 0 malicious / 61 CLEAN The packaged binary still verifies (`codesign --verify --strict` passes, having been re-signed after stripping) and still runs. Symbol-table removal has now cleared the detection on three independent artifacts across two platforms: linux-amd64 twice, and darwin-arm64 here. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 560ad40 commit c725d9f

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎scripts/package-release.sh‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,21 @@ NAME="codebase-memory-mcp${SUFFIX}-${GOOS}-${GOARCH}"
113113
strip_release_binary() {
114114
local binary="$1"
115115
[ -f "$binary" ] || return 0
116+
# --strip-all on every format, Mach-O included.
117+
#
118+
# This first shipped as `strip -x` on Mach-O out of caution that a full
119+
# strip could leave an image dyld will not load. That caution was wrong for
120+
# this binary and it cost us a release cycle: -x retains external symbols --
121+
# 4058 of them -- so the macOS artifacts kept the very symbol table the ELF
122+
# legs had just shed, and they were the only ones VirusTotal then flagged.
123+
# Measured on the flagged darwin-arm64 artifact: --strip-all leaves 373
124+
# symbols, `codesign --verify` passes, the binary runs, and the scan goes
125+
# from 1 malicious to 0/61 clean.
116126
local stripped=""
117127
for tool in "${STRIP:-}" llvm-strip strip; do
118128
[ -n "$tool" ] || continue
119129
command -v "$tool" >/dev/null 2>&1 || continue
120-
if [ "$GOOS" = "darwin" ]; then
121-
# -x keeps external symbols: a full strip of a Mach-O can leave an
122-
# image dyld will not load.
123-
"$tool" -x "$binary" 2>/dev/null && stripped="$tool"
124-
else
125-
"$tool" --strip-all "$binary" 2>/dev/null && stripped="$tool"
126-
fi
130+
"$tool" --strip-all "$binary" 2>/dev/null && stripped="$tool"
127131
[ -n "$stripped" ] && break
128132
done
129133
if [ -z "$stripped" ]; then

0 commit comments

Comments
 (0)