提交 88f00c71 编写于 作者: S samantha-dev 提交者: Samantha Ming

Sanitize search text to prevent XSS

上级 3e2d0afa
......@@ -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) {
......@@ -75,7 +76,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);
......
---
title: Sanitize search text to prevent XSS
merge_request:
author:
type: security
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册