Bug 31219: Prevent JS injection in patron extended attributes

We are sanitizing other attributes but "extended patron attributes".

Test plan:
Make a patron attribute editable at the OPAC
Edit an existing patron, or register a new one
Use a script tag in the new value ("<script>alert("booh!")</script>" for
instance)
With this patch the value is remove if containing an HTML tag that is
not br b i em big small strong (see C4::Scrubber)

Signed-off-by: Mark Hofstetter <koha@trust-box.at>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-07-25 09:23:25 +02:00 committed by Tomas Cohen Arazi
parent 57ea65e725
commit b0cf6c087b
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 2 additions and 1 deletions

View File

@ -730,6 +730,7 @@ sub ParsePatronAttributes {
my $delete_candidates = {};
my $scrubber = C4::Scrubber->new();
while ( my ( $code, $value ) = $ea->() ) {
if ( any { $_ eq $code } @editable_attribute_types ) {
# It is an editable attribute
@ -739,7 +740,7 @@ sub ParsePatronAttributes {
}
else {
# we've got a value
push @attributes, { code => $code, attribute => $value };
push @attributes, { code => $code, attribute => $scrubber->scrub( $value ) };
# 'code' is no longer a delete candidate
delete $delete_candidates->{$code}