Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Inject fake HTTP request/response into an Express server. This is a port of hapi's shot
module, adapted to work with Express. artificial
allows fake responses to be injected into a server without first binding to a port. This simplifies testing.
'use strict';
const Artificial = require('artificial');
const Express = require('express');
const app = Express();
Artificial(app); // Create the app.inject() method.
app.get('/', (req, res, next) => {
res.send({ success: 'success!' });
});
app.inject({ method: 'GET', url: '/' }, (res) => {
// res contains the fake HTTP response.
});
artificial
exports a single function that is used to add a single injection method to an Express app.
Artificial(app [, method])
app
(object) - An Express application.method
(string) - The name of the method to attach to app
. Optional. Defaults to 'inject'
, meaning that app.inject()
is created.app
(object) - The same Express application as app
.Defines an injection method on an Express server. By default, the method's name is inject()
. This method injects a request into the server, simulating an incoming HTTP request without using sockets. Injection is useful for testing purposes, as well as for invoking routing logic internally without the overhead and limitations of the network stack.
FAQs
Inject fake HTTP request/response into an Express server
We found that artificial 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
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.