Key duration above i64::MAX seconds returns 500 instead of a duration error
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- Rust
- Estrellas
- 532
- Forks
- 56
- Merge medio
- 11 h 20 min
- PR fusionados (30 d)
- 282
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de torrust/torrust-tracker
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
torrust/torrust-tracker#3080 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
torrust/torrust-tracker#3069 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
torrust/torrust-tracker#3058 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
torrust/torrust-tracker#2978 ·
Los mantenedores suelen responder en 1 día
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
torrust/torrust-tracker#2332 ·
Los mantenedores suelen responder en 1 día
Todos los issues de torrust/torrust-tracker
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
marketing
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Start here: how to contributeAbiertodifficulty: easy docs help wanted tooling
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
-
bug help wanted ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
userFRM/egui-charts#4386 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
eliasstravik/herdr-projects#1605 · 1 comentario ·