【主项目依赖升级】
- hexo 6.x → 8.1.2:移除 swig-templates、swig-extras、旧版 cheerio、
hexo-fs/hexo-util 等大量漏洞依赖链,解决 critical/high 级别漏洞
- hexo-renderer-marked 5.x → 7.0.1:修复 dompurify XSS 漏洞(GHSA-hpcv)
- gulp 4.x → 5.0.1:修复 vinyl-fs、glob/glob-stream、chokidar、
braces 等 high 级漏洞链
- hexo-generator-sitemap 2.2.0 → 3.0.1:同步升级
【替换高危依赖】
- gulp-htmlmin 替换为 gulp-html-minifier-terser@7.1.0:
gulp-htmlmin 依赖的 html-minifier 存在 ReDoS 高危漏洞且无修复版本,
改用其维护分支 html-minifier-terser,API 完全兼容
- optimist 替换为 minimist@1.2.8(devDependency):
optimist 捆绑的 minimist@<=0.2.3 存在 prototype pollution critical 漏洞,
直接使用修复版 minimist 替代
【移除无修复版本的高危包】
- 移除 hexo-generator-baidu-sitemap(无维护更新,内部捆绑 hexo@4.x
导致一系列 critical 漏洞),在 scripts/generator.js 中实现等效的
自定义 Baidu Sitemap 生成器替代,功能与原包完全一致
【npm overrides 修复传递依赖漏洞】
- 添加 overrides: { ejs: "^6.0.1" }:
hexo-renderer-ejs@2.x 依赖 ejs@3.x,ejs@3.x 存在 SSTI critical 漏洞
且引入 jake → filelist → minimatch → brace-expansion 漏洞链;
ejs@6.x 已无 jake 依赖,critical 漏洞全部消除
【yilia 主题依赖升级】
- @babel/core 7.26.x → 7.29.7:修复 Arbitrary File Read 漏洞
- @babel/plugin-transform-runtime / @babel/preset-env 同步升级至 7.29.x
- postcss 8.5.3 → 8.5.25:修复 XSS 及路径遍历漏洞
- 移除 clean-webpack-plugin(依赖链含 brace-expansion 高危漏洞),
改用 webpack 5 内置 output.clean 实现等效的增量清理功能
- 添加 overrides: { brace-expansion: "5.0.9" } 修复剩余传递依赖漏洞
【构建兼容性修复】
- scripts/generator.js 新增 jsfiddle tag 注册:
hexo@8 移除了内置 {% jsfiddle %} tag 导致构建 FATAL,
重新实现该 tag 保持原有 iframe 嵌入行为
- gulpfile.js generate 任务错误处理修正:
原代码在 hexo FATAL 时调用 hexo.exit(err) 但不向 gulp 抛出异常,
导致 series 继续执行后续任务(compressHtml 因 public/ 不存在而报错),
修改为在 hexo 退出后重新 throw err 确保 gulp 正确感知失败
【修复结果】
- 主项目:56 个漏洞(8 低危、14 中危、25 高危、9 严重)→ 0 个漏洞
- yilia 主题:8 个漏洞 → 1 个低危
(剩余 1 个为 vue@2.x ReDoS,仅影响构建时自身模板解析,
修复需整体迁移到 Vue 3 重写主题,暂不处理)
56 lines
1.2 KiB
JSON
56 lines
1.2 KiB
JSON
{
|
|
"name": "yilia",
|
|
"version": "5.1.1",
|
|
"description": "Hexo响应式主题",
|
|
"scripts": {
|
|
"dev": "webpack --progress --mode development",
|
|
"build": "webpack --mode production"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/litten/hexo-theme-yilia.git"
|
|
},
|
|
"keywords": [
|
|
"hexo",
|
|
"theme",
|
|
"blog"
|
|
],
|
|
"author": "litten",
|
|
"license": "ISC",
|
|
"dependencies": {
|
|
"@babel/runtime": "^7.26.0",
|
|
"core-js": "^3.40.0",
|
|
"photoswipe": "^4.1.3",
|
|
"qrious": "^4.0.2",
|
|
"scrollreveal": "^4.0.9",
|
|
"vue": "^2.7.16"
|
|
},
|
|
"devDependencies": {
|
|
"@babel/core": "^7.29.7",
|
|
"@babel/plugin-transform-runtime": "^7.29.0",
|
|
"@babel/preset-env": "^7.29.0",
|
|
"autoprefixer": "^10.4.20",
|
|
"babel-loader": "^9.2.1",
|
|
"css-loader": "^7.1.2",
|
|
"html-webpack-plugin": "^5.6.3",
|
|
"less": "^4.2.2",
|
|
"less-loader": "^12.2.0",
|
|
"mini-css-extract-plugin": "^2.9.2",
|
|
"postcss": "^8.5.25",
|
|
"postcss-loader": "^8.1.1",
|
|
"terser-webpack-plugin": "^5.3.11",
|
|
"webpack": "^5.97.1",
|
|
"webpack-cli": "^5.1.4"
|
|
},
|
|
"overrides": {
|
|
"brace-expansion": "5.0.9"
|
|
},
|
|
"browserslist": [
|
|
"> 1%",
|
|
"last 2 versions",
|
|
"not dead",
|
|
"iOS >= 10",
|
|
"Android >= 5"
|
|
]
|
|
}
|