
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
hapi-auth-ip-whitelist
Advanced tools
Hapi.js plugin for authentication scheme of accepting connections only from certain IPs
Only accept calls from localhost:
server.auth.strategy('localhost', 'ip-whitelist', ['127.0.0.1']);
NOTE: Third parameter of server.auth.strategy is options which must be an object.
To be used like
server.route({
method: 'GET',
path: '/',
handler(request, h) { return "That was from localhost!" },
options: { auth: 'localhost' }
});
In the route receives a request from a different IP, it will respond a 401 unauthorized
error with the message 192.168.0.102 is not a valid IP
, where 192.168.0.102
is the IP of the request.
You can also specify several IPs by passing a list instead. CIDR notation is supported.
For example, consider the IPs to expect requests from, as specified by MercadoPago.
server.auth.strategy(
'mercado-pago-webhook',
'ip-whitelist',
['209.225.49.0/24', '216.33.197.0/24', '216.33.196.0/24', '63.128.82.0/24', '63.128.83.0/24', '63.128.94.0/24']
);
In case you are behind a proxy, use Hapi plugin therealyou
.
It will find the "real" IP in X-Forward headers and modify the request.info.remoteAddress.
server.register([
{
plugin: require('therealyou')
},
{
plugin: require('hapi-auth-ip-whitelist')
}
])
Start local example server with
npm start
then visit http://localhost:3000.
Successfully authenticated request http://localhost:3000/authenticated. Unauthenticated request http://localhost:3000/unauthenticated.
FAQs
Hapi.js plugin for authentication scheme of accepting connections only from certain IPs
The npm package hapi-auth-ip-whitelist receives a total of 166 weekly downloads. As such, hapi-auth-ip-whitelist popularity was classified as not popular.
We found that hapi-auth-ip-whitelist 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
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.