Repository navigation
fix(totp): 持久 factor 绑定、有限匹配及删除账号恢复 - #882
Merged
Merged
Conversation
Preserve uncertain recovery state with allowlisted diagnostics when enrollment leaves both secrets usable. Factor binding and recovery follow-up remain pending. Refs #881
2 tasks done
…tials safely Bound local challenges, atomically preserve encrypted factor provenance, and require fresh binding before promotion. Add insert-only recovery import, idempotent migration, and isolated PostgreSQL/API acceptance. Refs #881
Require both recovery subtests to fail their own conflict assertion and replace inverted grep checks with explicit failures. Label the old-Upsert compatibility reproduction accurately. Refs #881
Check fixture type assertions and express the accepted factor alphabet directly. Repairs exact-head golangci-lint findings without changing the binding contract. Refs #881
Only exact allowlisted OTP codes at the MFA verify HTTP boundary produce a typed rejection. Explicit non-OTP codes, message-only and duplicate fields stop matching. Cover the independent session_expired counterexample through real getJson/assertOk and the complete CLI. Refs #881
…tp-factor-binding
ranxi2001
marked this pull request as ready for review
November 16, 2026 14:16
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.
解决的问题与行为变化
多 TOTP 账号原先按返回顺序选择第一个 factor,新增验证器后又要求旧密钥失效,导致两个有效验证器被笼统视为失败。本 PR 持久保存密钥与 factor 绑定,按明确拒绝执行有限匹配,并支持软删除账号的恢复。当前 head
5474722715fc7b9faf4bfdcbe167990e75c9624c已完成源码审查;71 项检查成功、46 项按条件跳过,当前各工作流最新 attempt 无失败或等待项;全历史仍保留首轮 E2E failure。selected_factor_verified_no_revocation,不要求另一个有效密钥失败,不删除任何 factor。未获得本次绑定确认不能提交成功,未决任务保留候选及来源。INSERT ... ON CONFLICT DO NOTHING,零行写入返回 409;并发赢家配置不得被覆盖。原身份未决时不允许重新 enroll。独审 R1 已修复:原 raw
ProtocolClient.getJson/assertOk将整个 JSON 拼入异常,error.code=session_expired配上message=incorrect code会错误挑战 F2。现在真实 raw HTTP 边界只把精确允许的 OTP code 转为类型化拒绝,MFA 不再用异常全文 regex。message-only、显式非 OTP code、重复字段、429、网络错误均停止。R1 原始 reviewer RED 保留;同反例在实际 raw 模块和完整 CLI 先 RED,再生产 patch GREEN。17 项 raw module、27 项 worker/CLI、19 项 adapters、11 项 journal/diagnostics 通过;独审原复现脚本复制到新临时模块后
actual_challenges=1。补丁源码 hash guard 保留,并改用无空白上下文的 tracked diff;基于最新 production 的整个 PR rangegit diff --checkexit 0。关联记录与来源
production;原开发基线:da526bfbab47efd40549cab98f1069f9b2b45b9f;已普通合并 productionc16da7d8658787b5fa88f3ad23108ced1a8ac49c,保留提交历史;当前冻结验收 head:5474722715fc7b9faf4bfdcbe167990e75c9624c。管理员新功能提示
NewFeatureBadge展示位置:不适用;未添加前端入口。复现与验收
verification_failed。实际离线 RED 已保存。TestTOTPRecoveryInsertNeverOverwritesExistingOrConcurrentConfig覆盖现存配置及可观察锁等待的确定性新配置竞态;两种情况下均要求输家 409、赢家完整配置不变。TestTOTPBindingMigrationCanReloadWithoutReplacingSnapshot实际重复执行 migration 并重新读取。UpsertConfigSQL,复现旧行为;不是完整历史 blob 恢复。RED 要求 existing 与 concurrent-insert 各自确切 FAIL 和各自的 conflict 断言,拒绝 build/setup/undefined/no-tests/skip/panic/race/timeout 污染。GREEN 前还原并检查干净 candidate。协议、调度或传输改动补充
verified: false。实际验证
node --test tools/test_openai_totp_protocol.mjsGREENred-02、red-06、green-06原始日志python3 -m unittest tools.test_openai_totp_integration tools.test_openai_totp_rotation -vred-03/04、green-08green-05-worker-regression.loggreen-09-codex-matching.log:7 项、exit 0;保留初次旧单次挑战断言失败日志,不隐藏失败green-10-node.loggreen-11-adapter-compat.log;不是完整 runtime 构建green-12-acceptance-gate.log;缺任一子用例/对应诊断、执行污染均被拒绝git diff --checkgo build -tags embedLinux binary36f99d2dd41ca58c94d1e9732865c93cd80894ccac39d653d3316bb98561f4f4原始本地审计日志位于
/data/development/artifacts/issue881/;远程日志/证据随 workflow artifacts 按 head SHA 保留。旧头 Go/PG/runtime/API/build 成功及独审 R1 失败证据均保留。本轮补充审查核对绑定校验、加密存储、恢复导入的并发保护、协议拒绝分类及最新 production 的无冲突整合;未发现新增阻断问题。未执行真实上游登录或生产部署。兼容性与运行影响
IF NOT EXISTS,只补空的历史邮箱快照,不覆盖已有快照。开发基线迁移最新为 381;精确 head547472271的真实 migrate/reload、CAS/并发保护已在 run43873797817重新通过(37 条 PG PASS,含子用例)。文档与用户可见变化
docs/openai-totp-factor-recovery.md描述匹配预算、成功不等于撤销、任务恢复接口、同身份目标导入、未决身份禁止重新 enroll、外部导入的受支持恢复路线以及回滚限制。无 UI 重设计或未验证截图声明。Agent 使用声明
Codex(本轮合并推进):源码与 CI 审查、正文状态更新;GPT-6,完整模型 ID 与推理强度未知(当前接口未提供)。未启动子 Agent。
Codex CLI:唯一代码 writer,分析、实现、离线回归、文档和远程验收跟进;实际 session metadata 为
gpt-6-astra/xhigh,fast requested,delivered tier 未确认。未派生代码子 Agent。Hermes Agent(Nous Research)监督 Agent:任务/重复项核查、实际 diff 和原始日志审阅、Draft 发布及验收纠偏;先前披露模型
gpt-6.1-sol,推理强度未知(监督运行上下文未提供配置档位)。Hermes Agent 独立完整审查:
gpt-6.1-sol,推理强度未知(运行时未提供);发现并离线复现 R1。已独立复审精确头5474722715fc7b9faf4bfdcbe167990e75c9624c并亲自执行 raw module/完整 CLI 同测 RED/GREEN,R1 CLOSED / SOURCE CLEAR;精确 head 最新 CI attempt 已通过,合并结果的 production CI 单独跟踪,不把无冲突整合当作 combined-base 动态通过。提交前自查
production,同分支唯一 PR,无无关源码或其他工作树修改。合并状态:GitHub 记录账号
ranxi2001于2026-11-16T14:19:31Z合并,merge commit41778efe6f7cb28dd2c70a4b70c6c8b6f04a352c;本次监督与原代码 writer 未执行 ready/merge。合并前最新 attempt 的 117 个 job 全终态(71 success、46 skipped),最后完成的是 E2E 重跑14:18:29Z;历史首轮 E2E13:30:31Zfailure 保留。合并 commit 的 production CI 尚未全部完成,按该精确 merge SHA 单独跟踪,尚无完整 combined-base 动态 GREEN。Issue #881 保持 open;未 release、deploy 或执行真实授权/登录/2FA。