From: Darrick J. Wong Date: Wed, 15 Mar 2023 00:53:27 +0000 (-0700) Subject: report: encode xml entities in property values X-Git-Tag: v2023.03.26~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=35de6ce721cc2f0b6438f06f5a11e1c61b27c9c7;p=xfstests-dev.git report: encode xml entities in property values Avoid trouble with the properties reported in the xml reports by translating xml-tricky characters in the property values into their xml entity equivalents. IOWs, if someone sets a property "NAME" to the value 'BOBBY"; DROP TABLES;', the xml will be formatted: Thus avoiding XML problems. Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/common/report b/common/report index 2ab83928..946ee488 100644 --- a/common/report +++ b/common/report @@ -33,7 +33,10 @@ _xunit_add_property() test -z "$value" && return - echo -e "\t\t" + local xname="$(echo "$name" | encode_xml)" + local xvalue="$(echo "$value" | encode_xml)" + + echo -e "\t\t" } _xunit_make_section_report()