Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
screw-axios
Advanced tools
axios的扩展包,封装了常规方法,并且支持取消和断线重连的操作。
npm 安装
npm i screw-axios -S
yarn 安装
yarn add screw-axios -S
pnpm 安装
pnpm add screw-axios -S
创建扩展axios类库 在某个目录下创建request.js 文件。写入下面的内容
import ScrewAxios from "ScrewAxios";
const request = new ScrewAxios({
headers: {},
baseURL: "", //基础url前缀
timeout: "", //前端请求超时时间
reqInterceptor(config) {}, //request 拦截器的扩展方法
resInterceptor(config) {}, //response 拦截器的扩展方法
responseHandle: {
//设置需要扩展的response的处理函数
200: res => {
console.log("返回了200")
return response.data
},
},
})
export default request
//在调用的api文件
import request from "./request"
export default {
middleViewData: data => request.get('/jscApi/middleViewData', { data }), // 正常请求
cancelReq: data => request.post('http://localhost:3003/jscApi/middleViewData', { data, cancelRequest: true }), // 测试取消请求
reqAgainSend: data => request.get('/equ/equTypeList11', { data, retry: 3, retryDelay: 1000 }), // 测试请求重发,除了原请求外还会重发3次
cacheEquList: data => request.get('/equ/equList', { data, cache: true, setExpireTime: 30000 }), // 测试缓存请求带参数:setExpireTime 为缓存有效时间ms
cacheEquListParams: data => request.get('/equ/equList', { data, cache: true }) // 测试缓存请求参数值不一样
};
FAQs
Extension of Axios
The npm package screw-axios receives a total of 0 weekly downloads. As such, screw-axios popularity was classified as not popular.
We found that screw-axios demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.