Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
proxy-addr
Advanced tools
The proxy-addr npm package is used to determine the IP address of the client connected to your web server through an HTTP proxy or a load balancer. It provides functionality to derive the client's IP address considering the X-Forwarded-For header and other well-known headers that can be used to indicate the actual client IP address when proxying HTTP requests.
Determine client IP address from request
This feature allows you to get the client's IP address from an incoming HTTP request object, considering the list of addresses specified by the 'trust' parameter.
const proxyaddr = require('proxy-addr');
const requestIp = proxyaddr(req, trust);
Compile trusted address list
This feature compiles an array of trusted addresses into a function, which can then be used to check if a given IP should be trusted.
const proxyaddr = require('proxy-addr');
const trust = proxyaddr.compile(['loopback', 'linklocal', 'uniquelocal']);
Check if an address is trusted
This feature checks if a given IP address is in the list of trusted addresses.
const proxyaddr = require('proxy-addr');
const trust = proxyaddr.compile('10.0.0.1');
const trusted = trust('10.0.0.1');
The 'forwarded' npm package parses the X-Forwarded-For header and returns an array of the addresses. It is similar to proxy-addr but does not provide the same level of control over which addresses are considered trustworthy.
The 'ipware' npm package is designed to retrieve the user's IP address from the incoming request, supporting both IPv4 and IPv6. It offers functionality similar to proxy-addr but with a different API and additional features for IP address detection.
Determine address of proxied request
npm install proxy-addr
var proxyaddr = require('proxy-addr');
Return the address of the request. This returns the furthest-away address.
Return all the addresses of the request. This array is ordered from
closest to furthest (i.e. arr[0] === req.connection.remoteAddress
).
FAQs
Determine address of proxied request
The npm package proxy-addr receives a total of 13,244,038 weekly downloads. As such, proxy-addr popularity was classified as popular.
We found that proxy-addr 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.