Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
forwarded
Advanced tools
Package description
The 'forwarded' npm package is designed to parse the 'X-Forwarded-For' header from an HTTP request, which is a standard header for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer. This package extracts the IP addresses listed in the header and provides them in an array format, making it easier to handle cases where there are multiple proxies in use.
Parse X-Forwarded-For header
This feature allows you to parse the 'X-Forwarded-For' header from an HTTP request object and returns an array of IP addresses that were added by each proxy.
const forwarded = require('forwarded');
const req = { headers: { 'x-forwarded-for': '192.0.2.60, 198.51.100.17' } };
const ips = forwarded(req);
console.log(ips); // ['192.0.2.60', '198.51.100.17']
Similar to 'forwarded', 'proxy-addr' is used to determine the address of the client that connected to the proxy server. It provides more functionality, such as trusting custom IP address ranges and determining the client's IP address from a list of trusted proxies.
While 'ipware' is not limited to Node.js and is also available for Python, it offers similar functionality for getting the client's IP address from the 'X-Forwarded-For' header or other headers like 'X-Real-IP'. It also provides features to customize trusted proxies and private IP ranges.
The 'request-ip' package is another alternative that retrieves the client's IP address from an HTTP request. It supports both IPv4 and IPv6 addresses and works with various headers, including 'X-Forwarded-For'. It is a simple and straightforward package for getting the client's IP address without additional configuration options.
Readme
Parse HTTP X-Forwarded-For header
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
$ npm install forwarded
var forwarded = require('forwarded')
var addresses = forwarded(req)
Parse the X-Forwarded-For
header from the request. Returns an array
of the addresses, including the socket address for the req
, in reverse
order (i.e. index 0
is the socket address and the last index is the
furthest address, typically the end-user).
$ npm test
FAQs
Parse HTTP X-Forwarded-For header
The npm package forwarded receives a total of 21,866,512 weekly downloads. As such, forwarded popularity was classified as popular.
We found that forwarded 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.