Key duration above i64::MAX seconds returns 500 instead of a duration error
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
调研方向
Read the key creation and duration validation flow for POST /api/v1/keys and the generate-key endpoint, then trace add_key_to_keys in the SQLite, PostgreSQL, and MySQL stores. Compare the clock validation with each store’s expiry conversion and review the #3051 spec PR context. Done means the chosen limit or error mapping returns a duration error for the reported overflow cases, including pre-generated keys.
由索引模型根据 Issue 内容生成。
描述
Problem
An admin who sends a seconds_valid that makes the key's expiry (now plus the duration) exceed i64::MAX seconds while still fitting the clock (for example 9223372036854775808, 2^63; durations just below i64::MAX fail the same way, because the stores convert the expiry, not the duration) to POST /api/v1/keys or the generate-key endpoint gets 500 failed to add key instead of the 400 "invalid auth key duration" returned for values that overflow the clock. The clock check passes, then add_key_to_keys in the SQLite, PostgreSQL and MySQL stores converts the expiry with i64::try_from(value.as_secs()) and fails with Error::MalformedDatabaseRecord, which becomes PeerKeyError::DatabaseError and then AuthKeyError::Database. The pre-generated-key branch behaves the same way.
No panic is involved. This is a different root cause from #3051 (a persistence range limit, not the clock): the maximum expiry a key can have is decided by the database column type, but the request is validated only against the clock.
Open design question
Where the limit lives: bound the duration check by the largest expiry the stores accept (a shared constant), or map MalformedDatabaseRecord on insert to a duration error. To be decided in the spec.
Found by the automated review of the #3051 spec PR (torrust/torrust-tracker#3054).
- 主要语言
- Rust
- 星标
- 532
- 派生
- 56
- 平均合并
- 11 小时 20 分钟
- 30 天内合并 PR
- 282
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
torrust/torrust-tracker 的其他 Issue
-
Bug
难度 2/5 1-3 小时 新手友好度 78/100
torrust/torrust-tracker#3080 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
torrust/torrust-tracker#3069 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
torrust/torrust-tracker#3058 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
torrust/torrust-tracker#2978 ·
维护者通常 1 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 73/100
torrust/torrust-tracker#2332 ·
维护者通常 1 天内回复
查看 torrust/torrust-tracker 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
marketing
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
difficulty: easy docs help wanted tooling
难度 2/5 1-3 小时 新手友好度 83/100
-
bug help wanted ui
难度 2/5 1-3 小时 新手友好度 85/100
userFRM/egui-charts#4386 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
eliasstravik/herdr-projects#1605 · 1 条评论 ·