Files
hzdyjs/docs/技术问题解决记录/Fastjson1.2.83漏洞整改-升级Fastjson2兼容包.md
T
2026-07-22 09:51:31 +08:00

53 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Fastjson 1.2.83 漏洞整改(升级 Fastjson2 兼容包)
## 背景
客户通报 Fastjson `<= 1.2.83` 存在远程代码执行风险,要求排查整改。建议升级至 Fastjson2。
## 排查结论
| 项 | 说明 |
|---|---|
| 业务序列化 | 使用 Jackson(`ruoyi-common-json`),业务代码未直接调用 Fastjson |
| 引入路径 | `JustAuth 1.16.7`(`ruoyi-common-social`)传递依赖 `com.alibaba:fastjson:1.2.83` |
| 影响功能 | 第三方社交登录/绑定、微信小程序登录(JustAuth) |
## 整改方案
采用 **Fastjson2 的 1.x 兼容包**(坐标仍为 `com.alibaba:fastjson`,版本切到 `2.0.x`),无需修改 JustAuth 调用代码。
修改位置:`backend/pom.xml`
```xml
<!-- JustAuth 传递依赖 fastjson:升级为 Fastjson2 的 1.x 兼容包,规避 1.x 反序列化风险 -->
<fastjson.version>2.0.61</fastjson.version>
```
`dependencyManagement` 中已统一锁定该版本,JustAuth 传递依赖会解析为:
```
JustAuth
└─ com.alibaba:fastjson:2.0.61
└─ com.alibaba.fastjson2:fastjson2-extension:2.0.61
└─ com.alibaba.fastjson2:fastjson2:2.0.61
```
## 验证
```bash
cd backend
mvn -pl ruoyi-admin -am dependency:tree -Dincludes=com.alibaba:fastjson,com.alibaba.fastjson2:fastjson2
```
确认结果中为 `com.alibaba:fastjson:jar:2.0.61`,且无 `1.2.83`。
## 回归建议
1. 账号密码登录(应不受影响)
2. 实际启用的第三方登录/绑定(如有)
3. 微信小程序登录(如有启用)
## 变更日期
2026-07-22