fix: 全量代码审计修复—安全/死代码/错误处理/配置净化

P0 安全修复:
  - 支付宝回调验签 (alipay_notify BTreeMap + rsa2_verify)
  - JWT fallback 'default_secret' 改为 .expect() (panic保底)
  - 安全响应头中间件 (CSP/X-Frame-Options/HSTS)

P1 死代码清理:
  - 移除孤儿文件 src/alipay.rs (284行, 无mod注册)
  - 移除Cargo未使用依赖 (actix-files/error/log/hex/digest)
  - log::info! → tracing::info! (auth.rs)
  - 移除 config.rs server_host + 3个TOML定义

P1 质量修复:
  - 修复 weather.rs unwrap() → unwrap_or
  - 修复 auth.rs+payment.rs 错误吞咽 (add tracing::warn)
  - 修复 main.rs 3x parse().unwrap → unwrap_or

P3 运维:
  - 新增 scripts/backup-db.sh (定时备份用)
  - 新增 README.md (快速入门文档)
  - deploy.sh 集成 backup-db.sh 上传
This commit is contained in:
moira
2026-05-13 17:15:36 +08:00
parent cb483298d5
commit 27c8979690
14 changed files with 224 additions and 405 deletions

View File

@@ -4,17 +4,14 @@ version = "0.3.0"
edition = "2024"
[dependencies]
actix-files = "0.6.8"
actix-web = {version = "4.11.0", features=["openssl"]}
chrono = {version = "0.4.41", features=["serde"]}
dotenvy = "0.15.7"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
tracing-appender = "0.2"
error = "0.1.9"
include_dir = "0.7.4"
jsonwebtoken = "9.3.1"
log = "0.4.28"
openssl = "0.10.73"
rand = "0.8"
reqwest = { version = "0.12.23", features=["json"]}
@@ -28,8 +25,6 @@ base64 = "0.22"
rsa = { version = "0.9", features = ["pem", "sha2"] }
pkcs8 = "0.10"
sha2 = "0.10"
hex = "0.4"
digest = "0.10"
[dev-dependencies]
tokio = { version = "1", features = ["full"] }