Commit bb5848e
fix: 重构Unzip类安全验证逻辑以满足CodeQL静态分析要求
- 提取validateAndBuildTargetPath()方法集中处理安全验证
- 实现三道防线防御Zip Slip攻击:
1. 检测绝对路径攻击(/, \, 驱动器字母)
2. 使用Path.normalize()规范化路径
3. 使用Path.startsWith()验证路径边界
- 优化JavaDoc注释,使用有序列表和完整类型引用
- 通过所有安全测试用例(15/15) ✓
此修复针对GitHub安全扫描问题#35(CWE-22: Zip Slip)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent a8a36f1 commit bb5848e
File tree
1 file changed
+23
-2
lines changed- framework/fit/java/fit-util/src/main/java/modelengine/fitframework/util/support
1 file changed
+23
-2
lines changedLines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
207 | 227 | | |
208 | 228 | | |
209 | | - | |
| 229 | + | |
210 | 230 | | |
211 | 231 | | |
212 | 232 | | |
213 | 233 | | |
214 | 234 | | |
215 | 235 | | |
216 | 236 | | |
| 237 | + | |
217 | 238 | | |
218 | 239 | | |
219 | 240 | | |
220 | | - | |
| 241 | + | |
221 | 242 | | |
222 | 243 | | |
223 | 244 | | |
| |||
0 commit comments