From 843bc106a1c1b1699e9e52b6b0d01c7efe1d6225 Mon Sep 17 00:00:00 2001 From: Diego Cepeda Date: Fri, 5 Feb 2021 15:30:43 -0800 Subject: [PATCH] prevent potential XSS from searchbar results (#342) * prevent potential XSS from searchbar results * use built in handlebars expression escaping * use handlebars encodeURIComponent --- src/oncall/ui/static/js/oncall.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/oncall/ui/static/js/oncall.js b/src/oncall/ui/static/js/oncall.js index 9189bd8d..022985e2 100644 --- a/src/oncall/ui/static/js/oncall.js +++ b/src/oncall/ui/static/js/oncall.js @@ -579,11 +579,11 @@ var oncall = { }, footer: function(resp){ if (teamsCt > typeaheadLimit) { - return '
See all ' + teamsCt + ' results for teams »
'; + return '
See all ' + teamsCt + ' results for teams »
'; } }, empty: function(resp){ - return '

No results found for "' + resp.query + '"

'; + return '

No results found for "' + Handlebars.escapeExpression(resp.query) + '"

'; } } }, @@ -604,7 +604,7 @@ var oncall = { }, footer: function(resp){ if (servicesCt > typeaheadLimit) { - return '
See all ' + servicesCt + ' results for services »
'; + return '
See all ' + servicesCt + ' results for services »
'; } } } @@ -626,7 +626,7 @@ var oncall = { }, footer: function(resp){ if (usersCt > typeaheadLimit) { - return '
See all ' + usersCt + ' results for users »
'; + return '
See all ' + usersCt + ' results for users »
'; } } }