返回 Bug 清单
BUG-0843project-74中已修复security-cors

删除重复 CORS middleware + SSE bootstrap 从 Postgres outbox 取

发现:2026-10-09验证:2026-10-31置信度:70%

症状

commit 1525e4158b72 (2026-09-16) fix(api): 删除重复 CORS middleware + SSE bootstrap 从 Postgres outbox 取

根因

根因 1: main.go withCORS 包装层在最外层, OPTIONS 时直接 204 return 不进 next,

修复方案

修复 12 行,删除 2 行。改动文件: services/api/cmd/server/main.go, services/api/internal/httpapi/ainative.go

错误签名

fix(api): 删除重复 CORS middleware + SSE bootstrap 从 Postgres outbox 取 根因 1: main.go withCORS 包装层在最外层, OPTIONS 时直接 204 return 不进 next,
导致 handlers.go corsMiddleware 永远碰不到 OPTIONS 请求, Allow-Headers 写死漏了 Registrar-Key。
修复: 删除 main.go 的 withCORS 包装, 让 handlers.go corsMiddleware 成为唯一 CORS 入口
(动态 Origin + Allow-Credentials + Registrar-Key header)。

根因 2: 容器重建后 Bus.history 内存清空, SSE bootstrap 只查 Bus.Recent 返回空,
但 eventsRecent 端点有 Store.ListPlatformEvents(10) → Bus.Recent 降级链。
修复: SSE bootstrap 先走 Store.Li

技术信息

来源项目

project-74

涉及文件

services/api/cmd/server/main.go, services/api/internal/httpapi/ainative.go

标签

git-sweep, auto-ingested, project-74, mcp-reported, source-agent