{"id":21035257,"url":"https://github.com/skellla/fast-rbac","last_synced_at":"2025-10-09T12:35:00.609Z","repository":{"id":34914036,"uuid":"189604322","full_name":"SkeLLLa/fast-rbac","owner":"SkeLLLa","description":"Fast RBAC implementation for node.js and browsers.","archived":false,"fork":false,"pushed_at":"2023-07-18T20:01:20.000Z","size":941,"stargazers_count":23,"open_issues_count":13,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T21:27:32.300Z","etag":null,"topics":["acl","authorization","javascript","nodejs","rbac"],"latest_commit_sha":null,"homepage":"https://www.comebackalive.in.ua/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SkeLLLa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-31T14:07:55.000Z","updated_at":"2025-09-27T15:14:28.000Z","dependencies_parsed_at":"2024-06-19T00:18:26.241Z","dependency_job_id":"18cd07d9-3c85-44d5-8cc5-eee6fa1d9306","html_url":"https://github.com/SkeLLLa/fast-rbac","commit_stats":{"total_commits":75,"total_committers":5,"mean_commits":15.0,"dds":"0.19999999999999996","last_synced_commit":"3073f4bceb1a9534592be2f83bfc43ed721d6b1c"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/SkeLLLa/fast-rbac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkeLLLa%2Ffast-rbac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkeLLLa%2Ffast-rbac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkeLLLa%2Ffast-rbac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkeLLLa%2Ffast-rbac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SkeLLLa","download_url":"https://codeload.github.com/SkeLLLa/fast-rbac/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SkeLLLa%2Ffast-rbac/sbom","scorecard":{"id":130707,"data":{"date":"2025-08-11","repo":{"name":"github.com/SkeLLLa/fast-rbac","commit":"3073f4bceb1a9534592be2f83bfc43ed721d6b1c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/release-next.yml:1","Warn: no topLevel permission defined: .github/workflows/release-stable.yml:1","Warn: no topLevel permission defined: .github/workflows/verify-pr.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":5,"reason":"dependency not pinned by hash detected -- score normalized to 5","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-next.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-next.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-next.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-next.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-next.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-next.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-next.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-next.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-next.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-next.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-stable.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-stable.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-stable.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-stable.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-stable.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-stable.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-stable.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-stable.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-stable.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/release-stable.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/verify-pr.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/verify-pr.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/verify-pr.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/verify-pr.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/verify-pr.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/verify-pr.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/verify-pr.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/SkeLLLa/fast-rbac/verify-pr.yml/master?enable=pin","Info:   0 out of  17 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   7 out of   7 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T05:12:34.067Z","repository_id":34914036,"created_at":"2025-08-16T05:12:34.067Z","updated_at":"2025-08-16T05:12:34.067Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001435,"owners_count":26083078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acl","authorization","javascript","nodejs","rbac"],"created_at":"2024-11-19T13:14:22.043Z","updated_at":"2025-10-09T12:35:00.585Z","avatar_url":"https://github.com/SkeLLLa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-rbac\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://gitlab.com/m03geek/fast-rbac/raw/master/rbac.logo.svg\" width=\"300\" height=\"auto\"/\u003e\n\n[![NPM Version](https://img.shields.io/npm/v/fast-rbac.svg)](https://www.npmjs.com/package/fast-rbac)\n[![Downloads Count](https://img.shields.io/npm/dm/fast-rbac.svg)](https://www.npmjs.com/package/fast-rbac)\n[![Vunerabilities Count](https://snyk.io/test/npm/fast-rbac/badge.svg)](https://www.npmjs.com/package/fast-rbac)\n[![Build Status](https://github.com/SkeLLLa/fast-rbac/workflows/build/badge.svg)](https://github.com/SkeLLLa/fast-rbac/commits/master)\n[![License](https://img.shields.io/npm/l/fast-rbac.svg)](https://gitlab.com/m03geek/fast-rbac/blob/master/LICENSE)\n[![Codecov Coverage](https://codecov.io/gh/SkeLLLa/fast-rbac/branch/master/graph/badge.svg?token=wLjMou8TT7)](https://codecov.io/gh/SkeLLLa/fast-rbac)\n[![LGTM Alerts](https://img.shields.io/lgtm/alerts/github/SkeLLLa/fast-rbac.svg)](https://lgtm.com/projects/g/SkeLLLa/fast-rbac/)\n[![LGTM Grade](https://img.shields.io/lgtm/grade/javascript/github/SkeLLLa/fast-rbac.svg)](https://lgtm.com/projects/g/SkeLLLa/fast-rbac/)\n\n\u003c!-- [![Coverage Status](https://gitlab.com/m03geek/fast-rbac/badges/master/coverage.svg)](https://gitlab.com/m03geek/fast-rbac/commits/master) --\u003e\n\u003c/div\u003e\n\nImplementation of RBAC module tuned to be fast\n\nMain rules:\n\n- No RegEx\n- O(1) time complexity for checking rules\n- Wildcard and inherited rules caching\n- No foolproof checks (use docs, jsdoc, types and implement those checks on your side if necessary)\n- Zero dependency\n\n## ToC\n\n- [fast-rbac](#fast-rbac)\n  - [ToC](#toc)\n  - [Installation](#installation)\n  - [Features and requirements](#features-and-requirements)\n    - [Browser support](#browser-support)\n    - [Benchmark results](#benchmark-results)\n  - [Usage](#usage)\n  - [ToDo List](#todo-list)\n  - [Docs](#docs)\n  - [Changelog](#changelog)\n  - [Repos info](#repos-info)\n  - [See also](#see-also)\n  - [License](#license)\n\n## Installation\n\n```sh\nnpm i fast-rbac --save\n```\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Features and requirements\n\n- Wildcard rules support\n- Inheritance support\n- Typescript support\n- Prebuilt browser amd and system modules\n- It's fast\n\n---\n\n- Node.js `\u003e=8.0.0`.\n\n### Browser support\n\nFor using this lib in browser it provides three options:\n\n- AMD-style: `dist/browser/rbac.bundle.amd.js`\n- System-style: `dist/browser/rbac.bundle.amd.js`\n- ES6: `dist/browser/index.js` (`module` property is set for using with rollup and webpack)\n- IIFE: `dist/browser/rbac.bundle.js` and `dist/browser/rbac.bundle.min.js` (not tested, it may not work properly)\n\n### Benchmark results\n\nSo how fast is it? Here are results from simple benchmark with 3 roles.\n\n```\n@rbac/rbac x 46,003 ops/sec ±0.48% (87 runs sampled)\nrbac:no_wildcard_support x 95,564 ops/sec ±1.55% (84 runs sampled)\neasy-rbac x 45,884 ops/sec ±0.74% (89 runs sampled)\nfast-rbac x 1,516,366 ops/sec ±0.38% (97 runs sampled)\nfast-rbac:defer x 1,037,149 ops/sec ±0.71% (86 runs sampled)\n```\n\nBenchmark code is available in `benchmark` directory.\n\nFor more details refer to [benchmark doc](benchmark/BENCHMARK.md).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Usage\n\n** NOTE **: No cyclic roles inheritance. You've been warned.\n\n`can` method returns `boolean` if 3 arguments are passed to it.\nIt could return `Promise` if rule has `when` function and `context` is passed.\nEven if your `when` function doesn't consume any arguments you need to pass context (e.g. `null` or `{}`) in order to execute it.\nWhithout `context` the function `when` will be not executed and `can` will return `true`.\n\n```js\nimport RBAC from 'fast-rbac';\n// or\n// const {RBAC} = require('fast-rbac');\n// or\n// const RBAC = require('fast-rbac').default;\n\nconst a = new RBAC({\n  roles: {\n    user: { can: ['cat:create', 'dog:*', { name: 'foo', operation: 'read' }] },\n    prouser: { can: ['cat:update'], inherits: ['user', 'reader'] },\n    admin: { can: ['*'] },\n    reader: { can: ['*:read'], inherits: ['anon'] },\n    anon: {\n      can: [\n        {\n          name: '*:read',\n          when: (ctx) =\u003e {\n            const result: Promise\u003cboolean\u003e = new Promise((resolve) =\u003e {\n              resolve(ctx.color === 'red');\n            });\n            return result;\n          },\n        },\n      ],\n    },\n  },\n});\n\n\nconsole.log(a.can('user', 'dog', 'read')); // true\n\n(async () =\u003e {\n  console.log(await a.can('anon', 'cat', 'read', { color: 'red' })); // true\n})();\n\na.add('someone', 'something', 'read');\nconsole.log(a.can('someone', 'something', 'read')); // true\nconsole.log(a.can('someone', 'something', 'write')); // false\na.remove('someone', 'something', 'read');\nconsole.log(a.can('someone', 'something', 'read')); // false\n```\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## ToDo List\n\nPRs welcome!\n\n- [x] Add/delete roles in runtime\n- [x] Add some unit tests\n- [ ] Add possibility to add/delete roles inherits\n- [ ] Deal with circular role inheritance (but I'm totally ok with callstack error)\n\n## Docs\n\nSee [docs](docs/README.md).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Changelog\n\nSee [changelog](CHANGELOG.md).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## Repos info\n\n- **Main** https://gitlab.com/m03geek/fast-rbac - preferred place for issues and PRs\n- **Mirror** https://github.com/SkeLLLa/fast-rbac - only PRs accepted\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## See also\n\n- [rbac](https://www.npmjs.com/package/rbac)\n- [@rbac/rbac](https://www.npmjs.com/package/@rbac/rbac)\n- [easy-rbac](https://www.npmjs.com/package/easy-rbac)\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n\n## License\n\nLicensed under [MIT](./LICENSE).\n\n\u003csub\u003e[Back to top](#toc)\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskellla%2Ffast-rbac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskellla%2Ffast-rbac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskellla%2Ffast-rbac/lists"}