Skip to content

chore(deps): 升级 Go 工具链至 1.25 并修复 x/crypto Critical CVE - #3

Merged
TangJia025 merged 1 commit into
mainfrom
fix/2061-bump-go-1.25-xcrypto
Sep 10, 2026
Merged

chore(deps): 升级 Go 工具链至 1.25 并修复 x/crypto Critical CVE#3
TangJia025 merged 1 commit into
mainfrom
fix/2061-bump-go-1.25-xcrypto

Conversation

@TangJia025

Copy link
Copy Markdown
Contributor

背景

Socket(SocketSecurity)在 PR #1 报出 8 项 Critical CVE,全部位于传递依赖 golang.org/x/crypto/ssh< 0.52.0;其中 GHSA-v778-237x-gjrc 的修复线为 >= 0.31.0)。引入链:

go/go.mod → github.com/gin-gonic/gin@v1.10.0
          → github.com/prometheus/client_golang@v1.20.5
          → golang.org/x/crypto@v0.24.0

PR #1 已合入 main,该版本仍然停留在 v0.24.0,本 PR 处理它。

变更

go/go.mod / go/go.sum

之前 之后
go directive go 1.22 go 1.25.0
golang.org/x/crypto v0.24.0 v0.55.0
golang.org/x/net v0.26.0 v0.57.0
golang.org/x/sys v0.22.0 v0.47.0
golang.org/x/text v0.16.0 v0.41.0

后三项是 x/crypto 顺带抬升的伴生依赖。直接依赖(gin / client_golang / testify)未变动。

版本选择说明

  • 8 项告警的修复线为 0.52.0v0.55.0 已全部覆盖。
  • 为何停在 v0.55.0x/cryptov0.56.0 起要求 go 1.26.0,本 PR 目标为 Go 1.25,故 v0.55.0 是该工具链下可用的最高修复版本。
  • go directive 必须同步升至 1.25:x/crypto v0.52.0+ 要求 go 1.25.0,仅升依赖会在 Go 1.22 下报 module requires go >= 1.25.0

验证

go mod tidy    → 无进一步改动(go.mod / go.sum 已收敛)
go build ./... → OK
go vet ./...   → OK
go test ./...  → log / metrics / middleware / middleware/ginmw / sdkctx 全部 ok

CI 使用 go-version-file: go/go.mod,会按 directive 精确安装 Go 1.25.0。为对齐该行为,另以 GOTOOLCHAIN=go1.25.0 复跑同一套测试,结果一致。

影响与风险

  • CI:Go 安装版本随 go-version-file 自动切到 1.25.0,工作流无需改动。
  • 接入方:以 module 方式引用 obs-sdk-go 的下游需 Go >= 1.25.0。
  • 可达性说明:该 8 项 CVE 均位于 golang.org/x/crypto/ssh,而 SDK 实际编译进二进制的 x/crypto 包仅有 sha3 与 TLS 相关密码学原语(经 validator/v10 引入),源码中无任何 crypto/ssh 引用,go list -deps 中 ssh 包计数为 0。即告警在依赖图上存在,但在本 SDK 内不存在可利用路径。本次升级以消除扫描告警、对齐依赖基线为主要目的。

附注:推送时 GitHub 提示默认分支仍有 21 项 Dependabot 漏洞(8 critical / 4 high / 9 moderate),其中 Go 侧的部分由本 PR 覆盖,其余(如 Java 侧)不在此次范围内。

🤖 Generated with Claude Code

AI 使用声明

当前 PR 是否有 AI 参与:

Socket 在 PR #1 报出 8 项 Critical CVE,全部位于
golang.org/x/crypto/ssh(< 0.52.0,其中 GHSA-v778-237x-gjrc 需 >= 0.31.0)。
该包经 gin@v1.10.0 -> prometheus/client_golang@v1.20.5 传递引入
x/crypto v0.24.0,扫描按依赖图告警。

变更:
- go directive: 1.22 -> 1.25.0
- golang.org/x/crypto: v0.24.0 -> v0.55.0
- 伴生依赖随之抬升:x/net v0.57.0、x/sys v0.47.0、x/text v0.41.0
- 直接依赖(gin/client_golang/testify)未变动

版本选择:修复线为 0.52.0;v0.55.0 是 Go 1.25 下可用的最高版本
(v0.56.0 起要求 go 1.26.0)。

验证:go mod tidy 无进一步改动;go build/vet/test 全部通过,
并使用 GOTOOLCHAIN=go1.25.0 复跑(与 CI 的 go-version-file 行为一致)。

说明:SDK 实际编译进的 x/crypto 包仅 sha3 与 TLS 相关密码学原语,
crypto/ssh 未进入二进制,本次升级以消除扫描告警、对齐依赖基线为主。

Co-Authored-By: Claude Code <noreply@anthropic.com>
@opensourceways-bot

Copy link
Copy Markdown

Welcome To opensourceways Community

Hey @TangJia025 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: infratructure ,
and any of the maintainers: @GeorgeCao-hw, @TangJia025, @pkking, @zhongjun2 ,
and any of the committers: @GeorgeCao-hw, @TangJia025, @pkking, @zkhzkhz .

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

TangJia025, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown

Linking Issue Notice

@TangJia025 , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@TangJia025
TangJia025 merged commit 76f871a into main Sep 10, 2026
7 checks passed
TangJia025 added a commit that referenced this pull request Sep 10, 2026
原写「Go 取 go/go.mod 的版本(1.22)」,但 #3 已把 go.mod 升到 1.25.0,
括号里的数字当场过期。改为只说明来源(CI 用 go-version-file 读 go.mod),
避免每次升 Go 都要回来改文档。

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants