
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
webpack-dev-mock
Advanced tools
mock-dev-server 是一个 express 服务的中间件
读取项目目录下的 mock/index.js
文件生成,会配置对应的接口。
// mock/index.js
const foo = require('./foo.json');
const bar = require('./bar');
module.exports = {
// 同时支持 GET 和 POST
'/api/users/1': foo,
'/api/foo/bar': bar(),
// 支持标准 HTTP
'GET /api/users': { users: [1, 2] },
'DELETE /api/users': { users: [1, 2] },
// 支持自定义函数,API 参考 express4
'POST /api/users/create': (req, res) => {
res.end('OK');
},
// 支持参数
'POST /api/users/:id': (req, res) => {
const { id } = req.params;
res.send({ id: id });
},
};
// server.js
const express = require('express');
const mockServer = require('mock-server');
const app = express();
mockServer(app);
app.get('/', (req, res) => res.send('hello world'));
app.listen(6001, () => {
console.log('Example app listening on port 6001!');
console.log('http://127.0.0.1:6001');
});
FAQs
Webpack devserver middleware mock server
The npm package webpack-dev-mock receives a total of 284 weekly downloads. As such, webpack-dev-mock popularity was classified as not popular.
We found that webpack-dev-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.