xss_blade
v1.0.1
Published
#### Using npm: >$ npm i xss_blade --save
Downloads
1
Readme
xss防御前端过滤工具:基于npm上的xss库简单封装
Using npm:
$ npm i xss_blade --save
简单使用
import { xssFilter, getDefaultOptions } from "xss_blade";
html = xssFilter('<script>alert("xss");</script>');
console.log('默认参数:', getDefaultOptions());
传递第二个参数options
来自定义规则,具体规则见 xss 官方文档👍
options = {
whiteList:{
a:['href'],
img:['src']
}
}; // 自定义规则
options = {
whiteList:{}
}; // 覆盖封装函数内的whiteList配置
html = xssFilter('<script>alert("xssFilter");</script>', options);