You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Panic when a random expiring authentication key duration overflows the clock #3051
Creating a random expiring authentication key with a seconds_valid that overflows the clock returns DurationOverflow through every public path (tracker-core API and both REST endpoints) instead of panicking.
Problem
key::generate_key computes the expiry with CurrentClock::now_add(&lifetime).unwrap(). now_add returns None on overflow, so a huge seconds_valid panics in the request task and the client gets an empty reply. It is reachable with an admin token through POST /api/v1/keys with {"key": null, "seconds_valid": 18446744073709551615} and through the generate-key endpoint POST /api/v1/key/18446744073709551615. The pre-generated-key path already returns PeerKeyError::DurationOverflow and a 400. Impact: availability of an authenticated endpoint, not an open attack surface.
Reproduced on 2026-11-25 against a real tracker built from develop at 11c54fb48: both random-key requests dropped the connection and logged a panic at packages/tracker-core/src/authentication/key/mod.rs:111, while the pre-generated request returned 400. Found while testing tracker-core for #2902 (EPIC #1347).
Decision
Fix at the seam: key::generate_key returns Result<PeerKey, key::DurationOverflow> (new dedicated error type) and KeysHandler::generate_expiring_peer_key returns Result<PeerKey, PeerKeyError>. Both are breaking pub changes, allowed before tracker-core 4.0.0. Both REST paths map to AuthKeyError::DurationOverflow.
The full specification (bug-fix process, regression test strategy, plan, acceptance criteria) will be in docs/issues/open/ of the spec-only PR.
Activity
docs(issues): [torrust#3051] record the persistence range as out of s…
docs(issues): [torrust#3051] add the generate-key handler to the spec…
docs(pr-reviews): [torrust#3051] add the PR 3054 review audit
docs(issues): [torrust#3051] plan the handler test and name the log c…
docs(pr-reviews): [torrust#3051] record review 6060302201 in the PR 3…
docs(pr-reviews): [torrust#3051] cite issue 3051 by number in the PR …
docs(issues): [torrust#3051] show the tracker start command as it ran
docs(pr-reviews): [torrust#3051] record review 6060544492 in the PR 3…
docs(issues): [torrust#2902] keep the S4 log entry to its stamp and a…
docs(issues): add issue specification for #3051
Merge #3054: docs(issues): [#3051] spec for the random expiring key d…
Merge #3056: test(tracker-core): [#2902] pin the authentication and w…
test(tracker-core): [torrust#3051] add failing regression tests for t…
fix(tracker-core): [torrust#3051] return an error when a random key d…
docs(issues): [torrust#3051] record the green run and the real-tracke…
2 remaining items
Merge torrust#3064: fix(tracker-core): [torrust#3051] return an error…
docs(issues): [torrust#3051] make the archived spec agree with its re…
docs(pr-reviews): [torrust#3051] add the PR 3072 review audit
docs(pr-reviews): [torrust#3051] record the replies to review 6075748…
docs(issues): [torrust#3051] leave the acceptance criteria for a revi…
docs(pr-reviews): [torrust#3051] record review 6077711472 in the PR 3…
docs(pr-reviews): [torrust#3051] record the replies to review 6077711…
docs(issues): [torrust#3051] leave the remaining criteria for a revie…
docs(pr-reviews): [torrust#3051] record review 6078748782 in the PR 3…
docs(pr-reviews): [torrust#3051] record the replies to review 6078748…
docs(pr-reviews): [torrust#3051] record review 6079505913 in the PR 3…
docs(pr-reviews): [torrust#3051] record the replies to review 6079505…
chore(issues): archive closed issue #3051 spec to docs/issues/closed
Merge #3072: chore(issues): archive closed issue #3051 spec to docs/i…