From b38535de56dfd8a909811bf9822c90e6d679fdf6 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 17 Aug 2011 15:36:15 -0400 Subject: [PATCH] Escape TPAC "myopac" output to protect against XSS attacks We're using the Template::Toolkit html and uri filters to ensure that the usual suspects are escaped at output time to prevent trivial XSS attacks. berick: did some merge cleanup Signed-off-by: Dan Scott --- .../templates/default/opac/myopac/circ_history.tt2 | 8 ++++---- Open-ILS/web/templates/default/opac/myopac/circs.tt2 | 12 ++++++------ .../templates/default/opac/myopac/hold_history.tt2 | 2 +- Open-ILS/web/templates/default/opac/myopac/holds.tt2 | 2 +- .../web/templates/default/opac/myopac/holds/edit.tt2 | 8 ++++---- Open-ILS/web/templates/default/opac/myopac/lists.tt2 | 10 +++++----- Open-ILS/web/templates/default/opac/myopac/main.tt2 | 6 +++--- .../web/templates/default/opac/myopac/main_pay.tt2 | 2 +- .../default/opac/myopac/main_payment_form.tt2 | 4 ++-- .../templates/default/opac/myopac/main_payments.tt2 | 6 +++++- Open-ILS/web/templates/default/opac/myopac/prefs.tt2 | 4 ++-- .../templates/default/opac/myopac/prefs_notify.tt2 | 4 ++-- .../templates/default/opac/myopac/prefs_settings.tt2 | 4 ++-- .../templates/default/opac/myopac/receipt_email.tt2 | 8 +++++--- .../templates/default/opac/myopac/receipt_print.tt2 | 2 +- .../templates/default/opac/myopac/update_email.tt2 | 4 +--- .../default/opac/myopac/update_username.tt2 | 7 +++---- 17 files changed, 48 insertions(+), 45 deletions(-) diff --git a/Open-ILS/web/templates/default/opac/myopac/circ_history.tt2 b/Open-ILS/web/templates/default/opac/myopac/circ_history.tt2 index a0955585c8..55bbc00bf9 100644 --- a/Open-ILS/web/templates/default/opac/myopac/circ_history.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/circ_history.tt2 @@ -71,9 +71,9 @@ [% attrs.title %] + name="[% l('Catalog record') %]">[% attrs.title | html %] [% IF attrs.author %] / - [% attrs.author %] + [% attrs.author | html %] [% END %] @@ -90,8 +90,8 @@ * [% END; %] - [% circ.circ.target_copy.barcode %] - [% circ.circ.target_copy.call_number.label %] + [% circ.circ.target_copy.barcode | html %] + [% circ.circ.target_copy.call_number.label | html %] [% END %] diff --git a/Open-ILS/web/templates/default/opac/myopac/circs.tt2 b/Open-ILS/web/templates/default/opac/myopac/circs.tt2 index 67f94b8747..107597b555 100644 --- a/Open-ILS/web/templates/default/opac/myopac/circs.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/circs.tt2 @@ -106,9 +106,9 @@ - [% attrs.title %] + [% attrs.title | html %] [% IF attrs.author %] / - [% attrs.author %] + [% attrs.author | html %] [% END %] @@ -119,18 +119,18 @@ [% date.format(ctx.parse_datetime(circ.circ.due_date),DATE_FORMAT) %] - [% circ.circ.target_copy.barcode %] + [% circ.circ.target_copy.barcode | html %] - [% circ.circ.target_copy.call_number.label %] + [% circ.circ.target_copy.call_number.label | html %] [% IF circ.renewal_response AND circ.renewal_response.textcode != 'SUCCESS' %] [%# XXX colspan="0" does not work in IE %] - - [% circ.renewal_response.desc || circ.renewal_response.payload.fail_part || circ.renewal_response.textcode %] + + [% (circ.renewal_response.desc || circ.renewal_response.payload.fail_part || circ.renewal_response.textcode) | html %] diff --git a/Open-ILS/web/templates/default/opac/myopac/hold_history.tt2 b/Open-ILS/web/templates/default/opac/myopac/hold_history.tt2 index 43f32564ec..0419cd3021 100644 --- a/Open-ILS/web/templates/default/opac/myopac/hold_history.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/hold_history.tt2 @@ -81,7 +81,7 @@ - [% ctx.get_aou(ahr.pickup_lib).name %] + [% ctx.get_aou(ahr.pickup_lib).name | html %] [% IF ahr.frozen == 't' AND ahr.thaw_date; diff --git a/Open-ILS/web/templates/default/opac/myopac/holds.tt2 b/Open-ILS/web/templates/default/opac/myopac/holds.tt2 index a6bb6709dc..7fac5063b5 100644 --- a/Open-ILS/web/templates/default/opac/myopac/holds.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/holds.tt2 @@ -154,7 +154,7 @@ - [% ctx.get_aou(ahr.pickup_lib).name %] + [% ctx.get_aou(ahr.pickup_lib).name | html %] - [% | l(ctx.invalid_username) %] - "[_1]" is not a valid username. Usernames cannot have any spaces. Please try a different username. - [% END %] + [% l('"[_1]" is not a valid username. Usernames cannot have any spaces. Please try a different username.', ctx.invalid_username) | html %] [% ELSIF ctx.username_exists %]
- [% | l(ctx.username_exists) %] + [% bad_user = ctx.username_exists | html %] + [% | l(bad_user) %] The username "[_1]" is taken. Please try a different username. [% END %]
-- 2.43.2