Commit dee512f
committed
refactor(logic): scope testcontainers helpers to the test build
go/logic/test_utils.go had no _test.go suffix, so it was part of the
ordinary build of package logic. It imports testcontainers-go, and
package logic is imported by go/cmd/gh-ost, so testcontainers and its
transitive dependencies -- including github.com/docker/docker -- were
compiled into the released gh-ost binary and recorded in its build info.
That is what puts docker/docker in vulnerability scans of the release
binary. Trivy reports 3 HIGH CVEs against docker/docker v28.0.1:
CVE-2026-34040, CVE-2026-41567 and CVE-2026-42306. None can be fixed by
a version bump: all three are first patched in 29.3.1, but at v29 the
module was renamed to github.com/moby/moby/v2 and its tags are named
docker-v29.x.y, which Go cannot resolve as module versions. The
github.com/docker/docker path is frozen at v28.5.2+incompatible.
Renaming the file to test_utils_test.go keeps it available to the tests
in the same package while excluding it from the ordinary build. Every
identifier it declares is referenced only from applier_test.go,
streamer_test.go and migrator_test.go, so nothing else changes.
Effect on the linux/amd64 binary:
- modules recorded in build info: 60 -> 22
- Trivy HIGH/CRITICAL: 20 -> 0
This also drops testcontainers-go and golang.org/x/crypto out of the
binary. Both remain in go.mod for the test suite.1 parent 69d4d3c commit dee512f
1 file changed
File renamed without changes.
0 commit comments