google-auth: Avoid auto-retrying 401s on streaming/non-repeatable payloads in sync HTTP transports
维护者通常 1 天内回复
@agrawalradhika-cell 已经在做这个了。
开始于 2026年9月1日。
评估
这个 Issue 还没有评估数据。
描述
Determine this is the right repository
- I determined this is the correct repository in which to report this bug.
Summary of the issue
Description
In google.auth.transport.requests.AuthorizedSession and google.auth.transport.urllib3.AuthorizedHttp, receiving a 401 Unauthorized triggers an automatic credential refresh / mTLS channel reconfiguration, followed by a recursive request retry (self.request(...) / self.urlopen(...)).
If the request payload (data or body) is a streaming payload (e.g., a file-like object, generator, or iterator), the initial request consumes the stream. The recursive retry then blindly attempts to send the exact same exhausted stream instance. This results in transmitting a 0-byte body (Content-Length: 0) to the server on the retried attempt.
For streaming payloads, the transport should likely not attempt an automatic retry and instead return the 401 response to the caller so they can safely reconstruct the stream and retry on their end. See HLD: go/sdk-mds-bound-token
Note on implementation: If the fix involves short-circuiting the auto-retry for streaming payloads, it is critical that credential refresh and mTLS channel reconfiguration still execute prior to returning the 401. If the logic returns early before running self.credentials.refresh() and self.configure_mtls_channel(), the internal session state remains stale. When the caller reconstructs the stream and issues a manual retry, it will immediately fail again with the exact same expired token or old mTLS certificate.
Affected Files
packages/google-auth/google/auth/transport/requests.py(AuthorizedSession.request)packages/google-auth/google/auth/transport/urllib3.py(AuthorizedHttp.urlopen)
- 主要语言
- Python
- 星标
- 5.4k
- 派生
- 1.8k
- 平均合并
- 2 天 7 小时
- 30 天内合并 PR
- 173
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleapis/google-cloud-python 的其他 Issue
-
firestore: field path with a quoted name ending in a backslash is misparsed可能已有人在做 @sebxt 于 25 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
googleapis/google-cloud-python#18771 ·
维护者通常 1 天内回复
-
api: spanner type: feature request
难度 2/5 1-3 小时 新手友好度 68/100
googleapis/google-cloud-python#18584 ·
维护者通常 1 天内回复
-
auth: `impersonated_credentials` loses `subject` on copy, so `with_scopes()` and `with_quota_project()` turn off domain wide delegation可能已有人在做 @Om-singhaI 于 55 天前认领。 未关闭auth priority: p2 type: bug
难度 2/5 1-3 小时 新手友好度 88/100
googleapis/google-cloud-python#18428 ·
维护者通常 1 天内回复
-
A client called `run_in_transaction` be stuck if Spanner is down可能已有人在做 @founderinaction 于 7 天前认领。 未关闭priority: p2 type: bug
难度 2/5 1-3 小时 新手友好度 72/100
googleapis/google-cloud-python#18375 · 1 条评论 ·
维护者通常 1 天内回复
-
ci: enable --strict flag in presubmit twine_check可能重新可做 @ohmayr 于 44 天前认领,目前没有进行中的 PR。 未关闭
难度 1/5 1 小时以内 新手友好度 76/100
googleapis/google-cloud-python#18339 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 googleapis/google-cloud-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
cpp-best-practices/project_validator#267 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
维护者通常 1 天内回复
-
[Bug] Sending a Telegram message chain twice duplicates mentions可能已有人在做 @123XieC 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
AstrBotDevs/AstrBot#11125 ·
维护者通常 1 天内回复
-
backend bug priority: high
难度 2/5 1-3 小时 新手友好度 72/100
nooriegarg/ContribIQ#73 ·
维护者通常 1 天内回复
-
bug p3 security
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复