[BUGFIX] OAI-PMH GetRecord always answered idDoesNotExist - #2148
Conversation
The OAI-PMH GetRecord verb failed for every valid identifier with the error "idDoesNotExist" because the record lookup query no longer selected the document's uid. The controller checks empty($document['uid']) to detect a missing record, so a found record without a uid column was treated as not existing. Restore the uid to the SELECT list of getOaiRecord() and getOaiDocumentList(). Add functional tests for the GetRecord verb, including the success case and the unknown-identifier and unknown-metadataPrefix error cases, which previously had no coverage. Assisted-by: OpenCode / qwen3.8-27b-thinking (Alibaba Cloud) Fixes: 05c90ac ("[MAINTENANCE] Refactor OAI-PMH queries to...") Signed-off-by: Stefan Weil <sw@weilnetz.de>
|
@sebastian-meyer, yesterday we updated our installation on digi.bib.uni-mannheim.de and noticed the OAI-PMH regression (fixed now with this code). This regression had an interesting side effect: it caused outages of our web server for several hours during last night, so users could no longer view our digitisations. The SLUB DFG viewer tried to access OAI records on our server. Because of the regression, this failed. Then the SLUB server retried the failed access many times (which amplified the load) before giving up. Normally our protection would have blocked external IP addresses which send several requests per second over a longer time, but I had put your server on the exception list. Even with the bug fix, I see a remaining problem. Anyone can misuse DFG viewer (or maybe any installation of Kitodo.Presentation) for denial of service attacks against any institution which provides OAI/PMH by calling it with a valid OAI URL, but using an invalid record identifier. Here is a typical example from the Apache access log (in this case triggered by me with a single request to the DFG viewer): Update: see PR #2149 which fixes this now on our server. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2148 +/- ##
============================
============================
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The OAI-PMH GetRecord verb failed for every valid identifier with the error "idDoesNotExist" because the record lookup query no longer selected the document's uid. The controller checks empty($document['uid']) to detect a missing record, so a found record without a uid column was treated as not existing.
Restore the uid to the SELECT list of getOaiRecord() and getOaiDocumentList(). Add functional tests for the GetRecord verb, including the success case and the unknown-identifier and unknown-metadataPrefix error cases, which previously had no coverage.
Assisted-by: OpenCode / qwen3.8-27b-thinking (Alibaba Cloud)
Fixes: 05c90ac ("[MAINTENANCE] Refactor OAI-PMH queries to...")