Bugzilla – Attachment 162867 Details for
Bug 36244
Template toolkit syntax not escaped in letter templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36244: Do template toolkit processing first
Bug-36244-Do-template-toolkit-processing-first.patch (text/plain), 2.25 KB, created by
Andreas Jonsson
on 2024-03-07 09:33:04 UTC
(
hide
)
Description:
Bug 36244: Do template toolkit processing first
Filename:
MIME Type:
Creator:
Andreas Jonsson
Created:
2024-03-07 09:33:04 UTC
Size:
2.25 KB
patch
obsolete
>From 0a5df0e5decee821da4bfe06345a3cf2c1b34592 Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Thu, 7 Mar 2024 09:12:25 +0000 >Subject: [PATCH] Bug 36244: Do template toolkit processing first > >To avoid injection of template toolkit code >from database fields that are controlled by >untrusted sources. > >Test plan: > >* review subtest 'Template toolkit syntax in > parameters' in t/db_dependent/Letters.t >* Run the unit test: > prove t/db_dependent/Letters.t >--- > C4/Letters.pm | 44 ++++++++++++++++++++++---------------------- > 1 file changed, 22 insertions(+), 22 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index a0404ac707..e300c00d51 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -618,6 +618,28 @@ sub GetPreparedLetter { > return; > my $want_librarian = $params{want_librarian}; > >+ $letter->{content} = _process_tt( >+ { >+ content => $letter->{content}, >+ lang => $lang, >+ loops => $loops, >+ objects => $objects, >+ substitute => $substitute, >+ tables => $tables, >+ } >+ ); >+ >+ $letter->{title} = _process_tt( >+ { >+ content => $letter->{title}, >+ lang => $lang, >+ loops => $loops, >+ objects => $objects, >+ substitute => $substitute, >+ tables => $tables, >+ } >+ ); >+ > if (%$substitute) { > while ( my ($token, $val) = each %$substitute ) { > $val //= q{}; >@@ -688,28 +710,6 @@ sub GetPreparedLetter { > } > } > >- $letter->{content} = _process_tt( >- { >- content => $letter->{content}, >- lang => $lang, >- loops => $loops, >- objects => $objects, >- substitute => $substitute, >- tables => $tables, >- } >- ); >- >- $letter->{title} = _process_tt( >- { >- content => $letter->{title}, >- lang => $lang, >- loops => $loops, >- objects => $objects, >- substitute => $substitute, >- tables => $tables, >- } >- ); >- > $letter->{content} =~ s/<<\S*>>//go; #remove any stragglers > > return $letter; >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36244
:
162866
|
162867
|
162868
|
162871
|
162872
|
162876
|
162877
|
162908
|
162909
|
162910
|
163255
|
163256
|
163257
|
163383
|
163384
|
163385