New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

axios-keywords

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-keywords

axio敏感词检测

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

axios-keywords

axios敏感词检测

安装

npm i axios-keywords -S

引用

import {create} from "axios";
import axiosKeywords from "axios-keywords";
const service = create();
service.interceptors.request.use((config) => {
    return axiosKeywords(config, options)
})

案例

import axiosKeywords from "axios-keywords";
axiosKeywords(config, {
    data:{
        // ....
    },
    axiosConfig:{
        url:"/api",
        method:"get",
        // ...
    },
    axiosConfigCode:0,
    keywords:["敏感关键词组", "******"],
    keywordsDetection:true,
    keywordsRules:[
        (wordsMap, config)=>{
            if(!Object.values(wordsMap).some(v=>/^[0-9]*$/.test(v))){
                return  Promise.resolve();
            }
            return Promise.reject("提交的内容禁止全部数字")
        },
        // ...
    ],
    errorMessage:"获取敏感词失败!",
    customMessage:(swhResult)=>`请求失败,系统自动检测的您提交的内容包含【${swhResult.filter.join("、")}】等敏感字样,禁止提交`,
    urlWhitelist:[
        /url_keywords/,
        // ...
    ]
})

Keywords

keywords

FAQs

Package last updated on 09 Jan 2022

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