https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24401

--- Comment #78 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209544
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209544&action=edit
Bug 24401: (QA follow-up) Add expiry to confirmation tokens, log check_token
failures

Confirmation tokens minted by Koha::Result::Availability->as_token had
no expiry - once generated for a given item/user/confirmation set,
they remained valid indefinitely. These tokens are meant to be
round-tripped within a single staff interaction (scan, see the
confirmation prompt, confirm), not stored or reused later, so give
them a short (5 minute) lifetime via Mojo::JWT's standard "exp" claim.

Koha::Token::generate_jwt/check_jwt never exposed Mojo::JWT's native
expires support, so add that through. While there, harden
Koha::Token::_chk_jwt to catch decode failures (expired, tampered, or
malformed tokens) instead of letting Mojo::JWT's exception propagate
uncaught to callers - Koha::REST::V1::Checkouts's existing JWT
confirmation flow calls check_jwt without an eval/try around it, so
this closes a latent crash risk there too, not just for checkins.

Both failures are logged via Koha::Logger (not warn, to avoid tripping
Test::NoWarnings in unrelated test suites) so a "confirmation keeps
failing" report leaves a diagnostic trail instead of just returning 0.

Test plan:
1. prove t/Koha/Result/Availability.t t/db_dependent/api/v1/checkins.t
   t/db_dependent/api/v1/checkouts.t
=> SUCCESS: all pass.

Signed-off-by: Martin Renvoize <[email protected]>
Signed-off-by: Brendan Lawlor <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to