Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@vonage/acl-express
Advanced tools
A stateless access control middleware for Express servers
Install using npm
:
$ npm install @vonage/acl-express
then in your project require the package:
const acl = require('@vonage/acl-express');
lastly, you must configure the module for it to work:
acl.config({...});
You must supply a configuration object to the module for it to work.
You can use the following configurations:
Property | Required | Type | Description |
---|---|---|---|
path | true | string | This is the path for your rules file |
roleObjectKey | false | string | The name of the user object on the express request object which holds the role field Default Value: user |
defaultRole | false | string | This is the role that will be given to users which do not have a role set for them. |
Example:
acl.config({
path: 'path/to/rule/list',
roleObjectKey: 'myUser',
defaultRole: 'guest'
});
You have to supply a rule file to the module which is built in the following way:
Basic Example:
{
"guest": [
{
"route": "/public",
"methods": [
"GET"
],
"action": "allow"
},
{
"route": "/private",
"methods": "*",
"action": "deny"
}
],
"admin": [
{
"route": "*",
"methods": "*",
"action": "allow"
}
]
}
As seen in the example above, every rule will hold the following fields:
Field | Type | Description |
---|---|---|
route | string | The path for the rule to be applied on |
methods | string or array | An array of HTTP methods to apply this rule on, or * for all methods |
action | string | The action to apply for all requests this rule applies for. Values must be allow or deny |
You can use the Express styled url parameters in your path, i.e.: /path/with/:param
Every rule can have another field which is called subroutes
. this is another array of rules which will allow you a more granular control over which routes to allow and deny access to according to your logic.
Example:
{
"guest": [
{
"path": "/api",
"method": "*",
"action": "allow",
"subroutes": [
{
"path": "/public", // Translates to /api/public
"method": ["GET"],
"action": "allow"
},
{
"path": "/private", // Translates to /api/private
"method": "*",
"action": "deny"
}
]
}
]
}
See the LICENSE file for license rights and limitations (Apache License, Version 2.0)
FAQs
An access control middleware for Express
The npm package @vonage/acl-express receives a total of 1 weekly downloads. As such, @vonage/acl-express popularity was classified as not popular.
We found that @vonage/acl-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.