cold-import.service.ts
98.2 KB
-
fix(tenant): agent 审查发现的 4 个 HIGH · a6d7eb22
① source_event_id 品牌盲 → 数据丢失(HIGH):synthesizer 的幂等键 ${ctx}:${resource}:${subjectId}:${updatedAt} 不含品牌,两品牌同 subjectId+ updatedAt 撞键被去重跳过 → 丢 transaction/fact。并进 source_unit(re-import 仍幂等)。 ② persona by-id 跨品牌泄漏(HIGH):/patients/:id/persona 的 getCurrent 无 scope 过滤 (Persona 非 source_unit 模型,纵深防御只注 tenantId 不注品牌)。加经 patient 关系的 sourceUnit 过滤;controller + 2 处 MCP 调用传 scope。 ③ MCP by-id 泄漏(HIGH):MCP @Public 无 ALS 上下文,纵深防御不兜; assertPatientInScope / activeRecallPlan 只按 host+tenant,补 sourceUnit 过滤。 ④ exchangeToken 真 host SSO 丢 sourceUnits(latent):TokenExchangeUserSchema 加 source_units + exchangeToken 透传(否则真 host 登录 = 不限品牌)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>luoqi committed