Skip to content

Security: Fix CVE-2024-45337 (golang.org/x/crypto)#2807

Draft
theakshaypant wants to merge 2 commits into
release-v0.27.xfrom
fix/cve-2024-45337-x-crypto-release-v0.27.x-attempt-1
Draft

Security: Fix CVE-2024-45337 (golang.org/x/crypto)#2807
theakshaypant wants to merge 2 commits into
release-v0.27.xfrom
fix/cve-2024-45337-x-crypto-release-v0.27.x-attempt-1

Conversation

@theakshaypant

Copy link
Copy Markdown
Member

Summary

This PR fixes CVE-2024-45337 by upgrading `golang.org/x/crypto` from v0.21.0 to v0.31.0.

CVE Details

  • CVE ID: CVE-2024-45337
  • GHSA: GHSA-v778-237x-gjrc
  • Package: golang.org/x/crypto
  • Severity: High
  • Impact: Authorization bypass via misuse of ServerConfig.PublicKeyCallback — a client can send multiple public keys and authenticate with one while the server may make authorization decisions based on another key the client doesn't control.
  • Vulnerable versions: < v0.31.0
  • Fixed version: v0.31.0
  • Jira Issues: SRVKP-11979

Changes

  • Upgraded golang.org/x/crypto v0.21.0 → v0.31.0
  • Updated vendor directory
  • Co-upgraded golang.org/x/sync, golang.org/x/sys, golang.org/x/term, golang.org/x/text as required by go mod tidy

Test Results

Status: ⚠️ Pre-existing build failure in pkg/webhook (unrelated to this change)

Build:go build ./... succeeded
Tests:go test ./pkg/... — pre-existing failure in pkg/webhook (non-constant format string in call to knative.dev/pkg/webhook.MakeErrorStatus) unrelated to this CVE fix
Post-fix scan:govulncheck — GO-2024-3321 (CVE-2024-45337) no longer detected

Breaking Changes

None. v0.31.0 is backward compatible with v0.21.0 for all APIs used in this repo.

Verification Checklist

  • CVE confirmed present before fix (GO-2024-3321 detected by govulncheck)
  • golang.org/x/crypto upgraded to v0.31.0
  • go mod vendor updated
  • go build ./... passes
  • Post-fix govulncheck confirms CVE-2024-45337 no longer detected
  • CI passes

Risk Assessment

Low — patch-level upgrade within the same major version. No API changes. Only security improvements.


🤖 Generated by CVE Fixer Workflow

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 28, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: theakshaypant / name: Akshay Pant (62b14a5)

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request upgrades the Go toolchain version to 1.24.0 and updates various dependencies in go.mod and go.sum. The reviewer identified several critical issues with these changes: multiple upgraded dependency versions (including golang.org/x packages, grpc, and protobuf) do not exist in the public Go registry or are future-dated, which will cause build and module resolution failures. Additionally, the Go version upgrade to 1.24.0 in go.mod creates a mismatch with other build configuration files like the Dockerfile and Makefile, which still reference Go 1.21.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread go.mod
Comment on lines +35 to +37
golang.org/x/oauth2 v0.34.0
golang.org/x/sync v0.19.0
golang.org/x/text v0.32.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The upgraded versions for these direct dependencies do not exist in the public Go registry:

  • golang.org/x/oauth2 v0.34.0 (latest is v0.26.0)
  • golang.org/x/sync v0.19.0 (latest is v0.11.0)
  • golang.org/x/text v0.32.0 (latest is v0.22.0)

Please use valid, existing versions to prevent module resolution and build failures.

Suggested change
golang.org/x/oauth2 v0.34.0
golang.org/x/sync v0.19.0
golang.org/x/text v0.32.0
golang.org/x/oauth2 v0.26.0
golang.org/x/sync v0.11.0
golang.org/x/text v0.22.0

Comment thread go.mod
Comment on lines +134 to +137
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/term v0.38.0 // indirect

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-critical critical

Several of the upgraded dependency versions specified in go.mod do not exist in the public Go registry. For example:

  • golang.org/x/crypto v0.46.0 (latest is v0.33.0)
  • golang.org/x/net v0.48.0 (latest is v0.35.0)
  • golang.org/x/sys v0.39.0 (latest is v0.30.0)
  • golang.org/x/term v0.38.0 (latest is v0.29.0)

Using non-existent versions will cause go build, go test, and go mod tidy to fail with resolution errors. Please downgrade these dependencies to their actual latest stable versions (e.g., v0.33.0 for golang.org/x/crypto to fix the CVE).

Suggested change
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/term v0.38.0 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/term v0.29.0 // indirect
References
  1. Security fixes described in a pull request may be implemented via dependency updates in go.mod instead of direct code changes.
  2. Security scanner alerts may persist as false positives even after a dependency has been updated. When a bot flags a security issue that is believed to be resolved, confirm the dependency version is correct and investigate if the alert is a false positive before making further code changes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread go.mod
Comment on lines +141 to +144
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/grpc v1.79.3 // indirect
google.golang.org/protobuf v1.36.10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

These dependencies also use non-existent or future-dated versions:

  • google.golang.org/genproto/googleapis/api and rpc use a pseudo-version from December 2025 (v0.0.0-20251202230838-ff82c1b0f217).
  • google.golang.org/grpc uses v1.79.3 (latest is v1.70.x).
  • google.golang.org/protobuf uses v1.36.10 (latest is v1.36.5).

Please run go mod tidy with a real Go toolchain to let Go resolve the correct, existing versions automatically.

Suggested change
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/grpc v1.79.3 // indirect
google.golang.org/protobuf v1.36.10
google.golang.org/genproto/googleapis/api v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
google.golang.org/protobuf v1.33.0

Comment thread go.mod
module github.com/openshift-pipelines/pipelines-as-code

go 1.21
go 1.24.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The Go version in go.mod has been upgraded to 1.24.0, but the Dockerfile (which uses golang:1.21) and the Makefile (which sets GO_TOOLCHAIN ?= go1.21.13) have not been updated. This mismatch will cause build failures or force unexpected toolchain downloads during container builds, especially in offline or restricted environments. Please ensure the Go version is updated consistently across all build configuration files, or revert the go.mod Go version to 1.21 if the project is not ready to upgrade to Go 1.24.

Suggested change
go 1.24.0
go 1.21
References
  1. The go directive in go.mod can include specific patch versions when automatically updated by go mod tidy to align with dependencies.

@theakshaypant theakshaypant marked this pull request as draft June 29, 2026 08:14
@theakshaypant theakshaypant force-pushed the fix/cve-2024-45337-x-crypto-release-v0.27.x-attempt-1 branch from 7946e09 to 62b14a5 Compare June 29, 2026 11:17
theakshaypant and others added 2 commits June 29, 2026 17:08
- Upgrade golang.org/x/crypto from v0.21.0 to v0.31.0
- Fixes authorization bypass via misuse of ServerConfig.PublicKeyCallback
- Update vendor directory

Resolves: SRVKP-11979

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Akshay Pant <akpant@redhat.com>
Non-constant format strings, unchecked type assertions,
unnecessary loop variable copies, and builtin shadowing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Akshay Pant <akpant@redhat.com>
@theakshaypant theakshaypant force-pushed the fix/cve-2024-45337-x-crypto-release-v0.27.x-attempt-1 branch from 62b14a5 to 4ff7298 Compare June 29, 2026 11:40
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.

1 participant