fix(auth): 固定验证码改为显式 AUTH_EMAIL_DEV_CODE 环境开关(安全评审反馈)
ci / server (push) Failing after 10s
ci / design-system (push) Failing after 10s

不再从 mailer 运行时类型推导认证材料:固定码仅当显式设置
AUTH_EMAIL_DEV_CODE 时生效(run-dev.sh 设 888888,生产部署不经
该脚本即为随机码),设置时启动打印醒目告警。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-11 20:42:11 +08:00
parent 7dccd694e0
commit 8266c575aa
6 changed files with 16 additions and 6 deletions
+3
View File
@@ -42,6 +42,8 @@ type Config struct {
// SMTP(邮箱验证码登录;未配置降级 mock mailer
SMTPHost string
// EmailDevCode 非空时邮箱验证码固定为该值(仅开发脚本设置,生产禁用)
EmailDevCode string
// AppLatest 启动时解析 APP_LATEST_JSON 一次(17G):平台→版本信息。
// 解析失败或未配置则为 nil/空,handler 据此返回 204,不 fail-fast。
@@ -74,6 +76,7 @@ func Load() Config {
OSSEndpoint: os.Getenv("OSS_ENDPOINT"),
OSSBucket: os.Getenv("OSS_BUCKET"),
SMTPHost: os.Getenv("SMTP_HOST"),
EmailDevCode: os.Getenv("AUTH_EMAIL_DEV_CODE"),
OSSKeyID: os.Getenv("OSS_KEY_ID"),
OSSKeySecret: os.Getenv("OSS_KEY_SECRET"),