fix(static): 第2轮审计修复12项安全缺陷

修复 P1 路径遍历前缀 bypass、代理错误信息泄露、大文件 OOM、邮箱枚举与 CORS 通配;P2 Range 边界、hash 参数校验、db 连接复用、favicon 端口校验、日志批丢、端口解析异常。CSP/SSL 标记为已知限制。审计文档同步更新,修复率 36% → 88%。
This commit is contained in:
qing committed 2026-08-08 02:21:08 +08:00
1 parent 1ed48a1f48
commit bcec529761
4 files changed
+421 -172

No files matched your search

+7 -5
View File
@@ -120,7 +120,11 @@ class LogClient:
# ── 内部实现 ────────────────────────────────────────────────────────
def _send_batch(self, batch: list):
"""后台线程回调:逐条 INSERT 到 db(与旧版行为一致:网络错误放弃本批剩余)。"""
"""后台线程回调:逐条 INSERT 到 db。
NEW-13:单条失败仅跳过该条,不再因网络异常放弃整批剩余日志。
RpcError 视为可重试的业务错误(如 db 临时拒绝),继续处理下一条。
"""
for entry in batch:
extra_val = entry.get("extra")
try:
@@ -141,11 +145,9 @@ class LogClient:
}
try:
self._client.call("execute", payload, timeout=_TIMEOUT)
except RpcError as e:
print(f"[log_client] INSERT 失败: {e}", file=_sys.stderr)
except Exception as e:
print(f"[log_client] 发送失败(放弃本批剩余): {e}", file=_sys.stderr)
break
print(f"[log_client] INSERT 失败(跳过本条): {e}", file=_sys.stderr)
continue
def _on_error(self, e: Exception, batch: list):
"""异常安全网:handler 外的异常也不会崩溃线程。"""