https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24401 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA --- Comment #82 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- QA review as part of the Bug 42383 dependency chain, applied on current main on top of 42425 (Failed QA, see there). Review was done with Claude assistance; items I reproduced are marked, the rest are from reading the code and tests. I don't think Passed QA holds for this one: it sits on a Failed QA bug, and there is a data-integrity problem in the new endpoint. 1. (reproduced) An item without a barcode can be checked in as a different item. Koha::REST::V1::Checkins::add resolves the item from item_id but then calls AddReturn($item->barcode, ...). items.barcode is nullable, so with undef Koha::Items->find({ barcode => undef }) matches several rows (DBIC "more than one row" deprecation warning) and returns one arbitrarily. In KTD, with two barcode-less items and the loan on the higher itemnumber, the call returned NotIssued for the other item and the item actually on loan stayed checked out. Legacy circulation can only reach AddReturn through a scanned barcode, so this path is new. Please reject items without a barcode, or pass the item through, before AddReturn. Items 2 to 8 are from reading the code and tests: 2. library_id is taken from the request body without validation (POST: $body->{library_id} // $user->branchcode; GET: $c->param('library_id') // the userenv branch). An unknown branchcode makes AddReturn warn (which breaks Test::NoWarnings); a staff member limited to one library can check in at another; and POST defaults to the home library where GET and AddReturn use the session branch (x-koha-library). Legacy always used the session branch. 3. A check-in of an item that is not checked out returns 200 with a checkin_id and no signal that nothing was returned; $doreturn is discarded and the FIXME that documented it was removed without fixing it. 4. The 412 confirmation is a convenience gate, not an authorisation control: any caller with circulate_remaining_permissions can mint a token through GET /checkins/availability. Fine, but please say so in the spec. The tokens carry no purpose or audience claim and share the key and id shape with the Checkouts confirmation tokens, which never expire. 5. An unparseable return_date gives a 500 (42383 later rejects it). 6. to_library is never passed to the availability check, so transfer-limit and wrong_branch blockers are not surfaced; please compare with legacy. 7. The debits and credits embeds depend on 42425, and no test in checkins.t embeds them, so these tests pass whatever state 42425 is in. 8. Missing tests: a token for another user or signed with another secret, a tampered payload, an expired token at endpoint level, return_date and dropbox_mode, the messages array, a barcode-less item, and a bogus library_id. Moving this from Passed QA to Failed QA (it depends on 42425 and needs 1 and 2 fixed). -- You are receiving this mail because: You are watching all bug changes.