refactor(oapi): 提供方强制验签迁 starter——enforce-patterns+trust-registry(审计 P1-6 / L2-8)
build / build-push (push) Successful in 1m25s

- 删自写 svcitem/config/OpenApiAuthEnforceConfiguration(yh-app-auth starter 版
  RequireAppSignFilter 承接,order+11 行为等价;/oapi/site/list 面无签名即 401)
- yh.app-auth.server.enforce-patterns=[/oapi/*] + trust-registry=true(中央密钥链组合:
  trusted-apps 100018 先、Redis sign:app:* 链后,Notice/flow-center 同款)
- data-redis 自 test scope 提升编译期(yh-app-auth 侧 optional 不传递,生产 classpath
  此前并无该依赖);management.health.redis.enabled=false 防 Redis 抖动拉 DOWN 健康
- 测试 yml 同步 enforce-patterns:删自写副本后 SiteOapiIT 的 /oapi/** 401 断言由
  starter 过滤器承接;trust-registry 不进测试配置(IT 密封性,签名用例 100018 走
  trusted-apps 命中)

门禁:mvn test -Dskip.tests=false 413/413 绿(含 SiteOapiIT 6/6,本机 MySQL8+Redis)
This commit is contained in:
chenxing
2026-10-05 22:26:44 +08:00
parent 55d80e21a4
commit ed0c752f4a
4 changed files with 31 additions and 53 deletions
+17 -2
View File
@@ -60,8 +60,18 @@ yh:
# UserBase 注册后分配(进白名单),与 yh.open 保持一致;生产由 projman 注入
app-key: 100005
app-secret: 2c7885de594742cc840b8762910b2d2e
# 入站验签白名单:办事大厅 svc-hall(站点目录 /oapi/site/list 消费方,appKey=100018;
# P0-1 修复)。secret 与 svc-hall application.yml yh.app-auth.app-secret 逐字一致(联调态),
# 提供方强制验签(两级模型 §4.1,flow-center/Notice 同款):本地 svcitem/config/
# OpenApiAuthEnforceConfiguration 副本已删(2026-10-05),换此一行——/oapi/**(站点目录
# /oapi/site/list)无签名三件套即 401(starter 版 RequireAppSignFilter,order +11 行为等价)
server:
enforce-patterns: [/oapi/*]
# 中央密钥链(两级模型 §4.2):trusted-apps 先(确定性兜底),未命中走 SignKeyResolver
# (Redis sign:app:* → Caffeine → UserBase 兜底端点)——任何在 UserBase 注册过的 appKey
# 自动可验。需 data-redis 编译期依赖(yh-app-auth 侧 optional 不传递,pom 已提升 scope)
trust-registry: true
# 入站验签白名单(组合链第一层,Redis 停摆时确定性工作):办事大厅 svc-hall
# (站点目录 /oapi/site/list 消费方,appKey=100018;P0-1 修复)。
# secret 与 svc-hall application.yml yh.app-auth.app-secret 逐字一致(联调态),
# 生产两侧由 projman/Nacos 注入同一密钥对
trusted-apps:
"100018": "svc-hall-dev-secret-100018"
@@ -120,6 +130,11 @@ management:
endpoint:
health:
show-details: never
# 密钥链验签依赖 Redis(sign:app:*)。关掉 Redis 健康指标:Redis 抖动不应把 /actuator/health
# 拉成 DOWN(503),否则部署健康检查与探活会误判整机不可用(Notice/flow-center/svc-hall 同口径)
health:
redis:
enabled: false
# 文件上传(同 UserHome 双 key 约定,方案 §7.3)
# FILE_WEB_PATH 只接受相对路径(默认 /cms/upload/,含 context-path)或公网可达绝对地址;