Skip to content

fix: address Docker and Prometheus CVEs (GHSA-x744-4wpc-v9h2, GHSA-pxq6-2prw-chj9, GHSA-vffh-x6r8-xx99)#864

Merged
karimra merged 5 commits into
openconfig:mainfrom
ronan-nexthop:fix/cve-docker-prometheus
May 13, 2026
Merged

fix: address Docker and Prometheus CVEs (GHSA-x744-4wpc-v9h2, GHSA-pxq6-2prw-chj9, GHSA-vffh-x6r8-xx99)#864
karimra merged 5 commits into
openconfig:mainfrom
ronan-nexthop:fix/cve-docker-prometheus

Conversation

@ronan-nexthop
Copy link
Copy Markdown
Contributor

@ronan-nexthop ronan-nexthop commented May 7, 2026

Why

gnmic v0.45.0 carries three known CVEs in its dependency tree that downstream packagers cannot work around with go get @latest:

CVE Severity Dependency Fixed in
GHSA-x744-4wpc-v9h2 HIGH github.com/docker/docker needs v29.3.1 (only available as github.com/moby/moby/v2)
GHSA-pxq6-2prw-chj9 MEDIUM github.com/docker/docker same as above
GHSA-vffh-x6r8-xx99 MEDIUM github.com/prometheus/prometheus needs v0.311.2+

The Docker fixes can't land via the existing github.com/docker/docker import path because Docker's v29 source code only ships under the renamed github.com/moby/moby/v2 module — there is no v29.x.y tag at the old path. The Prometheus bump fails go mod tidy because it pulls in k8s.io/kube-openapi, whose transitive github.com/go-openapi/swag/loading test imports a since-renamed package (testify/v2/assert/yaml) that no longer exists.

What

Three commits:

1. fix(docker_loader): migrate from docker/docker to moby/moby/v2

The migration is API-breaking, not just an import rewrite — pkg/loaders/docker_loader/docker_loader.go is the only consumer:

  • The filters package was removed entirely. filters.NewArgs / filters.Args / filters.KeyValuePair are gone, replaced by client.Filters (a map[string]map[string]bool with chainable Add).
  • container.ListOptions and network.ListOptions moved into the client package as ContainerListOptions and NetworkListOptions.
  • ContainerList and NetworkList now return result structs rather than slices; callers must use .Items to get the underlying list.
  • Client.Ping requires a PingOptions argument.
  • EndpointSettings.IPAddress / .GlobalIPv6Address and PortSummary.IP are now netip.Addr instead of string. String comparisons against "" / "0.0.0.0" / "::" become IsValid() / IsUnspecified() and a String() conversion at format-time.

After this change github.com/docker/docker is no longer in the module graph (go mod why reports "main module does not need package"; go list -m all | grep docker/docker is empty).

2. chore(deps): bump prometheus to v0.311.2 to address GHSA-vffh-x6r8-xx99

Bumps github.com/prometheus/prometheus past the CVE-fixed bar and pins github.com/go-openapi/testify/enable/yaml/v2 and github.com/go-openapi/testify/v2 to v2.5.0 (// indirect) so MVS picks the version where the upstream maintainers already corrected the broken import (renamed testify/v2/assert/yaml to testify/v2/enable/stubs/yaml).

After this commit go mod tidy succeeds.

3. chore(ci): bump Go toolchain to 1.25.9

The prometheus bump (and its transitive otel/k8s/x/* updates) raises the go.mod floor to go 1.25.0. CI workflows and the published Dockerfile still pinned 1.24.12, which means every CI run wasted time auto-downloading 1.25 to satisfy the directive. This commit bumps:

  • .github/workflows/test.yml GOVER: 1.24.12 → 1.25.9
  • .github/workflows/lint.yml GOVER: 1.24.12 → 1.25.9
  • .github/workflows/release.yml GOVER: 1.24.12 → 1.25.9
  • Dockerfile FROM golang:1.24.12 → golang:1.25.9

Verification

  • go mod tidy — clean
  • go build ./... — clean
  • go vet ./... — clean
  • Smoke tested against a real Docker 29.4.1 daemon: invoked the migrated docker_loader.RunOnce with two labelled nginx:alpine containers and confirmed it discovered both with correct addresses derived from published ports + gnmic-port labels (172.17.0.2:57400, 172.17.0.3:57401).
  • The unix-socket and bridge-fallback IP-resolution branches are exercised by structurally identical code paths but were not run in the smoke test — review of the netip.Addr rewrites would benefit from a second set of eyes.

Risk / blast radius

  • Anyone consuming gnmic as a library at Go ≥ 1.25 (or with the default GOTOOLCHAIN=auto, which auto-downloads 1.25) is unaffected; the public API of pkg/loaders/docker_loader is unchanged.
  • Consumers running GOTOOLCHAIN=local on a Go 1.24 install will need to upgrade to Go 1.25 — but they would have hit the same wall the moment any of the bumped transitive deps (prometheus, otel, k8s.io/*, x/crypto, x/net, x/oauth2, etc.) reached their machine via MVS, regardless of gnmic's go directive. The bump is honest documentation of the floor that already exists.
  • Anyone using the docker loader at runtime gets identical behavior — same target name, same address resolution rules.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 7, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ronan-nexthop ronan-nexthop marked this pull request as draft May 7, 2026 01:22
@ronan-nexthop ronan-nexthop force-pushed the fix/cve-docker-prometheus branch from f46dd2a to 25a3426 Compare May 7, 2026 01:24
Resolves GHSA-x744-4wpc-v9h2 (HIGH) and GHSA-pxq6-2prw-chj9 (MEDIUM),
both of which require docker/docker v29.3.1+. Docker upstream moved the
module to github.com/moby/moby/v2 with split submodules for the API
(github.com/moby/moby/api) and the client (github.com/moby/moby/client),
so the import-path swap is the only path to a fixed version.

The migration is API-breaking, not just an import rewrite:

  - The filters package was removed: filters.NewArgs/filters.Args/
    filters.KeyValuePair are gone. Replaced by client.Filters
    (a map[string]map[string]bool with chainable Add).
  - container.ListOptions and network.ListOptions moved into the
    client package as ContainerListOptions and NetworkListOptions.
  - ContainerList and NetworkList now return result structs rather
    than slices; callers must use .Items to get the underlying list.
  - Client.Ping requires a PingOptions argument.
  - EndpointSettings.IPAddress / .GlobalIPv6Address and PortSummary.IP
    are now netip.Addr instead of string. String comparisons against
    "" / "0.0.0.0" / "::" become IsValid() / IsUnspecified() and a
    String() conversion at format-time.

Smoke tested against a real Docker 29.4.1 daemon: the loader discovered
two labelled containers and resolved their published-port addresses
(172.17.0.2:57400, 172.17.0.3:57401) correctly.

After this change github.com/docker/docker is no longer in the module
graph (verified via go mod why).
Resolves GHSA-vffh-x6r8-xx99 (MEDIUM) by upgrading
github.com/prometheus/prometheus from v0.306.0 to v0.311.2.

The straight bump alone causes go mod tidy to fail because of a
broken transitive test dep:

  k8s.io/kube-openapi
    -> github.com/go-openapi/swag
    -> github.com/go-openapi/swag/loading (test file)
    -> github.com/go-openapi/testify/enable/yaml/v2 v2.0.2
    -> github.com/go-openapi/testify/v2/assert/yaml   (does not exist)

go-openapi/testify already fixed this at enable/yaml/v2.5.0 by
renaming the import to .../v2/enable/stubs/yaml. We pin both
go-openapi/testify modules to v2.5.0 (// indirect) to push MVS past
the broken floor.

After this change tidy succeeds and the full build is clean.
@ronan-nexthop ronan-nexthop force-pushed the fix/cve-docker-prometheus branch from 25a3426 to eb90b2f Compare May 7, 2026 01:33
@ronan-nexthop ronan-nexthop marked this pull request as ready for review May 7, 2026 01:39
The prometheus and otel/k8s/x/* deps in the previous commit raise the
go.mod floor to go 1.25.0. CI and the Dockerfile still pinned 1.24.12,
which means every CI run wasted time auto-downloading 1.25 to satisfy
the directive. Bump them to 1.25.9 (the latest 1.25 patch as of writing)
so CI and the published Docker image match the actual floor.
Comment thread pkg/loaders/docker_loader/docker_loader.go Outdated
Comment thread pkg/loaders/docker_loader/docker_loader.go Outdated
when n.IPAddress is invalid and n.GlobalIPv6Address is also the zero
netip.Addr, calling .String() on the zero Addr returns the literal
"invalid IP" rather than "". That bogus value survived the downstream
`tc.Address == ""` guard and would have propagated as a target address.

Wrap the GlobalIPv6Address assignment in an IsValid() check, mirroring
the guard already present on the IPAddress side. When neither is valid
the loop exits with tc.Address unset and the existing `no address
found` log path fires correctly.
Resolves go.mod / go.sum conflicts from the dependabot bumps that landed
on main (openconfig#841, openconfig#844, openconfig#855) and the log2slog refactor (openconfig#866).

Resolution strategy: kept our side of go.mod (every direct dep we touched
was already at a higher version than main, because the CVE-driven
upgrades pulled the otel / x/* / k8s.io graph forward), then explicitly
applied main's two security bumps:

  - github.com/go-jose/go-jose/v4 v4.1.3 -> v4.1.4 (openconfig#844)
  - github.com/nats-io/nats-server/v2 v2.12.4 -> v2.12.6 (openconfig#841)

main's otel 1.40 -> 1.41 bump (openconfig#855) was a no-op for us since our
prometheus 0.311.2 bump had already pulled otel to 1.42.

Reran go mod tidy to rebuild go.sum from the resolved go.mod. Confirmed
github.com/docker/docker (v28.5.2 transitive only) is not consumed by
any package via go mod why -m. Confirmed prometheus v0.311.2 and
moby/moby/client v0.4.1 / moby/moby/api v1.54.2 survived the merge.

Verification: go build ./..., go vet ./..., go test -short ./... all
clean across 40 packages.
@ronan-nexthop
Copy link
Copy Markdown
Contributor Author

ronan-nexthop commented May 13, 2026

merge conflicts in go.mod, resolved them, re-generated the go.mod/go.sum and re-ran the unit tests to confirm no regressions

@ronan-nexthop ronan-nexthop requested a review from karimra May 13, 2026 03:54
@karimra karimra merged commit 44b7117 into openconfig:main May 13, 2026
3 checks passed
@ronan-nexthop
Copy link
Copy Markdown
Contributor Author

thanks @karimra, can we get a new release publish that contains these fixes please

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.

2 participants