Malformed identity JWT encoding raises instead of expiring the cached token
还没有人认领这个 Issue。
评估
调研方向
从 ComputeMetadata#determine_identity_lifetime 开始,重现 issue 中描述的无效 URL-safe Base64 情况。检查现有的 malformed JSON 处理,并验证 malformed JWT payload 会产生零 lifetime,同时不改变 valid-token lifetime 路径。确认相关测试套件仍然通过。
由索引模型根据 Issue 内容生成。
描述
Summary
ComputeMetadata#determine_identity_lifetime rescues malformed JSON, but not malformed URL-safe Base64 in the JWT payload. A metadata response containing an invalid encoded payload therefore raises ArgumentError while deciding its cache lifetime instead of treating the token as immediately expired.
Reproduction
On current main (7936c72eb2c809214858f47473aafb04c6bbf469), calling the private lifetime calculation with an identity path and a token whose middle segment is invalid URL-safe Base64 raises ArgumentError from Base64.urlsafe_decode64.
Proposed correction
Handle ArgumentError alongside the existing malformed-JSON behavior and return a zero lifetime. I verified the two-line rescue against malformed padding/characters, the full current suite (91 runs / 419 assertions / 0 failures / 0 errors / 2 skips), and the normal valid-token lifetime path.
I used an AI coding assistant during investigation and verification. I am opening this issue first because this repository requires tests and a Google CLA for pull requests; I have not modified repository tests or signed a CLA as part of this audit.
- 主要语言
- Ruby
- 星标
- 16
- 派生
- 12
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleapis/ruby-cloud-env 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
googleapis/ruby-cloud-env#112 ·
-
难度 3/5 1-2 天 新手友好度 72/100
googleapis/ruby-cloud-env#110 · 1 条评论 ·
-
priority: p3 type: feature request
难度 5/5 一周以上 新手友好度 35/100
googleapis/ruby-cloud-env#90 ·
-
type: process
难度 4/5 3-5 天 新手友好度 20/100
googleapis/ruby-cloud-env#22 ·
查看 googleapis/ruby-cloud-env 的全部 Issue
相似的 Issue
-
user-reported
难度 2/5 1-3 小时 新手友好度 85/100
Kong/developer.konghq.com#7316 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
TheOdinProject/curriculum#31408 ·
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
notch8/utk_knapsack#148 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
Homebrew/homebrew-cask#288729 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100