AGC对主站的请求添加header #241
2 Participants
Notifications
Due Date
No due date set.
Blocks
#226 添加客户端特殊标识
GenarrativeAI/Genarrative
Reference: GenarrativeAI/Genarrative#241
Reference in New Issue
Block a user
Delete Branch "feat/agc_call_header"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
审查 head sha:
62771c1650发现 1 个明确问题,阻塞合并:AGC marker 会随重定向泄漏到非主站 origin。
问题:这个工厂只设置了
default_headers,没有设置redirect(Policy::none()),但它在生成/轮询等多个主站客户端中使用;reqwest 默认会跟随重定向。若主站或可控部署返回跨 origin 的 3xx,默认请求头会被复制到重定向请求,导致X-Genarrative-Client: agc发送给 OSS/第三方 origin,违反本 PR 约定的“只发当前主站 origin”。风险是来源标记泄漏并污染第三方请求统计。建议在工厂统一禁用重定向,或实现只允许同 origin 的 redirect policy,并补充跨 origin redirect 的请求捕获测试。AGC 主站 Client 只允许同 origin 重定向;跨 origin 3xx 不会由客户端继续请求,因此 X-Genarrative-Client: agc 不会被客户端发送到 OSS 或第三方 origin。
主站 Client 创建点不得覆盖为允许跨 origin 的 redirect policy;如未来需要类型级不可绕过,再迁移到 AgcMainSiteClient wrapper。