Malformed identity JWT encoding raises instead of expiring the cached token

未关闭 适合新手
#111 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ruby
领域
cloud

调研方向

从 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleapis/ruby-cloud-env 的其他 Issue

查看 googleapis/ruby-cloud-env 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。