New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ocbesbn-bouncer

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocbesbn-bouncer

Express middleware for ACl service and validation

  • 0.2.12
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

BOUNCER

Midldleware for individual nodejs services, takes care of following items

  1. Get permission details from ACL services
  2. validate the incoming calls
  3. supply the acl.json data

Default options

var defaultOptions =
{
    host: 'consul',
    serviceName: '',
    acl: require('./acl.json')
}

Internal dependencies

  • ocbesbn-web-init

Bouncer should be added as a middleware to the ocbesbn-web-init.

Example

import acl json via file


var bouncer = require('ocbesbn-bouncer');
{
  ...
  middlewares: [bouncer({
    host: 'consul',
    serviceName: 'user', //says user service
    acl: require('mypath/acl.json'),
    aclServiceName: 'acl'
  }).Middleware]
  ...
}

import acl json directly

var bouncer = require('ocbesbn-bouncer');
{
  ...
  middlewares: [bouncer({
    host: 'consul',
    serviceName: 'user', //example
    acl: {
      "Health": { `// Key represents resource group Id`
         "translations": { `// Translation for the resource group`
           "name" : { `// Name of the resource group by language`
             "en": "Health check",
             "de": ""
           },
           "description": { `// Short description, explains about the resource group`
             "en": "Health check endpoint used by service checks",
             "de": ""
           }
         },
         "resources": [ `// List of resources`
           {
             "type": "rest", `// Type of the resource, mostly be rest (API endpoints) for now`
             "resourceId": "/api/health/check", `// Regular expression/complete endpoint (route of API endpoint)`
             "actions": ["edit", "read"], `// Actions allowed edit=PUT, read=GET, delete=DELETE, create=POST`
             "fields": ['result', 'more.somefield'] `// defines what are all the fields can be sent to the user/requestor, nested fields can be added like OBJECT.SOMEKEY..`
           }
         ]
       }
      }
    },
    aclServiceName: 'acl'
  }).Middleware]
  ...
  }

Patterns in resource ids

Mostly the resource id is a string or regular expression, along with that, we also a pattern to replace with current user information. For E.g

The below resource Id contains ${_current_user_id}, which represents current user id, means Id of the user who ever is requesting this particular URI / resource.

"resourceId": "/users/${_current_user_id}/profile"

Here are some of the pattern which represents current user's information

${_current_user_id} - current user's id
${_current_tenant_id} - current user's tenant id
${_current_customer_id} - current user's customer id
${_current_supplier_id} - current user's supplier id

FAQs

Package last updated on 26 Feb 2018

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