[Bug 24538] New: REMOTE_USER set to undef if koha_trusted_proxies contains invalid value
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 Bug ID: 24538 Summary: REMOTE_USER set to undef if koha_trusted_proxies contains invalid value Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org If koha_trusted_proxies contains an invalid or unparseable value, say due to a typo, like "1.1.1.", it'll treat it as a 0.0.0.0/0 mask and match against everything. In my tests, this leads to REMOTE_USER being set to undef. (On the plus side, at least a 0.0.0.0/0 mask leads to zero privileges rather than all privileges.) -- 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=24538 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23068 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23068 [Bug 23068] Add ability for Koha to handle X-Forwarded-For headers so REMOTE_ADDR features work behind a proxy -- 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=24538 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- The solution should probably use either the new2 constructor (code smell...) or check the $objet->{'ERROR'} value as per https://metacpan.org/pod/Net::Netmask#CONSTRUCTING. (Note that I actually found this while testing a patch for https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24537) -- 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=24538 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch 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=24538 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 99232 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99232&action=edit Bug 24538: Add unit tests for Koha::Middleware::RealIP This patch adds some unit tests for Koha::Middleware::RealIP -- 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=24538 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- Created attachment 99233 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99233&action=edit Bug 24538: Handle Net::Netmask parser errors This patch switches from the new() to new2() constructor, which will return an undef value when it fails to parse a value. This patch warns on parser failures, but otherwise silently drops the invalid value, and returns objects for any valid input it can parse. This way one mistake won't disable the whole feature. To test: 1. Run the unit test t/Koha/Middlware/RealIP.t -- 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=24538 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- I'd suggest applying the "Add unit tests..." patch first, running it, seeing the failures, and then applying the 2nd patch, and then running the unit test again (and seeing the successes). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=24538 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #99232|0 |1 is obsolete| | Attachment #99233|0 |1 is obsolete| | --- Comment #5 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 99243 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99243&action=edit Bug 24538: Add unit tests for Koha::Middleware::RealIP This patch adds some unit tests for Koha::Middleware::RealIP Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #99243|0 |1 is obsolete| | --- Comment #6 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 99244 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99244&action=edit Bug 24538: Add unit tests for Koha::Middleware::RealIP This patch adds some unit tests for Koha::Middleware::RealIP Signed-off-by: Kyle M Hall <kyle@bywatersolutions.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=24538 --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 99245 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99245&action=edit Bug 24538: Handle Net::Netmask parser errors This patch switches from the new() to new2() constructor, which will return an undef value when it fails to parse a value. This patch warns on parser failures, but otherwise silently drops the invalid value, and returns objects for any valid input it can parse. This way one mistake won't disable the whole feature. To test: 1. Run the unit test t/Koha/Middlware/RealIP.t Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #99244|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 99283 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99283&action=edit Bug 24538: Add unit tests for Koha::Middleware::RealIP This patch adds some unit tests for Koha::Middleware::RealIP Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #99245|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 99284 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99284&action=edit Bug 24538: Handle Net::Netmask parser errors This patch switches from the new() to new2() constructor, which will return an undef value when it fails to parse a value. This patch warns on parser failures, but otherwise silently drops the invalid value, and returns objects for any valid input it can parse. This way one mistake won't disable the whole feature. To test: 1. Run the unit test t/Koha/Middlware/RealIP.t Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.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=24538 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Signed Off |Passed QA --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Cheers guys, Passing QA -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 --- Comment #11 from David Cook <dcook@prosentient.com.au> --- Thanks for the quick turnaround on this, guys. Really appreciated. I love Koha::Middleware::RealIP, so glad I was able to contribute :D. -- 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=24538 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24538 --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- 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=24538 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |joy@bywatersolutions.com Version(s)|20.05.00 |20.05.00, 19.11.04 released in| | --- Comment #13 from Joy Nelson <joy@bywatersolutions.com> --- Pushed to 19.11.x branch for 19.11.04 -- 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=24538 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=25950 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org