This package has been deprecated

Author message:

wrong name

wemob_xss_defense

1.0.0 • Public • Published

微盟xss防御前端过滤工具,基于npm上的xss库简单封装

Using npm:

$ npm i wemob_xss_defense --save

简单使用

    import { xssFilter, getDefaultOptions } from "xss_defense";

    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);

Readme

Keywords

none

Package Sidebar

Install

npm i wemob_xss_defense

Weekly Downloads

2

Version

1.0.0

License

none

Unpacked Size

2.16 kB

Total Files

3

Last publish

Collaborators

  • npm
  • spartaattack