[Bug 17989] New: Working title
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Bug ID: 17989 Summary: Working title Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: m.de.rooy@rijksmuseum.nl QA Contact: testopia@bugs.koha-community.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Assignee|oleonard@myacpl.org |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |17982 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17982 [Bug 17982] Fix the use of uniq in sub themelanguage -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Working title |Allow templates from plugin | |directories -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Component|Templates |Architecture, internals, | |and plumbing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|17982 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17982 [Bug 17982] Fix the use of uniq in sub themelanguage -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |18010 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 65277 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=65277&action=edit Bug 17989: Centralize bad template check The bad template check in get_template_and_user can be removed, since this check has been added in gettemplate on bug 18010. The check moves here to a new sub in C4::Templates. And will be extended in a follow-up. Removed unused variable $path in gettemplatefile. Test plan: [1] Run t/db_dependent/Auth.t (get_template_and_user bad calls). [2] Run t/db_dependent/Templates.t (bad call to gettemplate). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #2 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 65278 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=65278&action=edit Bug 17989: Extend bad template check The check is now extended by only allowing templates from the regular Koha template directories and additional plugin directories as defined in koha-conf.xml. Note: In order to prevent an uninitialized warning on $theme from sub themelanguage for a not-existing file, I added a trivial assignment. Will get further attention in a follow-up. Test plan: [1] Run t/db_dependent/Auth.t [2] Run t/db_dependent/Templates.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 65279 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=65279&action=edit Bug 17989: Include full path logic in _get_template_file Similar to the full path test in sub themelanguage, this patch makes a change in _get_template_file. This allows you to pass a template outside the modules directory to get_template_and_user. (Note: the sub badtemplatecheck already blocks bad paths.) Especially, this would be helpful for plugins using templates. As can be seen in Templates.pm, a change was made earlier to overwrite the filename for a plugin in sub gettemplate. This exception can now be removed. Also note the small change in Koha/Plugin/Base.pm; mbf_path is already absolute and if we pass a full path, we do not need it. This allows use of a regular Koha template or a shared template between plugins (as long as badtemplatecheck allows the path). What are the side-effects of this change? [1] We should not pass absolute paths if we mean relative ones. A follow-up patch deals with one occurrence in the codebase. No regressions for regular use. [2] Plugins can call get_template_and_user directly or go via get_template in Koha/Plugin/Base (absolute paths don't go via mbf_path). Note: replaced two single quotes in Auth.pm to show template name in test description. Test plan: [1] Open some page on OPAC or staff client to trigger a template. [2] Run t/db_dependent/Auth.t to verify not allowing some bad templates. [3] Run t/db_dependent/Templates.t to verify an absolute path. [4] Run t/db_dependent/Plugins.t to verify using templates in a plugin. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 65280 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=65280&action=edit Bug 17989: Resolve "verbatim paragraph in NAME section" warning in C4::Templates *** WARNING: Verbatim paragraph in NAME section at line 28 in file C4/Templates.pm Test plan: Run podchecker on C4::Templates and verify that the warning is resolved. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 65281 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=65281&action=edit Bug 17989: Final changes [1] The template sco/printslip.tt is in the regular modules directory. Should not be prefixed with a slash. [2] Script svc/members/search gets its template path from a URL parameter. When you git grep json_template, you will have an idea what values it should receive. Test plan: [1] Go intranet home page. Search for patrons in the combo box. Results? [2] Try the URL /cgi-bin/koha/svc/members/search. Should trigger a 500 error with Bad template path in the logs. [3] Try to find another occurrence just like the one corrected in sco/printslip.pl where an absolute path is passed to gettemplate or get_template_and_user. I already tried several regex variations while git grepping template_name, but you may still find one.. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Allow templates from plugin |Stricter control on source |directories |directory for html | |templates -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #65277|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 66272 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66272&action=edit Bug 17989: Centralize bad template check The bad template check in get_template_and_user can be removed, since this check has been added in gettemplate on bug 18010. The check moves here to a new sub in C4::Templates. And will be extended in a follow-up. Removed unused variable $path in gettemplatefile. Test plan: [1] Run t/db_dependent/Auth.t (get_template_and_user bad calls). [2] Run t/db_dependent/Templates.t (bad call to gettemplate). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #65278|0 |1 is obsolete| | --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 66273 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66273&action=edit Bug 17989: Extend bad template check The check is now extended by only allowing templates from the regular Koha template directories and additional plugin directories as defined in koha-conf.xml. Note: In order to prevent an uninitialized warning on $theme from sub themelanguage for a not-existing file, I added a trivial assignment. Will get further attention in a follow-up. Test plan: [1] Run t/db_dependent/Auth.t [2] Run t/db_dependent/Templates.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #65279|0 |1 is obsolete| | --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 66274 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66274&action=edit Bug 17989: Include full path logic in _get_template_file Similar to the full path test in sub themelanguage, this patch makes a change in _get_template_file. This allows you to pass a template outside the modules directory to get_template_and_user. (Note: the sub badtemplatecheck already blocks bad paths.) Especially, this would be helpful for plugins using templates. As can be seen in Templates.pm, a change was made earlier to overwrite the filename for a plugin in sub gettemplate. This exception can now be removed. Also note the small change in Koha/Plugin/Base.pm; mbf_path is already absolute and if we pass a full path, we do not need it. This allows use of a regular Koha template or a shared template between plugins (as long as badtemplatecheck allows the path). What are the side-effects of this change? [1] We should not pass absolute paths if we mean relative ones. A follow-up patch deals with one occurrence in the codebase. No regressions for regular use. [2] Plugins can call get_template_and_user directly or go via get_template in Koha/Plugin/Base (absolute paths don't go via mbf_path). Note: replaced two single quotes in Auth.pm to show template name in test description. Test plan: [1] Open some page on OPAC or staff client to trigger a template. [2] Run t/db_dependent/Auth.t to verify not allowing some bad templates. [3] Run t/db_dependent/Templates.t to verify an absolute path. [4] Run t/db_dependent/Plugins.t to verify using templates in a plugin. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #65280|0 |1 is obsolete| | --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 66275 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66275&action=edit Bug 17989: Resolve "verbatim paragraph in NAME section" warning in C4::Templates *** WARNING: Verbatim paragraph in NAME section at line 28 in file C4/Templates.pm Test plan: Run podchecker on C4::Templates and verify that the warning is resolved. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #65281|0 |1 is obsolete| | --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 66276 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66276&action=edit Bug 17989: Final changes [1] The template sco/printslip.tt is in the regular modules directory. Should not be prefixed with a slash. [2] Script svc/members/search gets its template path from a URL parameter. When you git grep json_template, you will have an idea what values it should receive. Test plan: [1] Go intranet home page. Search for patrons in the combo box. Results? [2] Try the URL /cgi-bin/koha/svc/members/search. Should trigger a 500 error with Bad template path in the logs. [3] Try to find another occurrence just like the one corrected in sco/printslip.pl where an absolute path is passed to gettemplate or get_template_and_user. I already tried several regex variations while git grepping template_name, but you may still find one.. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Trivial rebase -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Josef Moravec <josef.moravec@gmail.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=17989 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #66272|0 |1 is obsolete| | Attachment #66273|0 |1 is obsolete| | Attachment #66274|0 |1 is obsolete| | Attachment #66275|0 |1 is obsolete| | Attachment #66276|0 |1 is obsolete| | --- Comment #12 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 66317 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66317&action=edit [SIGNED-OFF] Bug 17989: Centralize bad template check The bad template check in get_template_and_user can be removed, since this check has been added in gettemplate on bug 18010. The check moves here to a new sub in C4::Templates. And will be extended in a follow-up. Removed unused variable $path in gettemplatefile. Test plan: [1] Run t/db_dependent/Auth.t (get_template_and_user bad calls). [2] Run t/db_dependent/Templates.t (bad call to gettemplate). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #13 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 66318 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66318&action=edit [SIGNED-OFF] Bug 17989: Extend bad template check The check is now extended by only allowing templates from the regular Koha template directories and additional plugin directories as defined in koha-conf.xml. Note: In order to prevent an uninitialized warning on $theme from sub themelanguage for a not-existing file, I added a trivial assignment. Will get further attention in a follow-up. Test plan: [1] Run t/db_dependent/Auth.t [2] Run t/db_dependent/Templates.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #14 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 66319 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66319&action=edit [SIGNED-OFF] Bug 17989: Include full path logic in _get_template_file Similar to the full path test in sub themelanguage, this patch makes a change in _get_template_file. This allows you to pass a template outside the modules directory to get_template_and_user. (Note: the sub badtemplatecheck already blocks bad paths.) Especially, this would be helpful for plugins using templates. As can be seen in Templates.pm, a change was made earlier to overwrite the filename for a plugin in sub gettemplate. This exception can now be removed. Also note the small change in Koha/Plugin/Base.pm; mbf_path is already absolute and if we pass a full path, we do not need it. This allows use of a regular Koha template or a shared template between plugins (as long as badtemplatecheck allows the path). What are the side-effects of this change? [1] We should not pass absolute paths if we mean relative ones. A follow-up patch deals with one occurrence in the codebase. No regressions for regular use. [2] Plugins can call get_template_and_user directly or go via get_template in Koha/Plugin/Base (absolute paths don't go via mbf_path). Note: replaced two single quotes in Auth.pm to show template name in test description. Test plan: [1] Open some page on OPAC or staff client to trigger a template. [2] Run t/db_dependent/Auth.t to verify not allowing some bad templates. [3] Run t/db_dependent/Templates.t to verify an absolute path. [4] Run t/db_dependent/Plugins.t to verify using templates in a plugin. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #15 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 66320 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66320&action=edit [SIGNED-OFF] Bug 17989: Resolve "verbatim paragraph in NAME section" warning in C4::Templates *** WARNING: Verbatim paragraph in NAME section at line 28 in file C4/Templates.pm Test plan: Run podchecker on C4::Templates and verify that the warning is resolved. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #16 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 66321 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66321&action=edit [SIGNED-OFF] Bug 17989: Final changes [1] The template sco/printslip.tt is in the regular modules directory. Should not be prefixed with a slash. [2] Script svc/members/search gets its template path from a URL parameter. When you git grep json_template, you will have an idea what values it should receive. Test plan: [1] Go intranet home page. Search for patrons in the combo box. Results? [2] Try the URL /cgi-bin/koha/svc/members/search. Should trigger a 500 error with Bad template path in the logs. [3] Try to find another occurrence just like the one corrected in sco/printslip.pl where an absolute path is passed to gettemplate or get_template_and_user. I already tried several regex variations while git grepping template_name, but you may still find one.. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #17 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Josef Moravec from comment #16)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Great ! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #66317|0 |1 is obsolete| | Attachment #66318|0 |1 is obsolete| | Attachment #66319|0 |1 is obsolete| | Attachment #66320|0 |1 is obsolete| | Attachment #66321|0 |1 is obsolete| | --- Comment #18 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 67514 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67514&action=edit Bug 17989: Centralize bad template check The bad template check in get_template_and_user can be removed, since this check has been added in gettemplate on bug 18010. The check moves here to a new sub in C4::Templates. And will be extended in a follow-up. Removed unused variable $path in gettemplatefile. Test plan: [1] Run t/db_dependent/Auth.t (get_template_and_user bad calls). [2] Run t/db_dependent/Templates.t (bad call to gettemplate). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #19 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 67515 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67515&action=edit Bug 17989: Extend bad template check The check is now extended by only allowing templates from the regular Koha template directories and additional plugin directories as defined in koha-conf.xml. Note: In order to prevent an uninitialized warning on $theme from sub themelanguage for a not-existing file, I added a trivial assignment. Will get further attention in a follow-up. Test plan: [1] Run t/db_dependent/Auth.t [2] Run t/db_dependent/Templates.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #20 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 67516 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67516&action=edit Bug 17989: Include full path logic in _get_template_file Similar to the full path test in sub themelanguage, this patch makes a change in _get_template_file. This allows you to pass a template outside the modules directory to get_template_and_user. (Note: the sub badtemplatecheck already blocks bad paths.) Especially, this would be helpful for plugins using templates. As can be seen in Templates.pm, a change was made earlier to overwrite the filename for a plugin in sub gettemplate. This exception can now be removed. Also note the small change in Koha/Plugin/Base.pm; mbf_path is already absolute and if we pass a full path, we do not need it. This allows use of a regular Koha template or a shared template between plugins (as long as badtemplatecheck allows the path). What are the side-effects of this change? [1] We should not pass absolute paths if we mean relative ones. A follow-up patch deals with one occurrence in the codebase. No regressions for regular use. [2] Plugins can call get_template_and_user directly or go via get_template in Koha/Plugin/Base (absolute paths don't go via mbf_path). Note: replaced two single quotes in Auth.pm to show template name in test description. Test plan: [1] Open some page on OPAC or staff client to trigger a template. [2] Run t/db_dependent/Auth.t to verify not allowing some bad templates. [3] Run t/db_dependent/Templates.t to verify an absolute path. [4] Run t/db_dependent/Plugins.t to verify using templates in a plugin. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #21 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 67517 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67517&action=edit Bug 17989: Resolve "verbatim paragraph in NAME section" warning in C4::Templates *** WARNING: Verbatim paragraph in NAME section at line 28 in file C4/Templates.pm Test plan: Run podchecker on C4::Templates and verify that the warning is resolved. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #22 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 67518 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67518&action=edit Bug 17989: Final changes [1] The template sco/printslip.tt is in the regular modules directory. Should not be prefixed with a slash. [2] Script svc/members/search gets its template path from a URL parameter. When you git grep json_template, you will have an idea what values it should receive. Test plan: [1] Go intranet home page. Search for patrons in the combo box. Results? [2] Try the URL /cgi-bin/koha/svc/members/search. Should trigger a 500 error with Bad template path in the logs. [3] Try to find another occurrence just like the one corrected in sco/printslip.pl where an absolute path is passed to gettemplate or get_template_and_user. I already tried several regex variations while git grepping template_name, but you may still find one.. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #23 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Simple rebase -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA CC| |nick@bywatersolutions.com --- Comment #24 from Nick Clemens <nick@bywatersolutions.com> --- This looks good overall, everything seems to work fine, one test breakage: vagrant@kohadevbox:kohaclone(BUGFUN)$ prove -v t/db_dependent/SuggestionEngine_ExplodedTerms.t t/db_dependent/SuggestionEngine_ExplodedTerms.t .. ok 1 - use Koha::SuggestionEngine; ok 2 - Created suggestion engine bad template path# Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 255 just after 2. Dubious, test returned 255 (wstat 65280, 0xff00) All 2 subtests passed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #25 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 68654 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68654&action=edit Bug 17989: (QA follow-up) Replace bad dots in SuggestionEngine_ExplodedTerms.t SuggestionEngine_ExplodedTerms.t uses paths like /../.. or /.. in order to find a template in opac-tmpl. Sub badtemplatecheck does not like these paths. Using Cwd::abs_path to resolve the situation (rel2abs does not). Test plan: Run again t/db_dependent/SuggestionEngine_ExplodedTerms.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Nick Clemens <nick@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=17989 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #67514|0 |1 is obsolete| | Attachment #67515|0 |1 is obsolete| | Attachment #67516|0 |1 is obsolete| | Attachment #67517|0 |1 is obsolete| | Attachment #67518|0 |1 is obsolete| | Attachment #68654|0 |1 is obsolete| | --- Comment #26 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 68667 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68667&action=edit Bug 17989: Centralize bad template check The bad template check in get_template_and_user can be removed, since this check has been added in gettemplate on bug 18010. The check moves here to a new sub in C4::Templates. And will be extended in a follow-up. Removed unused variable $path in gettemplatefile. Test plan: [1] Run t/db_dependent/Auth.t (get_template_and_user bad calls). [2] Run t/db_dependent/Templates.t (bad call to gettemplate). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #27 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 68668 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68668&action=edit Bug 17989: Extend bad template check The check is now extended by only allowing templates from the regular Koha template directories and additional plugin directories as defined in koha-conf.xml. Note: In order to prevent an uninitialized warning on $theme from sub themelanguage for a not-existing file, I added a trivial assignment. Will get further attention in a follow-up. Test plan: [1] Run t/db_dependent/Auth.t [2] Run t/db_dependent/Templates.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #28 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 68669 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68669&action=edit Bug 17989: Include full path logic in _get_template_file Similar to the full path test in sub themelanguage, this patch makes a change in _get_template_file. This allows you to pass a template outside the modules directory to get_template_and_user. (Note: the sub badtemplatecheck already blocks bad paths.) Especially, this would be helpful for plugins using templates. As can be seen in Templates.pm, a change was made earlier to overwrite the filename for a plugin in sub gettemplate. This exception can now be removed. Also note the small change in Koha/Plugin/Base.pm; mbf_path is already absolute and if we pass a full path, we do not need it. This allows use of a regular Koha template or a shared template between plugins (as long as badtemplatecheck allows the path). What are the side-effects of this change? [1] We should not pass absolute paths if we mean relative ones. A follow-up patch deals with one occurrence in the codebase. No regressions for regular use. [2] Plugins can call get_template_and_user directly or go via get_template in Koha/Plugin/Base (absolute paths don't go via mbf_path). Note: replaced two single quotes in Auth.pm to show template name in test description. Test plan: [1] Open some page on OPAC or staff client to trigger a template. [2] Run t/db_dependent/Auth.t to verify not allowing some bad templates. [3] Run t/db_dependent/Templates.t to verify an absolute path. [4] Run t/db_dependent/Plugins.t to verify using templates in a plugin. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #29 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 68670 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68670&action=edit Bug 17989: Resolve "verbatim paragraph in NAME section" warning in C4::Templates *** WARNING: Verbatim paragraph in NAME section at line 28 in file C4/Templates.pm Test plan: Run podchecker on C4::Templates and verify that the warning is resolved. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #30 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 68671 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68671&action=edit Bug 17989: Final changes [1] The template sco/printslip.tt is in the regular modules directory. Should not be prefixed with a slash. [2] Script svc/members/search gets its template path from a URL parameter. When you git grep json_template, you will have an idea what values it should receive. Test plan: [1] Go intranet home page. Search for patrons in the combo box. Results? [2] Try the URL /cgi-bin/koha/svc/members/search. Should trigger a 500 error with Bad template path in the logs. [3] Try to find another occurrence just like the one corrected in sco/printslip.pl where an absolute path is passed to gettemplate or get_template_and_user. I already tried several regex variations while git grepping template_name, but you may still find one.. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #31 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 68672 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68672&action=edit Bug 17989: (QA follow-up) Replace bad dots in SuggestionEngine_ExplodedTerms.t SuggestionEngine_ExplodedTerms.t uses paths like /../.. or /.. in order to find a template in opac-tmpl. Sub badtemplatecheck does not like these paths. Using Cwd::abs_path to resolve the situation (rel2abs does not). Test plan: Run again t/db_dependent/SuggestionEngine_ExplodedTerms.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #32 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Comment on attachment 68671 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68671 Bug 17989: Final changes Review of attachment 68671: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=17989&attachment=68671) ----------------------------------------------------------------- ::: svc/members/search @@ +28,5 @@
use Koha::Patrons;
my $input = new CGI; +my $template_path = $input->param('template_path'); +if( !$template_path || $template_path =~ /^\/|\.\./ ) {
Why do we need to check that here? It is already checked in badtemplatecheck. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #68671|0 |1 is obsolete| | --- Comment #33 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 68842 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68842&action=edit Bug 17989: Final changes [1] The template sco/printslip.tt is in the regular modules directory. Should not be prefixed with a slash. Test plan: [1] Try to find another occurrence just like the one corrected in sco/printslip.pl where an absolute path is passed to gettemplate or get_template_and_user. I already tried several regex variations while git grepping template_name, but you may still find one.. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Amended: Removed the changes for svc/members/search. Not needed. Commit message adjusted accordingly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #68672|0 |1 is obsolete| | --- Comment #34 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 68843 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68843&action=edit Bug 17989: (QA follow-up) Replace bad dots in SuggestionEngine_ExplodedTerms.t SuggestionEngine_ExplodedTerms.t uses paths like /../.. or /.. in order to find a template in opac-tmpl. Sub badtemplatecheck does not like these paths. Using Cwd::abs_path to resolve the situation (rel2abs does not). Test plan: Run again t/db_dependent/SuggestionEngine_ExplodedTerms.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 --- Comment #35 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #32)
Comment on attachment 68671 [details] [review] Bug 17989: Final changes
Review of attachment 68671 [details] [review]: -----------------------------------------------------------------
::: svc/members/search @@ +28,5 @@
use Koha::Patrons;
my $input = new CGI; +my $template_path = $input->param('template_path'); +if( !$template_path || $template_path =~ /^\/|\.\./ ) {
Why do we need to check that here? It is already checked in badtemplatecheck.
No, it is not needed. Removed it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #36 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 17.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17989 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org