
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
bifrost-wss
Advanced tools
WebSocket Server & Client library for simple authorized publisher/subscriber communication with rooms/topics.
Also provides a simple request/response pattern (via command).
Provides full control over handlers and instances, with additional helpers for easy integration with WebSocket Server (WSS).
npm i bifrost-wss
import {WSSManager} from 'bifrost-wss'
const server = new WSSManager( {
port: 8095,
host: "localhost",
});
server.createRoom('room-1')
server.createRoom('room-2')
server.addHandler('authorize', function open(peer, accessToken) {
if(accessToken === process.env.ACCESS_TOKEN) {
// Deal with Auth for instance, and modify the peer object
peer.isAuth = true;
}
})
// Allow a peer to send a command "increment" and get a response
server.addHandler('increment', function increment(peer, message) {
if(message.requestId){
peer.send({value: i++, requestId: message.requestId})
}
});
await server.start()
setInterval(()=>{
server.logger.level = 'trace';
server.broadcastRoom('room-1', {type: 'hello', payload: 'room1'})
server.broadcastRoom('room-2', {type: 'hello', payload: 'room2'})
server.broadcastAll({type: 'hello', payload: 'all'})
},1000)
import {WSClient} from 'bifrost-wss'
const client = new WSClient({
port: 8095,
host: "localhost",
headers: {
access_token: process.env.ACCESS_TOKEN,
}
});
client.addHandler('open', () => {
client.authorize();
setTimeout(() => client.subscribe('room-1'), 10);
setTimeout(() => client.subscribe('room-2'), 5000);
});
// global handler for all messages, they are in JSON already
client.addHandler('message', (message) => {
console.log(message);
});
// Will be called only for messages from room-1
client.addHandler('room-1', function message(message) {
console.log('room-1 handler', message)
});
await client.open();
// Will send a command to the server and wait for a response
const req = client.send({
cmd: 'increment',
})
const res = await req;
console.log('increment response', res)
When .send() is called with a cmd
property, a requestId will be generated, and a listener associated with the requestId will be created. The response will be awaited and the listener removed.
{
cmd: 'subscribe',
room: 'time-beacon'
}
{
topic: 'time-beacon',
payload: {time: 1234567890}
}
new WSSManager(options)
options
: Object containing configuration options.
port
: (Number) The port number for the server.host
: (String) The host address for the server.logger
: (Object) Custom logger object.start()
stop()
createRoom(roomName, force = false)
roomName
: (String) Name of the room to create.force
: (Boolean) Whether to force the creation of the room if it already exists.removeRoom(roomName)
roomName
: (String) Name of the room to remove.broadcastRoom(roomName, message, sender = null, broadcastToSelf = false)
roomName
: (String) Name of the room.message
: (Object) Message object to broadcast.sender
: (Object) Sender peer object. (Optional)broadcastToSelf
: (Boolean) Whether to broadcast to the sender. (Optional)broadcastAll(message)
message
: (Object) Message object to broadcast.addHandler(type, handler)
type
: (String) Type of message.handler
: (Function) Handler function.new WSClient(options)
options
: Object containing configuration options.
port
: (Number) The port number of the server.host
: (String) The host address of the server.headers
: (Object) Headers for WebSocket connection.isSecure
: (Boolean) When true, use wss - defaults to false.open()
close()
subscribe(room)
room
: (String) Name of the room to subscribe to.authorize(accessToken)
accessToken
: (String) Access token for authorization.send(message)
message
: (Object/String) Message object or string to send.addHandler(name, handler)
name
: (String) Name of the event.handler
: (Function) Handler function.FAQs
WSS Manager
The npm package bifrost-wss receives a total of 0 weekly downloads. As such, bifrost-wss popularity was classified as not popular.
We found that bifrost-wss 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
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.