Avoid the CORS preflight on patch artifact reads
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- google-cloud, javascript
- 领域
- api, cloud, frontend, networking
调研方向
从 #6856 的补丁面板、/api/runs/:runId/artifacts/*path 路由以及 tracePropagationTargets 配置开始。比较 inline proxy 和 excluded-trace-propagation 这两种方式,包括它们对签名下载、CORS 和 tracing 的影响。当读取补丁不再产生本可避免的 preflight,并且所选行为在本地和 GCS 中都能继续正常工作时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
The patch panel (#6856) reads changes/changes.patch with fetch() against /api/runs/:runId/artifacts/*path, which 302s to a signed GCS URL.
The Sentry browser SDK adds sentry-trace and baggage to that fetch, since the URL is same-origin when the headers are decided. The browser then replays them across the redirect, so the cross-origin leg to GCS carries two non-safelisted headers and must be preflighted. GCS builds Access-Control-Allow-Headers from the bucket's CORS responseHeader list, so until those names were listed the preflight returned 200 with no
access-control-* headers and the read failed.
Unblocked for now by allowing OPTIONS in the bucket's CORS method list and adding sentry-trace and baggage to responseHeader. Worth revisiting:
- Every patch load costs an OPTIONS plus the GET, on top of our own 302. The preflight cache never helps because each load gets a freshly signed URL.
- GCS ignores
sentry-trace, so we send trace metadata to Google and get no trace continuity for it. - Infra config now hardcodes SDK header names; a new propagation header would break the panel again as an opaque CORS error.
Possible fixes:
- Add an inline mode to the artifact route that proxies the preview bytes same-origin, keeping the 302 for download links. No CORS, no preflight, works locally, keeps browser-to-server trace linkage. Bytes transit Cloud Run, bounded by a read cap (I would avoid this solution).
- Exclude the artifact path from trace propagation:
tracePropagationTargets: [/^\/(?!api\/runs\/[^/]+\/artifacts\/)/]. Drops the preflight, but loses trace linkage for that route and still needs
bucket CORS for the GET.
- 主要语言
- Python
- 星标
- 570
- 派生
- 351
- 平均合并
- 2 天 2 小时
- 30 天内合并 PR
- 73
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mozilla/bugbug 的其他 Issue
-
hackbot
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 3 天内回复
-
hackbot
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 3 天内回复
-
good-first-bug hackbot
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
good-first-bug hackbot
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 3 天内回复
-
good-first-bug hackbot
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 3 天内回复
相似的 Issue
-
needs triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
openvinotoolkit/openvino_notebooks#3665 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
benchmark-gap
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复