https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43077 --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- QA review as part of the Bug 42383 dependency chain, applied on current main with 24401 and 42425. Review was done with Claude assistance; items I reproduced are marked, the rest are from reading the code and tests. t/Koha/Token.t and the existing token callers (Checkin, Availability, Checkouts REST, SCO, printslip) pass. I also exercised Mojo::JWT through decode_claims in KTD: expiry is enforced with no leeway (a token that expired 5 seconds ago is rejected), and a tampered payload, alg:none (with and without a signature) and a wrong key are all rejected. That is the behaviour we want. Follow-ups: 1. (reproduced) decode_claims(undef) emits a Perl warning ("Use of uninitialized value $token in split" from Mojo::JWT) before returning undef. A caller that passes a missing cookie to decode_jwt would hit it, and it can trip Test::NoWarnings. Please return early on an undefined or empty token. 2. t/Koha/Token.t only has round trips. Please add negative cases: tampered payload, wrong key, alg:none, garbage input, an expired token and a missing id. 3. encode_claims and decode_claims sign any claims with the single DB-derived key and have no purpose or audience (typ/aud) binding. A validly signed token from one flow (SCO cookie, checkin action tokens, availability tokens) is therefore accepted by decode_jwt in another if the id matches. Please add a typ or aud claim, or document that the id namespace is global. 4. Behaviour changes in the refactor worth documenting in the POD: a caller-supplied secret is now ignored; decode_jwt returns undef and logs a warning instead of dying on a bad token; generate({ type => 'JWT' }) with no id now mints {"id":null}; and encode_claims does not check that the claims are a hashref. 5. Nits: check_jwt and the older check path duplicate the same validation, and _add_default_jwt_params is now only a secret fetcher with a stale POD. Leaving the status at Signed Off; I would move it to Passed QA once 1 and 2 are done. -- You are receiving this mail because: You are watching all bug changes.