Repository navigation
fix(deps): keep the klauspost/compress floor across go mod tidy - #1520
Merged
Merged
Conversation
Merging #1517 resolved CHANGELOG.md with the stale side of its Unreleased section: - the three Security entries for the v1 BSON driver removal (#1497) and the "go mod tidy runs again" Fixed entry were dropped; - thirteen Fixed entries and the klauspost/compress Security block were duplicated. upstream/main's copy was intact, so the next sync would have carried the damage upstream. The file is now upstream's, plus the two entries #1517 legitimately adds. `search --exclude-marketplace` moves from the released [0.27.0] section to Unreleased: the contributor's branch predates that release, and the feature has not shipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeAyg3qx2my26Q8cvGyW5z
The v1 BSON driver removal (#1497) ran `go mod tidy`, which deleted the `github.com/klauspost/compress v1.20.3` requirement from #1493. No package mxcli builds imports that module, and tidy removes a requirement nothing needs. The module graph fell back to the v1.19.2 that mongo-driver/v2 declares. That version is flagged for GHSA-fpmh-frq8-7rj8, so the customer's dependency scan would block the release again. No build or test noticed. internal/depfloor/floor.go blank-imports klauspost/compress/zstd behind a `depfloor` build tag that no build sets. Tidy considers every build tag, so the requirement is now direct and survives tidy. The binary is unchanged: `go version -m bin/mxcli` lists no klauspost/compress. TestGoModKeepsSecurityFloors fails when go.mod does not require a floored module, or requires it below its floor. It also pins mongo-driver/v2 at v2.9.2. Measured: - on main, the test fails with "go.mod does not require github.com/klauspost/compress"; - a hand-added require line is gone after one `go mod tidy`; - with floor.go deleted, tidy drops the line and the test fails; - with floor.go present but no version pinned, tidy re-adds v1.19.2 and the test fails "below the floor". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeAyg3qx2my26Q8cvGyW5z
govulncheck flagged GO-2026-6809 (distrust compromised intermediate certificates in crypto/x509), present in crypto/x509@go1.27.2 and fixed in go1.27.3. mxcli reaches the vulnerable code through marketplace.Client.Download (io.Copy over TLS). This is a new advisory against the standard library: build-and-test is red on main for the same reason. Bump the toolchain in go.mod and the go-version in every workflow, so CI installs the fixed standard library. Locally, govulncheck ./... reports GO-2026-6809 on go1.27.2 (exit 3) and "No vulnerabilities found" on go1.27.3. make build, make test and make vet pass on go1.27.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeAyg3qx2my26Q8cvGyW5z
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.
Problem
The v1 BSON driver removal (#1497) ran
go mod tidy. That deleted thegithub.com/klauspost/compress v1.20.3requirement added in #1493.mongo-driver/v2, and tidy removes requirements nothing needs.mongo-driver/v2@v2.9.2declares:Fix
internal/depfloor/floor.goblank-importsgithub.com/klauspost/compress/zstdbehind adepfloorbuild tag. Nothing sets that tag.go mod tidytreats every build tag exceptignoreas enabled. So the requirement is now direct and survives tidy:go version -m bin/mxclilists noklauspost/compress.TestGoModKeepsSecurityFloorsreadsgo.modand fails when a floored module is missing or required below its floor.go.mongodb.org/mongo-driver/v2≥ v2.9.2, for CVE-2026-81521, which regressed in v2.9.0 and v2.9.1.go get <module>@<version>, thengo mod tidy. The file's doc comment says this too.Evidence
Test first. On
main, the new test fails with the regression:Controls, each followed by
go mod tidy:require … v1.20.3, no floor.go (the #1493 approach)klauspostlineklauspost/compress v1.19.2klauspost/compress v1.20.3A second
go mod tidyon this branch changes nothing.Checks:
make build,make test,make lint,make vet(both tag sets),make check-findings,go mod verifyandgo vet -tags depfloor ./internal/depfloor/pass.Second commit: CHANGELOG repair
This is a separate concern, kept as its own commit. Happy to split it into its own PR.
The merge of #1517 resolved
CHANGELOG.mdwith the stale side of its Unreleased section:go mod tidyruns again" Fixed entry.klauspostSecurity block.upstream/main's copy was intact, so the next upstream sync would have carried the damage there. The file is now upstream's, plus the two entries #1517 adds.search --exclude-marketplacemoves from the released[0.27.0]section to Unreleased, because the contributor's branch predates that release.Not changed: Unreleased still has an older entry saying mongo-driver v1 "remains flagged and cannot be upgraded out", which #1497 made untrue. It also still has two
### Securityheadings. Both are left as upstream has them.Third commit: Go toolchain 1.27.2 → 1.27.3 (GO-2026-6809)
The first CI run on this PR failed at the
govulncheckstep:build-and-testis red onmainfor the same reason. It is fixed here because otherwise this PR cannot go green.toolchain go1.27.3ingo.modandgo-version: '1.27.3'in the nightly, push-test and release workflows.govulncheck ./...reports the advisory on go1.27.2 (exit 3), and on go1.27.3 it reportsNo vulnerabilities found.make build,make testandmake vetpass on go1.27.3.Bookkeeping
.claude/skills/fix-issue/findings/other/2026-10-21-go-mod-tidy-dropped-klauspost-floor.json.🤖 Generated with Claude Code
https://claude.ai/code/session_01AeAyg3qx2my26Q8cvGyW5z