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

@vonage/acl-express

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/acl-express - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

17

lib/acl.js

@@ -120,3 +120,3 @@ const fs = require('fs');

*/
function findRule(rules, url, prefix) {
function findRule(rules, url, method, prefix) {
for (let rule of rules) {

@@ -131,3 +131,3 @@ let route = rule.route;

if (rule.subroutes && rule.route !== '*') {
let res = findRule(rule.subroutes, url, route);
let res = findRule(rule.subroutes, url, method, route);

@@ -138,3 +138,3 @@ if (res) {

}
if (matchURL(url, route)) {
if (matchURL(url, route) && checkRule(method, rule)) {
return rule;

@@ -151,4 +151,4 @@ }

*/
function checkRule(req, rule) {
if (rule.methods === '*' || rule.methods.indexOf(req.method) > -1) {
function checkRule(method, rule) {
if (rule.methods === '*' || rule.methods.indexOf(method) > -1) {
if (rule.action === 'allow') {

@@ -187,3 +187,3 @@ return true;

if (rules) {
rule = findRule(rules, url);
rule = findRule(rules, url, req.method);
debug(rule);

@@ -199,7 +199,2 @@ }

if (!checkRule(req, rule)) {
next(new UnauthorizedError());
return;
}
next();

@@ -206,0 +201,0 @@ }

{
"name": "@vonage/acl-express",
"version": "0.0.3",
"version": "0.0.4",
"description": "An access control middleware for Express",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -77,8 +77,5 @@ const fs = require('fs');

next = sinon.spy();
});
beforeEach(function() {
acl = require('../../lib');
acl.config({
path: 'test/resources/rules.json',
path: 'test/resources/rules.json'
});

@@ -85,0 +82,0 @@ });

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