Skip to content

fix: upgrade vulnerable Go dependencies to fix CRITICAL/HIGH CVEs - #240

Open
qiluo-msft wants to merge 3 commits into
masterfrom
fix/cve-mgmt-v3-2026-08
Open

fix: upgrade vulnerable Go dependencies to fix CRITICAL/HIGH CVEs#240
qiluo-msft wants to merge 3 commits into
masterfrom
fix/cve-mgmt-v3-2026-08

Conversation

@qiluo-msft

Copy link
Copy Markdown

Why I did it

Trivy CVE scan identified multiple CRITICAL and HIGH severity vulnerabilities in the Go module dependencies of sonic-mgmt-common.

How I did it

Updated go.mod and regenerated go.sum via go mod tidy with the following version bumps:

Package Old New CVEs Fixed
google.golang.org/grpc v1.28.0 v1.82.1 CVE-2026-33186, GHSA-hrxh-6v49-42gf
golang.org/x/text v0.3.3 v0.39.0 CVE-2020-14040, CVE-2021-38561, CVE-2022-32149, CVE-2026-56852
github.com/antchfx/xpath v1.1.10 v1.3.6 CVE-2026-32287 (direct dependency)
github.com/antchfx/jsonquery v1.1.4 v1.3.7 (parent of vulnerable xpath)
github.com/antchfx/xmlquery v1.3.1 v1.5.1 (parent of vulnerable xpath)

Additionally:

  • Added replace directive to pin github.com/golang/glog to v0.0.0-20160126235308-23def4e6c14bgrpc v1.82.1 transitively requires glog v1.2.5, but patches/glog.patch was written for the old glog API (which no longer exists in v1.2.5). The pin preserves the existing patch compatibility.
  • Kept go directive at 1.24.4 (reverted from go mod tidy's 1.25.0 bump) to avoid forcing a CI toolchain upgrade.

How to verify it

trivy fs . --severity CRITICAL,HIGH

CRITICAL count should drop to 0 for these packages; HIGH count should decrease substantially.

- google.golang.org/grpc v1.28.0 -> v1.82.1 (CVE-2026-33186, GHSA-hrxh-6v49-42gf)
- golang.org/x/text v0.3.3 -> v0.39.0 (CVE-2020-14040, CVE-2021-38561, CVE-2026-56852)
- antchfx/xpath v1.1.10 -> v1.3.6 (CVE-2026-32287, direct dependency)
- antchfx/jsonquery v1.1.4 -> v1.3.7 (parent of vulnerable xpath)
- antchfx/xmlquery v1.3.1 -> v1.5.1 (parent of vulnerable xpath)

Signed-off-by: qiluo <qiluo@microsoft.com>
- Add replace directive to pin github.com/golang/glog to
  v0.0.0-20160126235308-23def4e6c14b (grpc v1.82.1 requires v1.2.5 but
  patches/glog.patch targets the old API which no longer exists in v1.2.5)
- Restore go directive to 1.24.4 to avoid requiring CI toolchain upgrade

Signed-off-by: qiluo <qiluo@microsoft.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 00:05
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Go module dependencies in sonic-mgmt-common (shared libraries/models for SONiC management, including translib/CVL) to address reported CRITICAL/HIGH CVEs, primarily by bumping key modules and regenerating dependency locks.

Changes:

  • Upgraded google.golang.org/grpc, golang.org/x/text, and the antchfx/*query + antchfx/xpath dependency chain to newer versions.
  • Updated transitive dependency versions/hashes via go mod tidy output (go.sum refresh).
  • Added a replace directive to pin github.com/golang/glog to the pre-v1 API to keep patches/glog.patch applicable.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
go.mod Bumps direct/indirect module versions and adds a replace to pin glog for patch compatibility.
go.sum Regenerates checksum set to match the updated dependency graph.

Comment thread go.mod
github.com/go-redis/redis/v7 v7.4.1
github.com/godbus/dbus/v5 v5.1.0
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/glog v1.2.5
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.

3 participants