Summary: | sessionID declared twice in C4::Auth::checkauth() | ||
---|---|---|---|
Product: | Koha | Reporter: | David Cook <dcook> |
Component: | Authentication | Assignee: | David Cook <dcook> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | minor | ||
Priority: | P5 - low | CC: | dpavlin, fridolin.somers, m.de.rooy, martin.renvoize, nick |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21325 | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Attachments: |
Bug 13779 - sessionID declared twice in C4::Auth::checkauth()
Bug 13779: sessionID declared twice in C4::Auth::checkauth() Bug 13779: sessionID declared twice in C4::Auth::checkauth() Bug 13779: (QA follow-up) Correct checkauth call in offline_circ/download.pl |
Description
David Cook
2015-03-03 06:09:26 UTC
This is still an issue. I'm tempted to write a patch for it, but I fear that it'll be too scary for people to test since it's in C4::Auth. At the moment, it doesn't really affect anyone (except for me with code which isn't in Koha). We can verify this by running the following in the root git directory: grep -l -R "checkauth" --exclude="*.t" --exclude="*.pm" | xargs -n1 grep "sessionID" For the most part, nothing gets done with sessionID. The one exception seems to be opac/external/overdrive/auth.pl but it doesn't actually require auth so it doesn't go down the bad path in C4::Auth. Created attachment 77099 [details] [review] Bug 13779 - sessionID declared twice in C4::Auth::checkauth() The bug is that $sessionID is declared twice in C4::Auth::checkauth(). At the moment, this doesn't actually create a problem, because no one seems to be using the $sessionID which is returned by checkauth(), except in the case of opac/external/overdrive/auth.pl which skips the second declartion as it doesn't require auth. This patch removes the redefining of the $sessionID variable. In terms of testing, try logging in with a username and password and see if it works. The only risk this patch would pose is breaking auth I would think, since nothing is actually using the return value from checkauth() for $sessionID. Created attachment 78452 [details] [review] Bug 13779: sessionID declared twice in C4::Auth::checkauth() The bug is that $sessionID is declared twice in C4::Auth::checkauth(). At the moment, this doesn't actually create a problem, because no one seems to be using the $sessionID which is returned by checkauth(), except in the case of opac/external/overdrive/auth.pl which skips the second declartion as it doesn't require auth. This patch removes the redefining of the $sessionID variable. In terms of testing, try logging in with a username and password and see if it works. The only risk this patch would pose is breaking auth I would think, since nothing is actually using the return value from checkauth() for $sessionID. NOTE: It was initially defined near the top of the function (~line 791). I believe the scoping would mean the correct version of $sessionID would be used in the latter lines for the unset'ing. I have skimmed code to see if the sessionID return value is used. I did not test overdrive, as I do not know how. However, this is the only area, I think this could possibly break. This change makes sense to me. QA: Please test overdrive. opac/external/overdrive/auth.pl only checks if the value is set, so this patch might fix/break something there? opac/svc/overdrive same kind of check. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Please use the assignee field, David. Thx. QA: Looking here This looks good to me so far, but I will finish it just later today or Monday. Created attachment 78527 [details] [review] Bug 13779: sessionID declared twice in C4::Auth::checkauth() The bug is that $sessionID is declared twice in C4::Auth::checkauth(). At the moment, this doesn't actually create a problem, because no one seems to be using the $sessionID which is returned by checkauth(), except in the case of opac/external/overdrive/auth.pl which skips the second declartion as it doesn't require auth. This patch removes the redefining of the $sessionID variable. In terms of testing, try logging in with a username and password and see if it works. The only risk this patch would pose is breaking auth I would think, since nothing is actually using the return value from checkauth() for $sessionID. NOTE: It was initially defined near the top of the function (~line 791). I believe the scoping would mean the correct version of $sessionID would be used in the latter lines for the unset'ing. I have skimmed code to see if the sessionID return value is used. I did not test overdrive, as I do not know how. However, this is the only area, I think this could possibly break. This change makes sense to me. QA: Please test overdrive. opac/external/overdrive/auth.pl only checks if the value is set, so this patch might fix/break something there? opac/svc/overdrive same kind of check. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> This is a (tiny) code improvement. Now we consistently return the session id that is also stored in the returned cookie. (Which can be an 'anon' session.) Fact is that Koha almost everywhere ignores the returned session id and sometimes gets the session from the cookie (obviously). The session id is also passed to the template by get_template_and_user but never used in templates. As mentioned, the two overdrive scripts are the exception. But since both test on both $user && $sessionID, they will not choke on an anynonomous session id without userid. So theoretically fine, but not tested. Created attachment 78528 [details] [review] Bug 13779: (QA follow-up) Correct checkauth call in offline_circ/download.pl Script offline_circ/download.pl does not use the return values of checkauth. So should not assign them to bad chosen variables that do not correspond with checkauth but with get_template_and_user. Test plan: Look for $template, $loggedinuser, $cookie, $flags in the code. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Awesome work all! Pushed to master for 18.11 Pushed to 18.05.x for 18.05.04 Pushed to 17.11.x for 17.11.10 |