Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-access

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-access

Access controls (ACLs) by location as a Connect middleware

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

connect-access

Access controls (ACLs) by location as a Connect middleware. Inspired by nginx's http_access_module.

Installation

$ npm install connect-access

Basic Usage

access(String path, Array rules)
var access = require('connect-access');

var rules = [
    '192.168.1.1',  // Allow 192.168.1.1
    '10.0.0.0/8',   // Allow entire 10.0.0.0/8 range
    '127.0.0.1',    // Allow localhost
    '-all',         // block everyone else
];

var app = connect()
  .use(access('/private/*', rules))  // Lock down all of /private/* to the ACLs we declared
  .use(function(req, res, next) {
    res.end('Hello world');
  });

ACLs

There are 2 ways to declare a list of acls.

  • Explicitly allow an IP/CIDR
  • Explicitly disallow an IP/CIDR

To allow or disallow, the ip rule is prefixed with a + or -. If no qualifier is specified, it's assumed to allow.

Rules are executed first to last and ends when the first rule is matched. If no match is found, assumes allow everything.

Example Rules

'all'          // Allow everything
'127.0.0.1'    // Allow just 127.0.0.1
'10.0.0.0/8'   // Allow a CIDR range
'-127.0.0.1'   // Disallow 127.0.0.1
'-10.0.0.0/8'  // Disallow a CIDR range
'-all'         // Disallow everything

Keywords

FAQs

Package last updated on 20 Apr 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc