fix(release): strip shipped binaries - #1328
Merged
Merged
Conversation
Release binaries carried their full symbol table. Production compiles without -g, but the linker keeps .symtab regardless, so every archive shipped ~536 KB of internal function names that nothing needs: a bigger download and a free map of the internals, by accident rather than by decision. Nothing symbolizes at runtime -- mem_profile.c is not in the production build and never calls backtrace_symbols -- so no diagnostics are lost. It also had a concrete cost. Microsoft's ML scored the unstripped linux-amd64 binary Trojan:Script/Wacatac.B!ml (1 engine of 62) and blocked release run 30398064336 at the VirusTotal gate. That verdict is a decision-boundary artifact, not a property of the code, and the evidence is unambiguous: * the dry-run build two days earlier (d587dea) is the same program 10 KB larger and scans CLEAN -- a 0.003% delta flips the verdict * the delta in that window is almost entirely DELETION of Windows-only files that Linux never compiled * the ui build of the same commit was never flagged * two independently flagged builds drew different sub-variants (Wacatac.B and Wacatac.C), which a real signature does not do * v0.9.0, re-analysed against the same engine build, is still clean -- so this is not model drift either Stripping removes the symbol-name feature surface those models score. It cleared BOTH flagged builds, and every other platform stays clean, so this fixes Linux without trading the problem sideways. Verified before merge: linux-amd64 (f440743) stripped 0 malicious / 62 engines linux-amd64 (0802689) stripped 0 malicious / 62 engines linux-arm64 stripped 0 malicious / 61 engines linux-amd64-portable stripped 0 malicious / 62 engines windows-amd64 stripped 0 malicious / 68 engines darwin-arm64 stripped + re-signed 0 malicious / 60 engines macOS needs care and gets it. The build workflow ad-hoc signs BEFORE this script runs, so stripping invalidates that signature and the kernel then refuses to exec the image; Mach-O is re-signed here. It also uses `strip -x` rather than --strip-all, because a full strip can leave an image dyld will not load. The packaged macOS binary verifies (`valid on disk`, `satisfies its Designated Requirement`) and runs, and the full macOS smoke passes against a stripped, re-signed binary. Build fingerprints are derived from the file itself during execution, with nothing embedded during compilation, so staged and target agree and activation is unaffected. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release run 30398064336 was blocked at the VirusTotal gate: Microsoft's ML
scored the unstripped
linux-amd64binaryTrojan:Script/Wacatac.B!ml(1 engine of 62). Everything else in that run passed -- full test matrix, build,
soak, and all six Windows smoke jobs.
The detection is a decision boundary, not our code
d587dea) is the same program 10 KBlarger and scans CLEAN -- a 0.003% delta flips the verdict
files that Linux never compiled
uibuild of the same commit was never flaggedWacatac.BandWacatac.C) -- a real signature does not wanderis not model drift either
The fix stands on its own merits
We were shipping unstripped binaries. Production compiles without
-g, but thelinker keeps
.symtabregardless, so every release carried ~536 KB of internalfunction names: a bigger download and a free map of the internals, by accident
rather than by decision. Nothing symbolizes at runtime (
mem_profile.cis notin the production build and never calls
backtrace_symbols), so no diagnosticsare lost.
Stripping removes the symbol-name feature surface these models score.
Verified before merge, all platforms
f440743) stripped0802689) strippedBoth flagged builds cleared, and the four already-clean platforms stayed clean --
so this fixes Linux without trading the problem sideways.
macOS
The build workflow ad-hoc signs before this script runs, so stripping
invalidates that signature and the kernel then refuses to exec the image. Mach-O
is re-signed here, and uses
strip -xrather than--strip-allbecause a fullstrip can leave an image dyld will not load. Verified: packaged binary reports
valid on disk/satisfies its Designated Requirement, runs, and the fullmacOS smoke passes against a stripped, re-signed binary.
Build fingerprints are derived from the file during execution with nothing
embedded during compilation, so staged and target agree and activation is
unaffected.