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.
The 'caw' npm package is a utility for handling HTTP/HTTPS proxies in Node.js. It simplifies the process of making HTTP requests through proxies, which can be useful for various purposes such as web scraping, testing, and accessing geo-restricted content.
Proxy HTTP Requests
This feature allows you to make HTTP requests through a proxy. The code sample demonstrates how to use 'caw' with the 'got' library to make a request to an API endpoint through a proxy.
const caw = require('caw');
const got = require('got');
(async () => {
const proxy = caw();
const response = await got('https://api.ipify.org?format=json', { agent: { https: proxy } });
console.log(response.body);
})();
Custom Proxy Configuration
This feature allows you to configure custom proxy settings. The code sample shows how to specify a custom proxy server with 'caw' and use it to make an HTTP request.
const caw = require('caw');
const got = require('got');
(async () => {
const proxy = caw({ protocol: 'http', hostname: 'proxy.example.com', port: 8080 });
const response = await got('https://api.ipify.org?format=json', { agent: { https: proxy } });
console.log(response.body);
})();
Automatic Proxy Detection
This feature allows 'caw' to automatically detect and use the system's proxy settings. The code sample demonstrates how to make an HTTP request using the system's proxy configuration.
const caw = require('caw');
const got = require('got');
(async () => {
const proxy = caw();
const response = await got('https://api.ipify.org?format=json', { agent: { https: proxy } });
console.log(response.body);
})();
'proxy-agent' is a similar package that provides a unified API for different types of proxy agents (HTTP, HTTPS, SOCKS, etc.). It is more versatile in terms of the types of proxies it supports compared to 'caw'.
'global-agent' allows you to globally configure HTTP/HTTPS proxies for all HTTP requests in a Node.js application. It is useful for applications that need to enforce proxy usage globally, unlike 'caw' which is used on a per-request basis.
'tunnel' is a package that provides HTTP/HTTPS proxy tunneling. It is more focused on tunneling capabilities and supports various proxy protocols, making it a more specialized tool compared to 'caw'.
Construct HTTP/HTTPS agents for tunneling proxies
$ npm install caw
const caw = require('caw');
const got = require('got');
got('todomvc.com', {
agent: caw()
}, () => {});
Type: string
Proxy URL. If not set, it'll try getting it using get-proxy
.
Type: Object
Besides the options below, you can pass in options allowed in tunnel-agent.
Type: string
Default: http
Endpoint protocol.
MIT © Kevin Mårtensson
FAQs
Construct HTTP/HTTPS agents for tunneling proxies
The npm package caw receives a total of 856,675 weekly downloads. As such, caw popularity was classified as popular.
We found that caw 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.