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.
$ npm i egg-rbac --save
egg-rbac version | egg version |
---|---|
0.3.0 | 1.x |
0.4.0 | 2.0.0 |
From 0.4.0 version egg-rbac does not support egg 1.x.
// {app_root}/config/plugin.js
exports.rbac = {
enable: true,
package: 'egg-rbac',
};
config getRoleName
// {app_root}/config/config.default.js
exports.rbac = {
/**
* @param {object} ctx - egg context object
* @return {object} promise, if resolve data is falsy, no role
*/
* getRoleName(ctx) {
return Promise.resolve('');
},
};
Initialize roles and permissions
// {app_root/config/rbac.js}
'use strict';
exports.permissions = [
// action_resource
// { name: 'create_user', alias: '创建用户' },
// { name: 'delete_user', alias: '删除用户' },
// { name: 'query_user', alias: '查询用户' },
// { name: 'edit_user', alias: '修改用户' },
];
exports.roles = [
// { name: 'admin', alias: '管理员', grants: exports.permissions.map(item => item.name) },
];
see config/config.unittest.js for more detail.
FAQs
Role Based Access Control for eggjs
We found that egg-rbac 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.