
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
Server and client library for implementing api on top of the websocket
npm install --save ws-api
<body>
<pre></pre>
<input type="file">
</body>
const api = require('ws-api')('//localhost:3000/');
api.request('test/resolve').then(console.log.bind(console));
api.request('test/reject').catch(console.log.bind(console));
document.addEventListener('DOMContentLoaded', () => {
const pre = document.querySelector('pre');
const input = document.querySelector('input');
api.subscribe('session', payload => {
pre.innerHTML = JSON.stringify(payload, null, 2);
});
input.addEventListener('change', () => {
const file = input.files[0];
if(!file) { return; }
api.request('file', {name: file.name}, file);
});
void function e(test) {
setTimeout(() => {
api.request('set', {test}).then(e);
}, 3000)
}(true);
});
const fs = require('fs');
const {Server} = require('ws-api');
const api = new Server({port: 3000});
// In all your methods this is connection context
// The context is passed to the last arguments of the function
// (for use it in arrow functions)
api.use(ctx => {
console.log('new session');
ctx.once('close', () => {
console.log('destroy session');
});
});
api.channel('session', (publish, ctx) => {
console.log('subscribe');
const t = setInterval(() => {
publish(ctx.session);
}, 5000);
return () => {
console.log('unsubscribe');
clearInterval(t);
};
});
api.mount('file', async ({name}, stream) => {
console.log('request file ' + name);
const outStream = fs.createWriteStream(__dirname + '/tmp/' + name);
const p = new Promise(resolve => stream.once('end', resolve));
stream.pipe(outStream);
await p;
return true;
});
api.mount('set', function(payload) {
console.log('request set');
Object.assign(this.session, payload);
return this.session;
});
api.mount('test/', {
resolve() { return {test: 'resolve'}; },
reject() { throw {test: 'reject'} }
});
see docs
MIT
FAQs
Api on top of the websocket library
We found that ws-api 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.