
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.
A base hapi configuration for my new API projects
const baseConfig = require('base-hapi');
(async () => {
const server = await baseConfig;
await server.start();
console.log(`Server started at ${server.info.uri}`);
// server started at http://localhost:4000
})();
If you want to change the HOST and PORT you can do it by setting up two variable environments
HOST=192.168.1.25
PORT=2000
Out of the box base-hapi comes with many defaults:
{
name: process.env.CATBOX_REDIS_NAME || 'catbox-redis',
// engine: require(catbox-redis),
partition: process.env.CATBOX_PARTITION_NAME || 'cache',
host: process.env.REDIS_HOST || 'localhost',
port: process.env.REDIST_PORT || 6379,
},
options: {
environment: process.env.NODE_ENV,
dsn: process.env.SENTRY_DNS,
},
async function validate(token) {
// your custom validation here
// return true to pass to the handler
// return false to return a 401 to client
// credentials can be used inside your handlers in the request object
// request.auth.credentials
return { isValid: true, credentials: { id: 1 } };
}
const server = await baseConfig({ validate });
const myPlugin = {
name: 'my-plugin',
register(server) {
server.route({
handler() {
return 'I am a plugin';
},
method: 'GET',
path: '/my-plugin',
});
},
version: '1.0.0',
};
const plugins = [myPlugin];
const server = await baseConfig({ plugins });
const server = await baseConfig();
server.route({
method: 'GET',
path: '/pagination',
handler(request, h) {
return h.paginate({ results: [], total: 20 }, request.query);
},
});
If you do not specify a limit in the query parameters it will use the OFFSET_DEFAULT environment variable
OFFSET_DEFAULT = 10
FAQs
A base hapi configuration for my new API projects
We found that base-hapi 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.