Socket
Book a DemoInstallSign in
Socket

@algolia/dns-filter

Package Overview
Dependencies
Maintainers
66
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/dns-filter

A small utility library to test whether requests try to access predefined IPs

latest
Source
npmnpm
Version
1.1.25
Version published
Maintainers
66
Created
Source

dns-filter

A small utility library to test whether requests try to access predefined IPs

WARNING This project is not an officially maintained Algolia project. This repository should not be used for any production project. Bug reports and feature requests will most likely be ignored.

Usage

const { validateURL, NetworkError, PRIVATE_IP_PREFIXES } = require('@algolia/dns-filter');

const restricted = process.env.NODE_ENV === 'development'
  ? [] // allow everything in dev
  : PRIVATE_IP_PREFIXES; // no private IPs otherwise

const url = 'http://localhost/admin';
try {
  await validateURL({
    url,
    ipPrefixes: restricted,
    context: { some: 'metadata' },
  });
}
catch (err) {
  log.error(err); // log error
  throw new NetworkError(); // throw generic error
}

Contributing

To release this package, wait for semantic-release to finish, then:

  • Make sure you're logged in with npm login
  • Run:
yarn build
yarn publish

FAQs

Package last updated on 25 Jan 2022

Did you know?

Socket

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.

Install

Related posts