Node.js package with a customized HTTP and HTTPS agents to prevent SSRF with hosts validations and custom DNS feature.

Overview

http-agent-dns

This is a Node.js package with a customized HTTP and HTTPS agents to prevent SSRF with hosts validations with a possibility to use a custom DNS to prevent DNS rebinding. Another use of this package is creating a http-agent changing the DNS in some specifics requests in module or function level.

Inspired by ssrf-agent.

Minimum Node version required: >=12.*

Install

From NPM

//TODO: deploy the package in npm official repository

From Github Registry

In order to install the package from Github Registry, you need to setup your npm to use the Github Registry.

$ npm login --scope=@egermano --registry=https://npm.pkg.github.com

> Username: USERNAME
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS

For more information, please visit Working with Github Packages Registry

Install the package:

npm add @egermano/http-agent-dns

Usage

Axios example

const httpAgent = require('http-agent');
const axios - require('axios');

const url = 'https://egermano.com';

const response = await axios.get(url, {
    httpAgent: httpAgent(url),
    httpsAgent: httpAgent(url),
});

With custom DNS

const httpAgent = require('http-agent');
const axios - require('axios');

const url = 'https://egermano.com';
const options = {
    dnsServers: ['8.8.8.8', '1.1.1.1'],
};

const response = await axios.get(url, {
    httpAgent: httpAgent(url, options),
    httpsAgent: httpAgent(url, options),
});

request example

warning: request package was deprecated, but this example works.

const httpAgent = require('http-agent');
const request - require('request');

const url = 'https://egermano.com';

request.get({
    url,
    agent: httpAgent(url),
    (error, response) => {
        // do something
    }
});

With custom DNS

const httpAgent = require('http-agent');
const request - require('request');

const url = 'https://egermano.com';
const options = {
    dnsServers: ['8.8.8.8', '1.1.1.1'],
};

request.get({
    url,
    agent: httpAgent(url, options),
    (error, response) => {
        // do something
    }
});

Other documentations

You might also like...

DNS-Blocklists: For a better internet - keep the internet clean!

DNS-Blocklists: For a better internet - keep the internet clean!

DNS Blocklists - For a better internet! Multi - Cleans the Internet and protects your privacy! An all in one blocklist based on the OISD blocklist, ba

Jan 2, 2023

The Remix version of the fakebooks app demonstrated on https://remix.run. Check out the CRA version: https://github.com/kentcdodds/fakebooks-cra

Remix Fakebooks App This is a (very) simple implementation of the fakebooks mock app demonstrated on remix.run. There is no database, but there is an

Dec 22, 2022

nest연습용 (w. https://github.com/seuiggi, https://github.com/okysky1121)

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Oct 5, 2022

Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

Mar 29, 2022

A set of APIs for handling HTTP and HTTPS requests with Deno 🐿️ 🦕

oak commons A set of APIs that are common to HTTP/HTTPS servers. HTTP Methods (/method.ts) A set of APIs for dealing with HTTP methods. Content Negoti

May 23, 2022

Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, CloudWatch Alarms and other Route53 HealthChecks

Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, CloudWatch Alarms and other Route53 HealthChecks

AWS CDK Route53 HealthCheck Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, to monitor CloudWatch Alarms and to monitor other Route

Dec 15, 2022

A package to enable feature-flag support on Next.js via cookies and environment variables

next-feature-flags Add support for feature flags on Next.js based on cookies + environment variables. How it works It reads from cookies and Next.js's

Aug 10, 2022

📡Usagi-http-interaction: A library for interacting with Http Interaction API

📡 - A library for interacting with Http Interaction API (API for receiving interactions.)

Oct 24, 2022

Zero dependencies, lightweight, and asynchronous https requests package.

Zero dependencies, lightweight, and asynchronous https requests package.

This project is a Work in Progress and currently in development. The API is subject to change without warning. A small fetching package for super simp

Dec 8, 2022
Releases(v0.1.1-alpha)
  • v0.1.1-alpha(Jun 21, 2022)

    Fixing package information to fix the publish process.

    Full Changelog: https://github.com/egermano/http-agent-dns/compare/0.1.0...v0.1.1-alpha

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Jun 21, 2022)

    What's Changed

    • Fix the github package publish by @egermano in https://github.com/egermano/http-agent-dns/pull/8

    Full Changelog: https://github.com/egermano/http-agent-dns/compare/0.1.0...v0.1.1

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jun 21, 2022)

    [0.1.0] - 2022-06-20

    • inital release

    Added

    • custom HTTP and HTTPS agent library
    • custom DNS support
    • unit tests
    • Code of Conduct
    • Collaboration and Contributing documentation
    • License: GNU General Public License v3.0
    • Issues template
    Source code(tar.gz)
    Source code(zip)
Owner
Bruno Germano
Handsome & Cool
Bruno Germano
LunaSec - Open Source Security Software built by Security Engineers. Scan your dependencies for Log4Shell, or add Data Tokenization to prevent data leaks. Try our live Tokenizer demo: https://app.lunasec.dev

Our Software We're a team of Security Engineers on a mission to make awesome Open Source Application Security tooling. It all lives in this repo. Here

LunaSec 1.2k Jan 7, 2023
A modern, clean design can be customized and applied for a wide range of purposes

Gatsby starter for projects portfolio with Flotiq source Kick off your project with this hello-world boilerplate. This starter ships with the main Gat

flotiq 13 Oct 4, 2022
Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 html editor packed with useful plugins.

CKEditor 5 for Strapi Replaces the default Strapi WYSIWYG editor with a customized build of CKEditor 5 packed with useful plugins. ?? Get Started Feat

null 39 Jan 2, 2023
Social media platform that hosts community-driven challenges where everyone can play and compete

Komo A social media platform that hosts community-driven challenges where everyone can play and compete. How To Install Komo TBA Preview Home Screen A

null 2 Jun 13, 2022
Kuldeep 2 Jun 21, 2022
Use Cloudflare Gateway DNS/VPN to block ads, malware and tracking domains - free alternative to NextDNS, Pi-hole and Adguard

Cloudflare Gateway Pi-hole Scripts (CGPS) Cloudflare Gateway allows you to create custom rules to filter HTTP, DNS, and network traffic based on your

null 70 Aug 13, 2023
Convert your SVG file directly to Flutter paths and prevent all the messing with bezier curves.

svg-to-flutter-path-converter Convert your SVG file directly to Flutter paths and prevent all the messing with bezier curves. Flutter Clutter The tool

null 30 Jan 2, 2023
Make text fit container, prevent overflow and underflow.

AutoTextSize Make text fit container, prevent overflow and underflow. The font size of the text is adjusted so that it precisely fills its container.

Sana Labs 10 Dec 30, 2022
Cloudflare DDNS (Dynamic DNS) support for UniFi OS

Cloudflare DDNS for UniFi OS A Cloudflare Worker script that exposes a UniFi-compatible DDNS API to dynamically update the IP address of a DNS A recor

William Walker 210 Jan 1, 2023
Statically prevent 404s in your Next.js applications using TypeScript

next-static-paths Statically prevent HTTP 404 Not Found in your Next.js applications using TypeScript and code generation. Features ?? A command-line

Gal Schlezinger 23 Jul 3, 2022