]> git.koha-community.org Git - koha.git/commit
Bug 33967: Fix SetEnv middleware to preserve $env integrity
authorDavid Cook <dcook@prosentient.com.au>
Fri, 9 Jun 2023 03:59:28 +0000 (03:59 +0000)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Wed, 12 Jul 2023 09:41:27 +0000 (09:41 +0000)
commit48003a890b2948a6c0616ad45ea5a220748b8aa2
tree6fe5e81180a9d7bb490a4d54c30a8283aa21c3b2
parent6b459bffb622eb3ed0f4a58115dab4eac6533b69
Bug 33967: Fix SetEnv middleware to preserve $env integrity

This patch fixes the Koha::Middleware::SetEnv, so that it
preserves the referential integrity of the $env hash
reference as it passes through the pre-process and post-process
stages of middleware wrapped around the core Koha Plack application.

Test plan:
0a. Apply the patch
0b. vi /etc/koha/sites/kohadev/koha-conf.xml
0c. Uncomment "koha_trusted_proxies"
0d. Add "172.0.0.0/8" to the end of the "koha_trusted_proxies"
0e. koha-plack --restart kohadev
1. vi /etc/apache2/sites-enabled/kohadev.conf
2. Add the following to the OPAC virtualhost:
SetEnv OVERRIDE_SYSPREF_LibraryName "The Best, Truly the Best, Koha Library"
RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_LibraryName The Best\, Truly the Best\, Koha Library"
RequestHeader add X-Forwarded-For "192.168.100.100"
3. service apache2 restart
4. tail -f /var/log/koha/kohadev/plack.log
5. Go to http://localhost:8080/
6. Note that the plack.log lists 192.168.100.100 as the client IP address
7. Note that the title of the OPAC webpage is
"The Best, Truly the Best, Koha Library Library catalog"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 42823da209bbef2148eb4245c1bdfe215bf899ee)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b139047381b7ff61478155b301fbd69caffc1ddc)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/Middleware/SetEnv.pm