[Bug 43805] New: Logging back in after a session timeout 404s on Vue pages served through a RewriteRule (record_sources, circulation_triggers)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Bug ID: 43805 Summary: Logging back in after a session timeout 404s on Vue pages served through a RewriteRule (record_sources, circulation_triggers) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Staff interface pages that are served through a RewriteRule of the form RewriteRule ^/cgi-bin/koha/admin/record_sources(.*)?$ /cgi-bin/koha/admin/record_sources.pl$1 [PT] (etc/koha-httpd.conf and debian/templates/apache-shared-intranet.conf; the same shape is used for admin/circulation_triggers) cannot be logged back in to after the session times out. The pattern also matches the script's own name, so a request for record_sources.pl is rewritten to record_sources.pl.pl and returns 404. When the login form is shown on such a page, its action is the script name (/cgi-bin/koha/admin/record_sources.pl). Submitting it therefore 404s, no session is created, and the user is stuck on an error page until they log in through another page (for example mainpage.pl) and navigate back. To reproduce (main, 26.06.00.035, in KTD): 1. Log out (or let the session expire). 2. Open /cgi-bin/koha/admin/record_sources. The login page is shown; its form action is /cgi-bin/koha/admin/record_sources.pl. 3. Enter valid credentials and submit. Expected: you are logged in and see the record sources page. Actual: "Error 404 > Koha". No session is created. Evidence with curl (cookie jar, valid csrf_token taken from the login page): - POST to the form action /cgi-bin/koha/admin/record_sources.pl -> 404 - POST of the same fields to /cgi-bin/koha/admin/record_sources -> 200 GET /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl also return 404. Not affected: acquisition/vendors, whose rule maps acquisition/vendors to acqui/vendors.pl, so acqui/vendors.pl is reachable (200). Found while building a new Vue page under Cataloguing (bug 30800), which copies the same rule and so has the same problem. Possible directions (not verified): - Guard the rules so the script's own name is not rewritten, as is already done for preservation in the same file: RewriteCond %{REQUEST_URI} !^/cgi-bin/koha/preservation/.*.pl$ A similar RewriteCond for each of these pages would let the .pl URL reach the script. The Vue router base paths are the extensionless URLs, so it needs checking what the app does when it is loaded on the .pl URL after login. - Or have the login form post back to the URL the user actually requested instead of the script name when the request was rewritten. -- 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=43805 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207975 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207975&action=edit Bug 43805: Don't rewrite requests for the .pl script of Vue pages The rewrite rules for admin/record_sources and admin/circulation_triggers match any URL starting with the page name, so they also match the real script, /cgi-bin/koha/admin/record_sources.pl, and turn it into record_sources.pl.pl, which does not exist. This is normally invisible because the Vue pages are reached without the extension. It breaks when a session times out: the login form posts back to the .pl URL, and the user gets a 404 instead of landing on the page they were on. Skip the rewrite when the request is already for the .pl script, as is already done for the preservation and ill rules. Test plan: 1. Without the patch, as a logged in staff user, visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl => 404 for both. 2. Apply the patch and restart Apache (restart_all in KTD, or reload the apache config after regenerating it on a package install). 3. Visit the same two URLs again => The pages load. 4. Visit /cgi-bin/koha/admin/record_sources, /cgi-bin/koha/admin/record_sources/add and /cgi-bin/koha/admin/circulation_triggers => They still load, and the Vue router still works within them. 5. Open /cgi-bin/koha/admin/record_sources, then in another tab log out. Back in the first tab, reload the page, log in again => You land on the record sources page, not a 404. 6. Repeat step 5 for /cgi-bin/koha/admin/circulation_triggers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- 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=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- 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=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matt.blenkinsop@openfifth.c | |o.uk, tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #2 from David Nind <david@davidnind.com> --- Is anything else required after applying the patch for the redirects to work correctly? While I no longer get 404s, I get: 1. /cgi-bin/koha/admin/record_sources.pl - page with the standard staff interface header and sidebar (no breadcrumb or body content) 2. /cgi-bin/koha/admin/circulation_triggers.pl - page with the standard staff interface header (no sidebar, breadcrumb, or body content) I also tried: 1. A yarn build and a restart_all 2. A reset_all 3. Shutting down KTD and then restarting with the patch applied 4. Same as 3, then a yarn build and restart_all 5. In call cases browser cache cleared after patch applied. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210193 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210193&action=edit Bug 43805: (follow-up) Log back in on the page the user was on The login form posts to the script of the page, and dropped the path info. For the Vue pages served through a rewrite rule that is the route of the page: a user whose session timed out on /cgi-bin/koha/admin/record_sources/edit/3 got to /cgi-bin/koha/admin/record_sources.pl after logging in, with the page left empty because the router only knows the URLs without the extension. * Koha::AuthUtils::get_script_name, which gives the action of the login form, now keeps the path info, so the form posts to .../record_sources.pl/edit/3 * The rewrite rules leave the script alone when it is requested with a path info too, not only on its own * The Vue pages take the extension out of the address before the router reads it, keeping the route, the query string and the hash, so that the user lands on the same page as before the timeout, on the same URL To test: 1. Apply the patches, restart_all and rebuild the JavaScript (yarn js:build). In KTD the Apache configuration is generated when it starts, so it has to be regenerated for the rewrite rules 2. Log in, then visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/record_sources.pl/add => The pages load, at the URL without the .pl 3. Open /cgi-bin/koha/admin/record_sources/add, log out in another tab, reload the page and log in => You land on the form to add a record source, not a 404 or an empty page. Same for /cgi-bin/koha/admin/circulation_triggers/add 4. prove t/db_dependent/AuthUtils.t 5. Run the Cypress spec t/cypress/integration/Admin/VuePagesLogin_spec.ts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks David, good catch. No, nothing else was missing from your side: the first patch only stopped Apache turning record_sources.pl into record_sources.pl.pl, so the script was served, but the Vue router only knows the URLs without the .pl and rendered nothing. My test plan was wrong to say the pages would load. I have attached a follow-up that fixes the actual problem rather than papering over it. Logging back in after a session timeout now returns to the page the user was on: - the login form keeps the path info (the Vue route) of the script it posts to, e.g. record_sources.pl/edit/3, via Koha::AuthUtils::get_script_name; - the rewrite rules also leave the script alone when it is requested with a path info; - the Vue pages take the .pl out of the address before the router reads it, keeping the route, query string and hash. To test, after applying both patches: restart_all and yarn js:build. In KTD the Apache configuration is generated when KTD starts from debian/templates, so it needs regenerating for the rewrite rules (a fresh kd up / ktd up with the patches applied does it). Then: 1. Logged in, visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/record_sources.pl/add => the pages load, at the URL without .pl (same for circulation_triggers). 2. Open /cgi-bin/koha/admin/record_sources/add, log out in another tab, reload and log in => you land on the add form, not a 404 or an empty page (same for circulation_triggers/add). There is a Cypress spec (t/cypress/integration/Admin/VuePagesLogin_spec.ts) and a get_script_name test in t/db_dependent/AuthUtils.t; koha-qa is clean. Would you be able to test again? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207975|0 |1 is obsolete| | Attachment #210193|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 210551 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210551&action=edit Bug 43805: Don't rewrite requests for the .pl script of Vue pages The rewrite rules for admin/record_sources and admin/circulation_triggers match any URL starting with the page name, so they also match the real script, /cgi-bin/koha/admin/record_sources.pl, and turn it into record_sources.pl.pl, which does not exist. This is normally invisible because the Vue pages are reached without the extension. It breaks when a session times out: the login form posts back to the .pl URL, and the user gets a 404 instead of landing on the page they were on. Skip the rewrite when the request is already for the .pl script, as is already done for the preservation and ill rules. Test plan: 1. Without the patch, as a logged in staff user, visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl => 404 for both. 2. Apply the patch and restart Apache (restart_all in KTD, or reload the apache config after regenerating it on a package install). 3. Visit the same two URLs again => The pages load. 4. Visit /cgi-bin/koha/admin/record_sources, /cgi-bin/koha/admin/record_sources/add and /cgi-bin/koha/admin/circulation_triggers => They still load, and the Vue router still works within them. 5. Open /cgi-bin/koha/admin/record_sources, then in another tab log out. Back in the first tab, reload the page, log in again => You land on the record sources page, not a 404. 6. Repeat step 5 for /cgi-bin/koha/admin/circulation_triggers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 210552 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210552&action=edit Bug 43805: (follow-up) Log back in on the page the user was on The login form posts to the script of the page, and dropped the path info. For the Vue pages served through a rewrite rule that is the route of the page: a user whose session timed out on /cgi-bin/koha/admin/record_sources/edit/3 got to /cgi-bin/koha/admin/record_sources.pl after logging in, with the page left empty because the router only knows the URLs without the extension. * Koha::AuthUtils::get_script_name, which gives the action of the login form, now keeps the path info, so the form posts to .../record_sources.pl/edit/3 * The rewrite rules leave the script alone when it is requested with a path info too, not only on its own * The Vue pages take the extension out of the address before the router reads it, keeping the route, the query string and the hash, so that the user lands on the same page as before the timeout, on the same URL To test: 1. Apply the patches, restart_all and rebuild the JavaScript (yarn js:build). In KTD the Apache configuration is generated when it starts, so it has to be regenerated for the rewrite rules 2. Log in, then visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/record_sources.pl/add => The pages load, at the URL without the .pl 3. Open /cgi-bin/koha/admin/record_sources/add, log out in another tab, reload the page and log in => You land on the form to add a record source, not a 404 or an empty page. Same for /cgi-bin/koha/admin/circulation_triggers/add 4. prove t/db_dependent/AuthUtils.t 5. Run the Cypress spec t/cypress/integration/Admin/VuePagesLogin_spec.ts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #7 from David Nind <david@davidnind.com> --- (In reply to Martin Renvoize (ashimema) from comment #4)
Would you be able to test again?
Thanks Martin! Now signed off. David -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |andrew@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #8 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- With this code, a logout while viewing /cgi-bin/koha/acquisition/vendors/1 logs the user back in to a blank page, rather than the vendor page. These patches should also update the new Item Lists module, which gets the same 404 error. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210551|0 |1 is obsolete| | Attachment #210552|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211094 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211094&action=edit Bug 43805: Don't rewrite requests for the .pl script of Vue pages The rewrite rules for admin/record_sources and admin/circulation_triggers match any URL starting with the page name, so they also match the real script, /cgi-bin/koha/admin/record_sources.pl, and turn it into record_sources.pl.pl, which does not exist. This is normally invisible because the Vue pages are reached without the extension. It breaks when a session times out: the login form posts back to the .pl URL, and the user gets a 404 instead of landing on the page they were on. Skip the rewrite when the request is already for the .pl script, as is already done for the preservation and ill rules. Test plan: 1. Without the patch, as a logged in staff user, visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl => 404 for both. 2. Apply the patch and restart Apache (restart_all in KTD, or reload the apache config after regenerating it on a package install). 3. Visit the same two URLs again => The pages load. 4. Visit /cgi-bin/koha/admin/record_sources, /cgi-bin/koha/admin/record_sources/add and /cgi-bin/koha/admin/circulation_triggers => They still load, and the Vue router still works within them. 5. Open /cgi-bin/koha/admin/record_sources, then in another tab log out. Back in the first tab, reload the page, log in again => You land on the record sources page, not a 404. 6. Repeat step 5 for /cgi-bin/koha/admin/circulation_triggers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211095 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211095&action=edit Bug 43805: (follow-up) Log back in on the page the user was on The login form posts to the script of the page, and dropped the path info. For the Vue pages served through a rewrite rule that is the route of the page: a user whose session timed out on /cgi-bin/koha/admin/record_sources/edit/3 got to /cgi-bin/koha/admin/record_sources.pl after logging in, with the page left empty because the router only knows the URLs without the extension. * Koha::AuthUtils::get_script_name, which gives the action of the login form, now keeps the path info, so the form posts to .../record_sources.pl/edit/3 * The rewrite rules leave the script alone when it is requested with a path info too, not only on its own * The Vue pages take the extension out of the address before the router reads it, keeping the route, the query string and the hash, so that the user lands on the same page as before the timeout, on the same URL To test: 1. Apply the patches, restart_all and rebuild the JavaScript (yarn js:build). In KTD the Apache configuration is generated when it starts, so it has to be regenerated for the rewrite rules 2. Log in, then visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/record_sources.pl/add => The pages load, at the URL without the .pl 3. Open /cgi-bin/koha/admin/record_sources/add, log out in another tab, reload the page and log in => You land on the form to add a record source, not a 404 or an empty page. Same for /cgi-bin/koha/admin/circulation_triggers/add 4. prove t/db_dependent/AuthUtils.t 5. Run the Cypress spec t/cypress/integration/Admin/VuePagesLogin_spec.ts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211096 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211096&action=edit Bug 43805: (QA follow-up) Cover the vendors and the item lists Logging back in after a session timeout took the user to a blank page on the vendors, and to a 404 error on the item lists. * The vendors page, /cgi-bin/koha/acquisition/vendors, is served by acqui/vendors.pl, not by a script that has its path. After logging in, the user is on /cgi-bin/koha/acqui/vendors.pl/1, which the router does not know, so nothing was shown. removeScriptExtension, that only took the extension of the script out, can now be given the path of the script and the one of the page, and the vendors give theirs. * The item lists, /cgi-bin/koha/lists/items, are served through the same kind of rewrite rule as the record sources, and had the same 404 error: the rule rewrote the request for the script itself into items.pl.pl. The rule now leaves it alone, as the ones of the record sources and of the circulation triggers do (in etc/koha-httpd.conf and the Debian template), and the item lists take the extension out of the address like the other pages. The tests of the login now also cover the vendors and the item lists. To test: 1. Apply the patches 2. Start a new KTD (kd up / ktd up), as the rewrite rules are generated when it starts, then yarn js:build and restart_all 3. Open /cgi-bin/koha/acquisition/vendors/add, log out in another tab, reload and log in => You land on the add vendor form, at the URL without acqui and .pl 4. Open /cgi-bin/koha/lists/items/add, log out in another tab, reload and log in => You land on the add item list form 5. Open /cgi-bin/koha/lists/items.pl and /cgi-bin/koha/acqui/vendors.pl => The pages load, at /cgi-bin/koha/lists/items and /cgi-bin/koha/acquisition/vendors 6. Run $ ktd --shell k$ yarn cypress run --spec t/cypress/integration/Admin/VuePagesLogin_spec.ts => SUCCESS: Tests pass! 7. Without the patch, the tests of the vendors and of the item lists fail 8. Sign off :-D Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks Andrew, both are fixed in the new (QA follow-up) patch, on top of David's two signed patches, which are unchanged. The vendors: they are not served by a script that has the path of their page. The page is /cgi-bin/koha/acquisition/vendors, served by acqui/vendors.pl, so after logging in the user was on /cgi-bin/koha/acqui/vendors.pl/1, which the Vue router does not know, hence the blank page. Taking the extension out of the address, as was done for the record sources and the circulation triggers, is not enough for them. removeScriptExtension can now be given the path of the script and the one of the page, and the vendors give theirs, so the address goes back to /cgi-bin/koha/acquisition/vendors/1. The rewrite rule of the vendors needs no change, as the path of its script is not the one of the page. The item lists: they are served through the same kind of rewrite rule as the record sources, and had the same 404 error, as the rule rewrote the request for lists/items.pl into lists/items.pl.pl. The rule now leaves the script alone, like the ones of the record sources and of the circulation triggers (in etc/koha-httpd.conf and in the Debian template), and the item lists take the extension out of the address like the other pages. Cypress/VuePagesLogin_spec.ts now also covers the vendors and the item lists. Without the new patch their tests fail, with the 404 error for the item lists and a page that is not shown for the vendors. With it all 12 tests pass. Note that for the vendors the test uses /add, not /vendors/1: it goes through the same code, but it does not need a vendor to exist. As before, the rewrite rules are generated when KTD starts, so it needs a new KTD (kd up / ktd up), then yarn js:build and restart_all. I also ran the other Cypress tests of these pages: Acquisitions/Vendors_spec.ts, Breadcrumbs_spec.ts, Toolbar_spec.ts and VueFramework_spec.ts pass. In ItemLists_spec.ts, "Item List shares CRUD operations should add a share" fails, but not because of this bug: it fails the same way on main (commit eda13b6610d) with the changes of this bug to Koha::AuthUtils and to the item lists page taken out. Cypress says the search field of the patron selector is covered by the library badge (<span class="badge ac-library">A Library</span>). That looks related to the new PatronSelect component of bug 43518, but I did not check that. It needs its own look. koha-qa is clean. Setting back for testing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211094|0 |1 is obsolete| | Attachment #211095|0 |1 is obsolete| | Attachment #211096|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #13 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211114 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211114&action=edit Bug 43805: Don't rewrite requests for the .pl script of Vue pages The rewrite rules for admin/record_sources and admin/circulation_triggers match any URL starting with the page name, so they also match the real script, /cgi-bin/koha/admin/record_sources.pl, and turn it into record_sources.pl.pl, which does not exist. This is normally invisible because the Vue pages are reached without the extension. It breaks when a session times out: the login form posts back to the .pl URL, and the user gets a 404 instead of landing on the page they were on. Skip the rewrite when the request is already for the .pl script, as is already done for the preservation and ill rules. Test plan: 1. Without the patch, as a logged in staff user, visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl => 404 for both. 2. Apply the patch and restart Apache (restart_all in KTD, or reload the apache config after regenerating it on a package install). 3. Visit the same two URLs again => The pages load. 4. Visit /cgi-bin/koha/admin/record_sources, /cgi-bin/koha/admin/record_sources/add and /cgi-bin/koha/admin/circulation_triggers => They still load, and the Vue router still works within them. 5. Open /cgi-bin/koha/admin/record_sources, then in another tab log out. Back in the first tab, reload the page, log in again => You land on the record sources page, not a 404. 6. Repeat step 5 for /cgi-bin/koha/admin/circulation_triggers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #14 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211115 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211115&action=edit Bug 43805: (follow-up) Log back in on the page the user was on The login form posts to the script of the page, and dropped the path info. For the Vue pages served through a rewrite rule that is the route of the page: a user whose session timed out on /cgi-bin/koha/admin/record_sources/edit/3 got to /cgi-bin/koha/admin/record_sources.pl after logging in, with the page left empty because the router only knows the URLs without the extension. * Koha::AuthUtils::get_script_name, which gives the action of the login form, now keeps the path info, so the form posts to .../record_sources.pl/edit/3 * The rewrite rules leave the script alone when it is requested with a path info too, not only on its own * The Vue pages take the extension out of the address before the router reads it, keeping the route, the query string and the hash, so that the user lands on the same page as before the timeout, on the same URL To test: 1. Apply the patches, restart_all and rebuild the JavaScript (yarn js:build). In KTD the Apache configuration is generated when it starts, so it has to be regenerated for the rewrite rules 2. Log in, then visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/record_sources.pl/add => The pages load, at the URL without the .pl 3. Open /cgi-bin/koha/admin/record_sources/add, log out in another tab, reload the page and log in => You land on the form to add a record source, not a 404 or an empty page. Same for /cgi-bin/koha/admin/circulation_triggers/add 4. prove t/db_dependent/AuthUtils.t 5. Run the Cypress spec t/cypress/integration/Admin/VuePagesLogin_spec.ts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #15 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211116 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211116&action=edit Bug 43805: (QA follow-up) Cover the vendors and the item lists Logging back in after a session timeout took the user to a blank page on the vendors, and to a 404 error on the item lists. * The vendors page, /cgi-bin/koha/acquisition/vendors, is served by acqui/vendors.pl, not by a script that has its path. After logging in, the user is on /cgi-bin/koha/acqui/vendors.pl/1, which the router does not know, so nothing was shown. removeScriptExtension, that only took the extension of the script out, can now be given the path of the script and the one of the page, and the vendors give theirs. * The item lists, /cgi-bin/koha/lists/items, are served through the same kind of rewrite rule as the record sources, and had the same 404 error: the rule rewrote the request for the script itself into items.pl.pl. The rule now leaves it alone, as the ones of the record sources and of the circulation triggers do (in etc/koha-httpd.conf and the Debian template), and the item lists take the extension out of the address like the other pages. The tests of the login now also cover the vendors and the item lists. To test: 1. Apply the patches 2. Start a new KTD (kd up / ktd up), as the rewrite rules are generated when it starts, then yarn js:build and restart_all 3. Open /cgi-bin/koha/acquisition/vendors/add, log out in another tab, reload and log in => You land on the add vendor form, at the URL without acqui and .pl 4. Open /cgi-bin/koha/lists/items/add, log out in another tab, reload and log in => You land on the add item list form 5. Open /cgi-bin/koha/lists/items.pl and /cgi-bin/koha/acqui/vendors.pl => The pages load, at /cgi-bin/koha/lists/items and /cgi-bin/koha/acquisition/vendors 6. Run $ ktd --shell k$ yarn cypress run --spec t/cypress/integration/Admin/VuePagesLogin_spec.ts => SUCCESS: Tests pass! 7. Without the patch, the tests of the vendors and of the item lists fail 8. Sign off :-D Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #16 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Noting that these changes to the path for pages have the potential to impact plugins due to Bug 40095. Worth mentioning in the release notes for this, to give folks a heads up (or somehow addressing in a follow-up to prevent issues for plugins in the first place). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #17 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org