[Bug 44329] New: A failed SUSHI harvest writes the provider's api_key to the log and to the error message
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44329 Bug ID: 44329 Summary: A failed SUSHI harvest writes the provider's api_key to the log and to the error message Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: ERM Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: jonathan.druart@gmail.com, jonathan.field@openfifth.co.uk, martin.renvoize@openfifth.co.uk, matt.blenkinsop@openfifth.co.uk, pedro.amorim@openfifth.co.uk Target Milestone: --- When a SUSHI service answers a harvest with an HTTP error, Koha::ERM::EUsage::UsageDataProvider->harvest_sushi warns and dies with the full request URL: warn sprintf "ERROR - SUSHI service %s returned %s - %s\n", $url, ... die sprintf "ERROR requesting SUSHI service\n%s\ncode %s: %s\n", $url, ... The URL is built by _build_url_query with &api_key=<the provider's key>, so the key ends up in plack-error.log (or the worker's log) and in the background job's error, for every failed harvest. To reproduce (main), see the new subtest in t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t: a provider with api_key SECRET-KEY-123 and a SUSHI service answering 500 → the warning and the error both contain SECRET-KEY-123. Expected: the key is masked in what is logged or shown (api_key=*****); the request itself is unchanged (COUNTER SUSHI passes api_key as a query parameter). Reproduced on main (af3f590). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44329 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212772 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212772&action=edit Bug 44329: Do not log the SUSHI api_key when a harvest fails Bug 44329: Do not log the SUSHI api_key when a harvest fails When a SUSHI service answers with an HTTP error, harvest_sushi() warns and dies with the full request URL. That URL carries &api_key=<key>, so the provider's key ended up in the log and in the background job's error for every failed harvest. The URL is now logged and shown with the api_key value masked (api_key=*****). The request itself is unchanged. The patch also corrects two POD headings that did not match their sub's name (_sushi_code_is_error, _handle_sushi_request), which the QA tools report for a touched file. Test plan: 1. Apply only the test file change and run prove t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t The new subtest "harvest_sushi() does not log the api_key" fails: the warning and the error contain SECRET-KEY-123. 2. Apply the whole patch and run it again: it passes. Sponsored-by: Koha Solutions -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44329 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |babarjunaid1122@gmail.com |ity.org | Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org