refactor(oapi): 收敛 Notice 范式——回调收口+提供方强制验签迁 starter(审计 P1 / L2-7 L2-8)
build / build-push (push) Successful in 1m37s

回调(对齐《子应用流程与消息对接手册-20260929》Notice 线上形态):
- yh.flow-callback.path 迁 /oapi/flow/callback;删 callback-url(改 starter 三段推导:
  base-host+前缀三层回落+path,生产=http://open-gateway-service:10013/svc-hall/oapi/flow/callback)
- verify-flw-signature=false(平台应用签名承担,X-Flw 不启用);reconcile-on-register=true
  (路径漂移自动重注册,160 存量 /callback/flow 行靠它收敛)
- 删 svchall.public-base-url(唯一消费方即 callback-url 拼接)与 yh.open.base-path
  (对齐 Notice 形态;该键代码默认值即 /userbase,删键无行为变化)
- deriveCallbackBasePath 剥尾段口径同步 /oapi/flow/callback(契约测试断言更新)

提供方(flow-center 同款组合链):
- 删自写 OpenApiAuthEnforceConfiguration(starter 版 RequireAppSignFilter 承接,order+11 等价)
- yh.app-auth.server.enforce-patterns=[/oapi/*] + trust-registry=true;trusted-apps 保留
  100005(CMS) 并增 100019(flow-center 回调推送兜底);pom 显式引 data-redis(optional 不传递)
- management.health.redis.enabled=false(Redis 抖动不拉 DOWN 整机健康)

门禁:mvn test 127/127 绿
This commit is contained in:
chenxing
2026-10-05 22:26:22 +08:00
parent f368299eb5
commit eb0a8ded2f
7 changed files with 70 additions and 79 deletions
+40 -14
View File
@@ -45,7 +45,7 @@ yh:
allow-headers: all
allow-origins: all
# 用户面(发起/我的办件)与管理面全在 /api/* 下;本应用无匿名面。
# 流程中心回调走 /callback/*(不在 pattern 内,由 FlowCallbackVerifyFilter 验签保护)
# 流程中心回调与业务供数都在 /oapi/*(不在 pattern 内,由平台应用签名强制验签保护)
url-pattern: /api/*
app-auth:
enabled: true
@@ -55,35 +55,56 @@ yh:
# 联调态密钥(与 flow-center trusted-apps["100018"] 逐字一致);
# 注意旧占位"裸 32 个 0"会被 YAML 按八进制整数解析成 "0",签名时 SignUtil 校验直接失败,必须带字母+引号
app-secret: "svc-hall-dev-secret-100018"
# 入站验签白名单:CMS(供数消费方,appKey=100005);流程中心 flow-center 分配 appKey 后在此追加
# 提供方强制验签(两级模型 §4.1,flow-center 同款):本地 OpenApiAuthEnforceConfiguration 副本已删,
# 换此一行——/oapi/**(含 /oapi/svc/** 供数与 /oapi/flow/callback 回调接收)无签名三件套即 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 已显式引入)
trust-registry: true
# 入站验签白名单(组合链第一层,Redis 停摆时确定性工作):CMS(/oapi/svc/** 消费方,appKey=100005)、
# flow-center(回调推送方,appKey=100019 联调态密钥;生产密钥由平台注入)
trusted-apps:
100005: 2c7885de594742cc840b8762910b2d2e
"100019": "flow-center-dev-secret-100019"
open:
# 身份密钥唯一来源 = yh.app-auth.app-key/app-secret(本文件 app-auth 段),open.* 副本已删
base-host: http://base.yunhaixingtong.com
base-path: /userbase
# 服务目录(子应用配置优化方案 §4.2):跨服务出站唯一地址来源,命名目标走 SDK 门面 /
# YschOpenCall。cms 未晋升 PlatformService 枚举(按名直调);flow-center 已入枚举,此处
# 显式覆盖为本地端口。完整 URL 拆 host+ctx,per-target base-path 与提供方 context-path
# 对齐 → 签名天然一致。生产改容器直连:flow-center=http://flow-center-service:10008/flow-center、
# YschOpenCall。cms 未晋升 PlatformService 枚举(按名直调);flow-center 已入枚举。
# 完整 URL 拆 host+ctx,per-target base-path 与提供方 context-path 对齐 → 签名天然一致。
# 生产改容器直连:flow-center=http://flow-center-service:10008/flow-center、
# cms=http://yschcms-service:10005/yschcms。
# (base-path /userbase 已删 2026-10-05,对齐 Notice 形态:该键代码默认值即 /userbase,删键无行为变化,
# 回调前缀推导读的是 yh.flow-callback.target/base-path 三层回落,与本键无关)
services:
# 生产零配置:不配则枚举兜底 = base-host(网关)+/flow-center;此处显式覆盖仅本地开发用
# (Notice 同款)。生产如仍被平台层注入容器直连值,属平台配置项(projman yh.open.services 段)。
flow-center: http://localhost:8085
cms: http://base.yunhaixingtong.com:10005/yschcms
# 流程中心回调接收端 starter(2026-09-20 迁移,X-Flw 验签式):端点保持既有 /callback/flow,
# 存量注册的 callback_url 不变、零 secret 轮换;幂等/乱序门由 starter 承担,
# 业务映射见 SvcFlowCallbackHandler;secret 镜像在 flow_callback_reg(迁移 SQL 见 sql/)
# 流程中心回调接收端 starter(2026-09-20 迁移;2026-10-05 收敛 Notice 形态):
# 端点/幂等/乱序门由 starter 承担,业务映射见 SvcFlowCallbackHandler;
# 验签由上方 /oapi/* 平台应用签名强制验签负责(X-Flw 不启用;flow-center 推送三件套+X-Flw 双带,
# Notice 线上实证此形态);secret 镜像在 flow_callback_reg(迁移 SQL 见 sql/)
flow-callback:
path: /callback/flow
path: /oapi/flow/callback
biz-types: [svc_item]
verify-flw-signature: true
callback-url: ${svchall.public-base-url}/callback/flow
# 漂移自动核对(Notice 同款):端点路径/ctx 变更后,镜像行有效但登记 URL 与当前期望不一致时
# 自动重新注册(会轮换 secret)——2026-10-05 改路径后 160 存量 /callback/flow 行靠它收敛
reconcile-on-register: true
# 注册地址不再显式配置(callback-url 已删):由 starter 推导
# (open-host ?: yh.open.base-host) + /{前缀} + path,前缀三层回落 target → base-path → 运行时自证
# context-path(本仓三层均未显式配置 → 生产 ctx=/svc-hall 自证)。
# ⇒ 生产 = http://open-gateway-service:10013/svc-hall/oapi/flow/callback(base-host 平台注入)
# 改地址回滚:把全地址写回 callback-url 即可(回滚绳),无需回滚镜像。
# ===== 办事大厅专属配置 =====
svchall:
# 本应用对外可达基址(回调注册 callbackUrl = {public-base-url}/callback/flow;projman 注入)
public-base-url: http://localhost:8086
# (public-base-url 已删 2026-10-05:唯一消费方是回调注册 callback-url 拼接,回调地址改由
# yh.flow-callback 三段推导(见上方该段),本应用地址类配置进一步清零;file.public-base-url 是另一键不受影响)
# 办事大厅前端地址(办件 bizUrl 落地页用)
front:
base-url: http://localhost:8087
@@ -121,6 +142,11 @@ management:
endpoint:
health:
show-details: never
# 密钥链验签依赖 Redis(sign:app:*)。关掉 Redis 健康指标:Redis 抖动不应把 /actuator/health
# 拉成 DOWN(503),否则部署健康检查与探活会误判整机不可用(Notice/flow-center 同口径)
health:
redis:
enabled: false
# 文件存储磁盘路径(Notice 三件套约定;Docker 部署时与 volume 挂载一致)
FILE_PATH: D:/bsch/svchall/upload/