Skip to content

fix: upgrade Go dependencies to fix CRITICAL/HIGH CVEs (go 1.24 compat) - #744

Closed
qiluo-msft wants to merge 2 commits into
masterfrom
fix/cve-gnmi-pr1
Closed

fix: upgrade Go dependencies to fix CRITICAL/HIGH CVEs (go 1.24 compat)#744
qiluo-msft wants to merge 2 commits into
masterfrom
fix/cve-gnmi-pr1

Conversation

@qiluo-msft

Copy link
Copy Markdown
Collaborator

Why I did it

Trivy CVE scan identified CRITICAL and HIGH severity vulnerabilities in the Go module dependencies of sonic-gnmi. This PR fixes 12 CVEs using versions compatible with Go 1.24 (no CodeQL workflow changes needed).

A follow-up PR will address the remaining 11 HIGH CVEs that require go ≥ 1.25.

How I did it

Package Old New CVEs Fixed
google.golang.org/grpc v1.69.2 v1.80.0 CVE-2026-33186 (CRITICAL), GHSA-m425-mq94-257g
golang.org/x/crypto v0.36.0 v0.48.0 CVE-2024-45337, CVE-2025-22869, CVE-2025-47913
golang.org/x/net v0.38.0 v0.49.0 CVE-2023-39325, CVE-2023-45288, CVE-2024-45338
golang.org/x/text v0.23.0 v0.34.0 CVE-2020-14040, CVE-2021-38561, CVE-2022-32149
github.com/antchfx/xpath v1.1.10 v1.3.6 CVE-2026-32287
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)

Makefile: Removed the obsolete x/crypto@v0.0.0-20191206172530 (Dec 2019) vendor override. This ancient version was incompatible with grpc v1.80.0+ and is no longer needed — x/crypto v0.48.0 retains ssh/terminal and RevokedCertificates backward compatibility.

How to verify it

trivy fs . --severity CRITICAL,HIGH

CRITICAL count should drop to 0; 11 remaining HIGH CVEs (requiring go ≥ 1.25) will be addressed in a follow-up PR.

Fixes 12 CVEs using maximum versions compatible with Go 1.24 (no CodeQL issues):

- google.golang.org/grpc v1.69.2 -> v1.80.0 (CVE-2026-33186 CRITICAL, GHSA-m425-mq94-257g)
- golang.org/x/crypto v0.36.0 -> v0.48.0 (CVE-2024-45337, CVE-2025-22869, CVE-2025-47913)
- golang.org/x/net v0.38.0 -> v0.49.0 (CVE-2023-39325, CVE-2023-45288, CVE-2024-45338)
- golang.org/x/text v0.23.0 -> v0.34.0 (CVE-2020-14040, CVE-2021-38561, CVE-2022-32149)
- antchfx/xpath v1.1.10 -> v1.3.6 (CVE-2026-32287)
- antchfx/jsonquery v1.1.4 -> v1.3.7, antchfx/xmlquery v1.3.1 -> v1.5.1

Makefile: remove obsolete x/crypto@v0.0.0-20191206172530 vendor override.
The 2019 crypto is no longer needed; x/crypto v0.48.0 retains ssh/terminal
and RevokedCertificates backward compatibility.

Remaining 11 HIGH CVEs requiring go >= 1.25 are tracked separately.
Copilot AI lite review requested due to automatic review settings August 7, 2026 18:23
@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 sonic-gnmi’s Go module dependencies (notably gRPC and golang.org/x/*) to remediate CRITICAL/HIGH CVEs while remaining compatible with Go 1.24, and simplifies the build process by removing an obsolete vendored x/crypto override in the Makefile.

Changes:

  • Upgraded core dependencies including google.golang.org/grpc, golang.org/x/crypto, golang.org/x/net, and golang.org/x/text, plus several transitive modules.
  • Updated Makefile to stop temporarily swapping in a 2019 x/crypto snapshot during gNMI CLI patching.
  • Refreshed several ancillary deps (testify, yaml.v2, antchfx jsonquery/xmlquery/xpath, etc.) as part of the dependency graph update.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
Makefile Removes the legacy x/crypto vendor override/restore steps during gNMI CLI patching and cleans up related build artifacts.
go.mod Bumps key direct and indirect module versions (gRPC, x/*, antchfx, etc.) to address CVEs and update the dependency graph for Go 1.24.

Comment thread go.mod Outdated
Comment on lines 81 to 84
golang.org/x/crypto => golang.org/x/crypto v0.48.0
golang.org/x/sys => golang.org/x/sys v0.26.0
google.golang.org/grpc => google.golang.org/grpc v1.64.1
google.golang.org/grpc => google.golang.org/grpc v1.80.0
google.golang.org/protobuf => google.golang.org/protobuf v1.34.1
Comment thread go.mod Outdated
Comment on lines 78 to 82
// Glog patch needs to be updated to remove this.
github.com/golang/glog => github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/openconfig/gnmi => github.com/openconfig/gnmi v0.0.0-20200617225440-d2b4e6a45802
golang.org/x/crypto => golang.org/x/crypto v0.24.0
golang.org/x/crypto => golang.org/x/crypto v0.48.0
golang.org/x/sys => golang.org/x/sys v0.26.0
Pre-existing replace directives were pinning below the versions selected
by go mod tidy after the grpc/x/* upgrades:
- glog: replace v0.0.0-20160126 -> v1.2.5 (matches require)
- x/sys: replace v0.26.0 -> v0.41.0 (matches require)
- protobuf: replace v1.34.1 -> v1.36.11 (matches require)
@mssonicbld

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@qiluo-msft

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

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

@qiluo-msft

Copy link
Copy Markdown
Collaborator Author

Superseded by new PR with DCO sign-off fixed.

@qiluo-msft qiluo-msft closed this Aug 7, 2026
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