
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
@webgap/authorization-utils
Advanced tools
WebGAP authorization module for express routes using Role-based Access Control - RBAC.
This is the Authorization utilities module for express routes using Role-based Access Control - RBAC.
Handles notifications using @webgap/notifier.
Requires passport.
Requires express.
npm install @webgap/authorization-utils --save
It can be used as expressjs middleware:
var Authorizator = require('@webgap/authorization-utils');
var authorizator = new Autorizator();
var Role = Authorizator.Role;
...
// set authorization required to all routes starting with
app.use('/admin', authorizator.isAuthorized([Role.ADMIN]));
app.use('/user', authorizator.isAuthorized([Role.USER]));
app.use('/provider', authorizator.isAuthorized([Role.PROVIDER]));
...
// or apply to individual troutes
app.router.get('/account/settings', authorizator.isAuthorized([Role.USER]), function (req, res) {
res.render('backend/account/settings.html');
});
...
Or in the browser with a templating engine as a filter:
<% if (authorizator.hasAccess(user, [authorizator.Role.ADMIN])) { %>
<span>Welcome Administrator!</span>
<% } %>
...
Check the tests for more info.
var Authorizator = require('@webgap/authorization-utils');
var options = {
notifier: { // default to @webgap/notifier module
notify: function notify(options, callback) {
console.log(options.notification); //render message as you want
return callback();
}
},
unauthorizedURL: '/unauthorized',
loginURL: '/auth/login',
unauthenticatedMessageKey: 'messages.warning.authentication-required',
unauthorizedMessageKey: 'messages.error.authorization-required'
};
...
var authorizator = new Authorizator(options);
...
Apache License, Version 2.0
FAQs
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
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.