Bug 25009: Avoid leakages in opac-showmarc.pl
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 27 Mar 2020 21:16:58 +0000 (18:16 -0300)
committerLucas Gass <lucas@bywatersolutions.com>
Wed, 22 Apr 2020 19:58:52 +0000 (19:58 +0000)
commit021a9bf2162502a6505b1a7c40b7300fe65e1f3d
tree92f23e5f635b5711e2e4b16814deab1bd7ccf937
parentd10e44a9d7672873147c9b29cb9880ee54c1b9b5
Bug 25009: Avoid leakages in opac-showmarc.pl

This patch cleans opac-showmarc.pl so it doesn't allow retrieving
records from import batches without requiring any permissions in the
OPAC.

it does so by just removing the code portion that does that.

It also cleans the record fetch operation and how the record processor
is initialized to it actually works :-D

To test:
1. Perform a successful Z39.50 search in cataloguing (this fetches 20
   records usually)
2. Query your DB for a valid import_record_id:
  $ koha-mysql kohadev
  > SELECT * FROM import_records LIMIT 1;
3. Notice some of the MARCXML details (title, author, etc), and the
   import_record_id
4. Point your browser to the opac-showmarc.pl URL like this:
   http://kohadev.mydnsname.org:8080/cgi-bin/koha/opac-showmarc.pl?importid=20
=> FAIL: You get the record! (Bonus: no field/subfield takes place)
5. Hide some obvious subfield on the framework for a known (to you)
   biblionumber
6. Point your browser to:
   http://kohadev.mydnsname.org:8080/cgi-bin/koha/opac-showmarc.pl?id=<biblionumber_here>
=> FAIL: No filtering takes place
7. Apply this patch
8. Repeat 4
=> SUCCESS: You get an error because you did a bad request (no id param)
9. Repeat 6
=> SUCCESS: Subfield filtering actually works!
10. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit d3ba9dc0fe423347f0e0e90b66be3ebeb7a6dec1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
opac/opac-showmarc.pl