Files
lsky-pro-docker/test/package.json
T
mole404 d77ba67d5c fix(security,deps): 认证端点节流 + 镜像信息收敛 + 两条依赖公告
认证(src/routes/auth.php):
- login / register / confirm-password 加 throttle:5,1,forgot-password 加 throttle:6,1。
  实测发现登录原本并非零防护 —— Breeze 的 LoginRequest 有按(邮箱|IP)的 5 次/60 秒
  RateLimiter(CACHE_DRIVER=file,真生效),它挡单账号撞库;路由级节流补的是
  『换邮箱撒网 / 换 IP 轮换』这个口,两者互补。
- verification.verify(6,1) 与 verification.send(3,1) 原样未动。
- 已知取舍(未改,已登记):TrustProxies 配的是 $proxies='*',节流键取自 X-Forwarded-For
  且外层 nginx 用 $proxy_add_x_forwarded_for 追加 → 客户端自带的假 XFF 会排在前面并被采信,
  即限流键可伪造。修法是把信任代理收窄到 nginx 的地址/网段。

镜像信息收敛(Dockerfile):
- 新增 /usr/local/etc/php/conf.d/zz-lsky-hardening.ini(expose_php=0 / display_errors=0),
  zz- 前缀保证不被别的 ini 覆盖;构建期用 php -r 真读回 ini_get 断言。
- 新增 /etc/apache2/conf-enabled/zz-lsky-hardening.conf(ServerTokens Prod /
  ServerSignature Off)。放 conf-enabled 而不是 vhost 模板:ServerTokens 是全局指令,
  写进 VirtualHost 会被 Apache 拒绝加载。
- 自证从 8 条加到 9 条(新增 routes/auth.php 钉住),本地实算 9/9 通过。

依赖公告(OSV 扫描到 11 条,本次清掉两条有修复版本的):
- psy/psysh v0.11.12 → v0.11.23(它在生产依赖树里、随镜像发布;Dockerfile 的
  composer.lock md5 自证同步为新值),并从 osv-scanner.toml 删掉那条白名单。
- sweetalert2 11.4.6 → 11.22.4(前端依赖,会打进浏览器包)。升级后新版默认样式
  div:where(.swal2-container) .swal2-input 与我们的皮肤权重打平并靠注入顺序取胜,
  实测把输入框高度从 38px 压成 36.75px → 把皮肤前缀从 html 提到 html:root 修掉,
  并同步 3 条断言;jsdom 290/290 全绿。
- OSV 门禁复跑:exit 0,已过滤清单里只剩 laravel 9.x 那 4 条(上游无修复版本)
  与 debugbar / phpunit 等 dev-only 项。
2026-09-30 08:00:46 +08:00

21 lines
1.4 KiB
JSON
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.
{
"name": "lsky-pro-docker-tests",
"private": true,
"type": "module",
"//": "约定:npm test 用 shell 通配跑全量 *.test.mjs(新增测试文件不用改这里),任一个失败即非 0 退出;需要 Node >= 22.22(jsdom 30 的 engines 要求,Node 18 会报 ERR_REQUIRE_ESM)",
"//deps": "sweetalert2 / less 在这里**正经声明**:swal-theme.test.mjs 要读 sweetalert2 自己注入的 CSS、并调 lessc 编译 common.less。以前它直接去读 ../src/node_modules,换个环境(CI 新拉的 checkout 没有 src/node_modules)就跑不了。这两个包用**精确版本**(= src/package-lock.json 里应用构建期实际用的那份):CSS 断言依赖 sweetalert2 的具体默认样式,换版本会真的改变结果 —— 实测升级 11.4.6 → 11.22.4 时它把默认规则改成 `div:where(.swal2-container) .swal2-xxx`(权重从 (0,1,0) 抬到 (0,1,1)),输入框高度那几条断言当场变红,直到把 common.less 的皮肤前缀从 `html ` 抬到 `html:root `。src 升级时这里要同步跟着升(swal-theme.test.mjs 里有逐字一致性断言兜底)。",
"engines": {
"node": ">=22.22"
},
"scripts": {
"test": "for f in *.test.mjs; do echo \"== $f\"; node \"$f\" || exit 1; done",
"repro": "node repro-clickthrough.mjs"
},
"devDependencies": {
"jquery": "3.7.1",
"jsdom": "^30.1.1",
"less": "4.1.2",
"sweetalert2": "11.22.4"
}
}