Skip to content

build(cli): keep the Go symbol table in release binaries (drop -s, keep -w) - #151

Merged
dvcdsys merged 1 commit into
mainfrom
chore/cli-keep-symtab
Jul 19, 2026
Merged

build(cli): keep the Go symbol table in release binaries (drop -s, keep -w)#151
dvcdsys merged 1 commit into
mainfrom
chore/cli-keep-symtab

Conversation

@dvcdsys

@dvcdsys dvcdsys commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Follow-up to the GO-2026-5932 discussion on #150.

Problem

CLI release builds use -ldflags="-s -w". -s strips the Go symbol table,
which forces govulncheck -mode=binary into module-level fallback: it cannot
see which packages are actually linked, so it flags every advisory on every
required module — including GO-2026-5932 (x/crypto/openpgp), a package this
binary does not contain at all (x/crypto is pulled in solely for sha3 via
go-playground/validator).

Fix

Drop -s, keep -w (DWARF stripping) in release-cli.yml and
prerelease-cli.yml. With the symbol table present, binary-mode govulncheck
does real symbol-level analysis and the false positive disappears.

Measured on the current cli/ tree (darwin-arm64):

ldflags size govulncheck -mode=binary
-s -w (current) 13.5 MB "affected by 1 vulnerability" (module-level fallback)
-w (this PR) 15.0 MB 0 affected — openpgp correctly reported unreachable
none 20.0 MB 0 affected

Size cost of the fix: ~+11%.

Notes

  • Targeting main first (release workflows run from the tag ref, and CLI tags
    are cut from main). Needs the usual carry to develop so the floating
    cli/develop prerelease builds pick it up too — prerelease-cli.yml runs
    with the workflow file as it exists on develop.
  • server/Dockerfile* also build with -s -w, deliberately untouched: images
    are scanned by trivy/scout, which read Go buildinfo (module list), not
    symbols — dropping -s there would buy nothing.

🤖 Generated with Claude Code

…ep -w)

Stripped binaries (-s) force govulncheck -mode=binary into module-level
fallback: it cannot see which packages are actually linked, so it flags
every advisory on every required module — including GO-2026-5932
(x/crypto/openpgp), a package this binary does not contain at all.

With the symbol table present govulncheck does real symbol-level
analysis. Verified locally on the current cli/ tree:

  -s -w : 13.5 MB, binary scan reports "affected by 1 vulnerability"
  -w    : 15.0 MB, binary scan reports 0 (openpgp correctly unreachable)
  none  : 20.0 MB, binary scan reports 0

-w (DWARF stripping) stays, so the size cost is ~+11%, not +48%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dvcdsys
dvcdsys merged commit 04d50d4 into main Jul 19, 2026
7 checks passed
@dvcdsys
dvcdsys deleted the chore/cli-keep-symtab branch July 19, 2026 19:52
dvcdsys added a commit that referenced this pull request Jul 19, 2026
chore: carry symbol-table build fixes to develop (#151, #152)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant