bug: GCS upload detection in MediaManager uses substring match on the full URL
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
In MediaManager._process_upload_media_job (langfuse/_task_manager/media_manager.py), the SDK decides whether an upload target is a GCS bucket with a substring check:
is_self_hosted_gcs_bucket = "storage.googleapis.com" in upload_url
If that matches, the SDK skips the x-ms-blob-type and x-amz-checksum-sha256 headers.
Because it is a substring match on the whole URL, it also matches URLs that are not GCS, for example:
https://example.com/upload?next=storage.googleapis.com(string in the query)https://storage.googleapis.com.example.com/upload(string as a prefix of another domain)
Those uploads are then sent without the headers the SDK would normally add for S3/Azure targets, including the SHA-256 checksum header.
The upload URL comes from the Langfuse server, so I don't see this as exploitable in a normal setup. It is a hardening / correctness fix: the check should look at the URL hostname rather than the raw string.
Proposed fix
Parse the URL and treat it as GCS only when the hostname is storage.googleapis.com or ends with .storage.googleapis.com. Existing behaviour for real GCS URLs (path-style and bucket.storage.googleapis.com) is unchanged.
I have a small PR ready with a unit test in tests/unit/test_media_manager.py that fails before the change and passes after. Happy to open it if this looks good.
Environment
- langfuse-python 4.16.0 (current
main)
- 主要语言
- Python
- 星标
- 498
- 派生
- 361
- 平均合并
- 16 小时 40 分钟
- 30 天内合并 PR
- 38
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
langfuse/langfuse-python 的其他 Issue
-
tests/unit/test_prompt.py fails on a fresh clone without LANGFUSE_* env vars可能已有人在做 @Mathoholic 于 2 天前认领。 未关闭bug feat-prompt-management sdk-python
难度 2/5 1-3 小时 新手友好度 80/100
langfuse/langfuse-python#1976 · 3 条评论 ·
维护者通常 1 天内回复
-
bug(langchain): failed streaming LLM runs retain IDs in callback memo可能已有人在做 @hassiebp 于 2 天前认领。 未关闭bug integration-langchain sdk-python
langfuse/langfuse-python#1977 · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug: ChatPromptClient.compile appends str(whole list) once per non-dict placeholder item可能已有人在做 @hassiebp 于 4 天前认领。 未关闭bug feat-prompt-management sdk-python
langfuse/langfuse-python#1971 · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug: LANGFUSE_MAX_EVENT_SIZE_BYTES is parsed but never enforced for score events可能已有人在做 @hassiebp 于 4 天前认领。 未关闭bug feat-scores sdk-python
langfuse/langfuse-python#1966 · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug: non-numeric status in a 207 error entry raises inside handle_exception, kills the score consumer thread, flush()/shutdown() then hang可能已有人在做 @hassiebp 于 4 天前认领。 未关闭[Integrations] Language Clients bug feat-scores sdk-python
langfuse/langfuse-python#1967 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 langfuse/langfuse-python 的全部 Issue
相似的 Issue
-
area: agents area: docs good first issue
难度 2/5 1-3 小时 新手友好度 88/100
openapi/gknowledge#23 ·
-
get() for StrEnum可能已有人在做 @FeJo5952 今天认领。 未关闭good first issue
难度 2/5 1-3 小时 新手友好度 72/100
collective/icalendar#1921 · 1 条评论 ·
维护者通常 1 天内回复
-
Improvement Python Spans
难度 2/5 1-3 小时 新手友好度 68/100
getsentry/sentry-python#7994 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
alphagov/notifications-api#5004 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
equinor/radix-flux#3922 ·
维护者通常 1 天内回复