Socket
Book a DemoInstallSign in
Socket

wemob_xss_defense

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wemob_xss_defense

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

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
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

Package last updated on 22 Dec 2020

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.