Repository navigation
ci: TOTP_ENCRYPTION_KEY 改由 GitHub Actions 写入 secrets 文件并做必填校验 (ONE-519) - #158
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动 F:
TOTP_ENCRYPTION_KEY改由 GitHub Actions 配置(ONE-519)规格 v1.2 §4B:
TOTP_ENCRYPTION_KEY不再放 CF 控制台,改由 hop 仓库 Secret 经 CI 注入,与JWT_SECRET/SETUP_SECRET同路(GitHub Secrets →--secrets-file)。改动文件
.github/workflows/deploy.yml:Write secrets file 步 env 增加TOTP_ENCRYPTION_KEY: ${{ secrets.TOTP_ENCRYPTION_KEY }};必填校验循环加入该键(缺失即失败关闭,错误信息点名缺哪把);写入$RUNNER_TEMP/secrets.json的 JSON 增加该键。.github/scripts/test-deploy-checks.mjs:新增 3 个回归用例,均执行deploy.yml里真实的 Write secrets file 步脚本(复用既有stepScript()取真实脚本,不另写等价逻辑):TOTP_ENCRYPTION_KEY,且权限仍为 600;TOTP_ENCRYPTION_KEY,且不写 secrets 文件(后续 Deploy 步拿不到--secrets-file,部署不继续);secrets.TOTP_ENCRYPTION_KEY、必填校验清单覆盖该键。不改运行时代码(绑定名与读取方式不变)、不动 schema/迁移、不碰其他仓库。
自测
node --test .github/scripts/test-deploy-checks.mjs→ 34 pass / 0 fail(新增 3 个用例全绿)node --test .github/scripts/test-d1-migrations.mjs→ 18 pass / 0 failpnpm exec biome check .github/scripts/test-deploy-checks.mjs→ 无告警["JWT_SECRET","SETUP_SECRET","TOTP_ENCRYPTION_KEY"]密钥值纪律
团队不经手、不回读该 Secret 的值;测试只用测试专用假值,只验「键名在/不在」与接线,不验真实值。缺键时失败关闭(set -euo pipefail + 显式 exit 1),不会用空值覆盖线上 Secret。
注意事项
keep_vars = true不改)。