]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
report-error.bbclass: replace angle brackets with < and >
authorChangqing Li <changqing.li@windriver.com>
Mon, 15 Mar 2021 01:03:25 +0000 (18:03 -0700)
committerMartin Jansa <martin.jansa@gmail.com>
Wed, 31 Jan 2024 10:07:09 +0000 (11:07 +0100)
when we have below content in local.conf or auto.conf:
BUILDHISTORY_COMMIT_AUTHOR ?= "Khem Raj <raj.khem@gmail.com>"
send-error-report will fail with "HTTP Error 500: OK"

error-report-web do rudimentary check on all fields that are
passed to the graphs page to avoid any XSS happening, if contains
'<', the server will return error(Invalid characters in json).
fixed by use escape of <> to replace it.

NOTE: with this change, error-report-web need to add filter 'safe'
for the string wanted to display to avoid further HTML escaping
prior to output. Below is how the content displayed on webpage:
with the filter 'safe':
BUILDHISTORY_COMMIT_AUTHOR ?= "Khem Raj <raj.khem@gmail.com>"
without the filter 'safe':
BUILDHISTORY_COMMIT_AUTHOR ?= "Khem Raj &lt;raj.khem@gmail.com&gt;"

Another patch for error-report-web will send to yocto mail list.

[YOCTO #13252]

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
meta/classes/report-error.bbclass

index 891b3c4467ca28b503cc2257fa88c2af9ce3686e..05459a0ac4271163ee56722d5ad464f1369137ba 100644 (file)
@@ -43,6 +43,7 @@ def get_conf_data(e, filename):
                     continue
                 else:
                     jsonstring=jsonstring + line
+    jsonstring = jsonstring.replace("<", "&lt;").replace(">", "&gt;")
     return jsonstring
 
 def get_common_data(e):