Bug 22068 - Canceling an article request should verify the request belongs to the borrower
Summary: Canceling an article request should verify the request belongs to the borrower
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low critical
Assignee: Jonathan Druart
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on: 14610
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-04 05:47 UTC by Ere Maijala
Modified: 2024-08-15 13:16 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.05, 17.11.18
Circulation function:


Attachments
Bug 22068: Prevent patrons to cancel article request they did not create (1.71 KB, patch)
2019-02-14 20:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22068: Prevent patrons to cancel article request they did not create (1.77 KB, patch)
2019-04-05 07:54 UTC, Ere Maijala
Details | Diff | Splinter Review
Bug 22068: Prevent patrons to cancel article request they did not create (1.82 KB, patch)
2019-04-05 18:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22068: (QA follow-up) Return meaningful error codes (1.03 KB, patch)
2019-04-05 18:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ere Maijala 2019-01-04 05:47:17 UTC
It seems that opac-article-request-cancel.pl doesn't check that the article request to be cancelled actually belongs to the logged-in borrower. This results in any logged-in user being able to cancel any article request just by changing the id in the URL.
Comment 1 Jonathan Druart 2019-02-14 20:07:11 UTC
Created attachment 85137 [details] [review]
Bug 22068: Prevent patrons to cancel article request they did not create

opac-article-request-cancel.pl doesn't check that the article request to
be cancelled actually belongs to the logged-in borrower. This results in
any logged-in user being able to cancel any article request just by
changing the id in the URL.

Test plan:
- Login with Patron P1, create an article request
- Cancel it
- Create another one
- Copy the cancellation link (must be /cgi-bin/koha/opac-article-request-cancel.pl?id=X)
- Login with Patron P2
- Hit the cancellation link
=> Without this patch the article request is cancelled
=> With this patch applied there is a 404 redirection

Note that the 404 will also appears when the article request id does not
exist.
Comment 2 Ere Maijala 2019-04-05 07:54:17 UTC
Created attachment 87438 [details] [review]
Bug 22068: Prevent patrons to cancel article request they did not create

opac-article-request-cancel.pl doesn't check that the article request to
be cancelled actually belongs to the logged-in borrower. This results in
any logged-in user being able to cancel any article request just by
changing the id in the URL.

Test plan:
- Login with Patron P1, create an article request
- Cancel it
- Create another one
- Copy the cancellation link (must be /cgi-bin/koha/opac-article-request-cancel.pl?id=X)
- Login with Patron P2
- Hit the cancellation link
=> Without this patch the article request is cancelled
=> With this patch applied there is a 404 redirection

Note that the 404 will also appears when the article request id does not
exist.

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Comment 3 Tomás Cohen Arazi (tcohen) 2019-04-05 18:21:12 UTC
Created attachment 87460 [details] [review]
Bug 22068: Prevent patrons to cancel article request they did not create

opac-article-request-cancel.pl doesn't check that the article request to
be cancelled actually belongs to the logged-in borrower. This results in
any logged-in user being able to cancel any article request just by
changing the id in the URL.

Test plan:
- Login with Patron P1, create an article request
- Cancel it
- Create another one
- Copy the cancellation link (must be /cgi-bin/koha/opac-article-request-cancel.pl?id=X)
- Login with Patron P2
- Hit the cancellation link
=> Without this patch the article request is cancelled
=> With this patch applied there is a 404 redirection

Note that the 404 will also appears when the article request id does not
exist.

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi (tcohen) 2019-04-05 18:21:15 UTC
Created attachment 87461 [details] [review]
Bug 22068: (QA follow-up) Return meaningful error codes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Nick Clemens (kidclamp) 2019-04-10 20:12:54 UTC
Awesome work all!

Pushed to master for 19.05
Comment 6 Martin Renvoize (ashimema) 2019-04-15 10:58:16 UTC
Pushed to 18.11.x for 18.11.05
Comment 7 Lucas Gass (lukeg) 2019-04-15 18:10:56 UTC
backported to 18.05.x for 18.05.12
Comment 8 Fridolin Somers 2019-04-30 08:08:43 UTC
Pushed to 17.11.x for 17.11.18