Skip to content

CHANGEPASSWORD-INACTIVE-GATE-01: 升级 dominance-lite → 完整 CFG/SSA 控制流支配检查 #1212

Open

Description

@ghbvf

现状

CHANGEPASSWORD-INACTIVE-GATE-01(tools/archtest/changepassword_inactive_gate_test.go)当前用 dominance-lite:遍历 changePasswordInTx 的 fd.Body.List 顶层语句,要求一个无条件 credentialauthority.Assert guard(出现在 ExprStmt/AssignStmt 表达式、IfStmt.Init、或 ReturnStmt result 这类必经求值槽)位于含 UpdatePassword 的首个语句之前。这关闭了 PR #1207 review F2 的「条件分支绕过」(if cond { Assert(...) } 后跟无条件 UpdatePassword)。

但 dominance-lite 不是完整控制流支配,残留盲区:

  • switch/select 各 case 内都有 Assert 但无任一无条件顶层 guard → 误报(fail-closed,可接受但不精确);
  • 顶层语句间存在 early-return / goto 时,statement-index ordering 不等价于真支配;
  • 跨函数 helper 抽取 Assert + mutation 仍只能 fail-closed(见 archtest godoc 盲区清单)。

修复方向

用 golang.org/x/tools/go/cfg 为 changePasswordInTx 构建控制流图,或 golang.org/x/tools/go/ssa 的 dominator 查询,验证真支配:「每条到达 UpdatePassword 调用块的路径都先经过 credentialauthority.Assert 调用块」。据此把评级从 Medium 提升到接近 Hard(控制流级,而非 AST 语句级)。

需评估:archtest 引入 go/ssa 依赖的构建成本 vs 单一已知函数的收益(当前判断为 Medium 文档化天花板,本 issue 跟踪是否值得升级)。

Files

  • tools/archtest/changepassword_inactive_gate_test.go

Trigger

PR #1207 review F2:detector 只比 token.Pos,条件分支可绕过控制流支配。已用 dominance-lite 关闭 conditional-bypass(red_conditional_gate_bypass fixture);CFG/SSA 是彻底版,登记跟踪。

Source

Discovered via /fix #1017(PR #1207 review F2)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-auth认证 Authn + 授权 AuthzbacklogBacklog item — automation trigger 入 projectcx-2Cx2 改动量:同包 ≤5 文件pri-p1Priority P1type-refactor重构

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions