feat: production hardening - CORS whitelist, strong password, tokenVersion revoke, VIP card hashing, admin secret

This commit is contained in:
2026-05-10 22:53:32 +08:00
parent 5b23c88df9
commit 21709e5d97
9 changed files with 299 additions and 69 deletions

View File

@@ -1,13 +1,13 @@
# 数据库连接
DATABASE_URL="postgresql://postgres:password@localhost:5432/maqt?schema=public"
# JWT 密钥(修改为随机字符串)
JWT_SECRET="your-super-secret-jwt-key-change-this-in-production"
# JWT 密钥(务必修改为随机字符串)
JWT_SECRET="change-me-to-a-random-64-char-string"
# JWT 过期时间
JWT_EXPIRES_IN="7d"
# 数据加密密钥32字节修改)
# 数据加密密钥32字节务必修改)
ENCRYPTION_KEY="0123456789abcdef0123456789abcdef"
# 服务端口
@@ -16,5 +16,8 @@ PORT=3001
# 环境
NODE_ENV="development"
# VIP 卡密批次密钥(用于生成卡密签名)
BATCH_SECRET="your-batch-secret-key"
# CORS 允许的来源 (逗号分隔)
ALLOWED_ORIGINS="http://localhost:5173,app://.,file://"
# 管理员密钥 (用于 /api/admin 端点)
ADMIN_SECRET="change-me-to-random"