v0.2.3
This commit is contained in:
9
dist/xss.js
vendored
9
dist/xss.js
vendored
@@ -5,6 +5,7 @@
|
|||||||
* @author 老雷<leizongmin@gmail.com>
|
* @author 老雷<leizongmin@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var FilterCSS = require('cssfilter').FilterCSS;
|
||||||
var _ = require('./util');
|
var _ = require('./util');
|
||||||
|
|
||||||
// 默认白名单
|
// 默认白名单
|
||||||
@@ -74,6 +75,9 @@ var whiteList = {
|
|||||||
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width']
|
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width']
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 默认CSS Filter
|
||||||
|
var defaultCSSFilter = new FilterCSS();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 匹配到标签时的处理方法
|
* 匹配到标签时的处理方法
|
||||||
*
|
*
|
||||||
@@ -141,6 +145,7 @@ function escapeHtml (html) {
|
|||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
function safeAttrValue (tag, name, value, cssFilter) {
|
function safeAttrValue (tag, name, value, cssFilter) {
|
||||||
|
cssFilter = cssFilter || defaultCSSFilter;
|
||||||
// 转换为友好的属性值,再做判断
|
// 转换为友好的属性值,再做判断
|
||||||
value = friendlyAttrValue(value);
|
value = friendlyAttrValue(value);
|
||||||
|
|
||||||
@@ -398,8 +403,10 @@ exports.onIgnoreTagStripAll = onIgnoreTagStripAll;
|
|||||||
exports.StripTagBody = StripTagBody;
|
exports.StripTagBody = StripTagBody;
|
||||||
exports.stripCommentTag = stripCommentTag;
|
exports.stripCommentTag = stripCommentTag;
|
||||||
exports.stripBlankChar = stripBlankChar;
|
exports.stripBlankChar = stripBlankChar;
|
||||||
|
exports.cssFilter = defaultCSSFilter;
|
||||||
|
|
||||||
},{"./util":4}],2:[function(require,module,exports){
|
|
||||||
|
},{"./util":4,"cssfilter":8}],2:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* 模块入口
|
* 模块入口
|
||||||
*
|
*
|
||||||
|
|||||||
2
dist/xss.min.js
vendored
2
dist/xss.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "xss",
|
"name": "xss",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"description": "Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist. 根据白名单过滤HTML(防止XSS攻击)",
|
"description": "Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist. 根据白名单过滤HTML(防止XSS攻击)",
|
||||||
"author": "leizongmin <leizongmin@gmail.com> (http://ucdok.com)",
|
"author": "leizongmin <leizongmin@gmail.com> (http://ucdok.com)",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
|||||||
Reference in New Issue
Block a user