Socket
Socket
Sign inDemoInstall

wemob_xss_defense

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wemob_xss_defense

#### Using npm: >$ npm i wemob_xss_defense --save


Version published
Weekly downloads
2
Maintainers
1
Install size
235 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 22 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc