unbridled-41 opened a new pull request, #4286:
URL: https://github.com/apache/rocketmq-dashboard/pull/4286

   Fixes #4281.
   
   ## Problem / Evidence
   
   `GET /api/k8s-certs`(`K8sCertService.listCerts`)对任意已认证用户返回每张证书存储的 
`keyPem`(TLS 私钥 PEM):
   
   - `AuthInterceptor.requiresAdmin` 对 GET 放行除 `isAdminOnlyGetPath` 
外的全部路径,`/api/k8s-certs` 不在名单内;该白名单注释写明设计意图是"Read endpoints stay open to 
readers, except credential views that expose 
secrets",同类凭据回显端点(`/api/acl/users/{id}/credentials`、`/api/cloud-credentials/{id}/credentials`)均被门控;
   - 证书页前端对私钥字段自己声明"仅保存,不会在页面展示或返回"(certs.tsx 私钥表单 extra),列表渲染不读取 
`keyPem`——响应携带私钥是纯暴露;
   - create/update 响应虽也带 `keyPem`,但那两个 POST 走管理员门控;GET 
列表是读者可达面。回归测试先红:`listCertsShouldNotExposeTheStoredPrivateKey`(keyPem 非 null)。
   
   ## Root cause / Fix
   
   `listCerts` 直接返回含 `keyPem` 的映射结果。修复:列表路径将响应 VO 的 `keyPem` 置 null(仓库 
`findAll()` 每行新建 
VO,无活引用风险;存储记录不受影响,回归测试同时断言样本实体仍持有私钥)。create/update(管理员专用)响应不变,`certPem`(公开数据)不处理。
   
   ## Priority & scoring
   
   PRIORITY 78 = 影响 32(reader 角色一次 GET 枚举全部集群 TLS 私钥,无审计事件,凭据面暴露)+ 波及 12(单端点+零 
UI 消费方)+ 可复现 20(确定性 HTTP 调用)+ 维护价值 14(对齐拦截器自身的密钥门控意图与前端契约);FIX_CONFIDENCE 90。
   
   ## Tests
   
   - 回归先红:`mvn -o test -Dtest=K8sCertServiceTest` → `Tests run: 19, Failures: 
1`;修复后 `K8sCertServiceTest + K8sCertControllerTest` 全绿。
   - 全量后端(独立 worktree 于 head 9800e9ef 上 `mvn -o clean test`):2152 
tests(pristine 6c24d2ed = 2151 + 本 PR 新增 1),2 失败 = AuthCorsIntegrationTest 
×2(基线预存,开放 PR #4217 已认领修复)——零新增失败;编译由 test 阶段覆盖。
   - numstat 自检:`K8sCertService.java +6/−0`、`K8sCertServiceTest.java +15/−0`。
   
   ## Risk
   
   低-中。删除的是"列表响应中的私钥回显",仓库内无任何消费方(UI 不读取、无其他调用点);若存在仓库外未知的消费方,需改用 reveal 
类管理员端点。CI:upstream 工作流全部 startup_failure(0 check-runs),head 9800e9e 无 CI 
结果,以上为本地完整验证。
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to