summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorsamantha-dev <sming@gitlab.com>2019-09-27 13:59:41 -0700
committerSamantha Ming <sming@gitlab.com>2019-10-10 14:39:32 -0700
commit6d0a40214a0421ef75a5293b54ce7703b38db32a (patch)
tree0127f7d0e7240752c217cc64fadbfaf3e3337c40 /app
parent50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff)
downloadgitlab-ce-6d0a40214a0421ef75a5293b54ce7703b38db32a.tar.gz
Sanitize search text to prevent XSS
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/project_find_file.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/project_find_file.js b/app/assets/javascripts/project_find_file.js
index e73a828c0ae..5f9a4c1bf07 100644
--- a/app/assets/javascripts/project_find_file.js
+++ b/app/assets/javascripts/project_find_file.js
@@ -5,6 +5,7 @@ import fuzzaldrinPlus from 'fuzzaldrin-plus';
import axios from '~/lib/utils/axios_utils';
import flash from '~/flash';
import { __ } from '~/locale';
+import sanitize from 'sanitize-html';
// highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> )
const highlighter = function(element, text, matches) {
@@ -74,7 +75,7 @@ export default class ProjectFindFile {
findFile() {
var result, searchText;
- searchText = this.inputElement.val();
+ searchText = sanitize(this.inputElement.val());
result =
searchText.length > 0 ? fuzzaldrinPlus.filter(this.filePaths, searchText) : this.filePaths;
return this.renderList(result, searchText);