RepositoryTypeScriptTRTürkiye
onury

onury/accesscontrol

Role and Attribute based Access Control for Node.js

2.3kstars
182forks
1issues
4views

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: permissions

#1 Repository Của Tuần

1
TINIX TRENDING·Chủ đề: attributes

#1 Repository Của Tuần

1
TINIX TRENDING·Chủ đề: roles

#1 Repository Của Tuần

🔐 RBAC + ABAC mạnh mẽ cho Node.js — AccessControl v3

Một motor phân quyền không chỉ kế thừa (RBAC) mà còn hỗ trợ điều kiện thuộc tính (ABAC), sở hữu bắt buộc và fail-closed checks.

AccessControl là một thư viện TypeScript mạnh mẽ cho Node.js, kết hợp hai mô hình phân quyền phổ biến: Role-Based Access Control (RBAC) và Attribute-Based Access Control (ABAC). Nó cho phép bạn định nghĩa chính sách phân quyền phức tạp thông qua một API chainable, hỗ trợ kế thừa vai trò, điều kiện tùy chỉnh, sở hữu tài nguyên và cơ chế fail-closed để tránh lỗi bảo mật do lỗi phần mềm.

✨ Điểm nổi bật

  • API chainable: ví dụ ac.can(role).createOwn(resource) dễ đọc, dễ viết.
  • Inheritance với deny-overrides: quyền kế thừa từ vai trò cha, nhưng deny luôn thắng.
  • Conditions (.where()): cú pháp biểu thức ABAC khai báo rõ ràng.
  • Enforced ownership: own không chỉ là tên gọa, mà thực sự kiểm tra bản ghi thuộc về người dùng.
  • Custom actions: hỗ trợ hành động tùy chỉnh qua .action() / .do().
  • require() gates: rào cản bắt buộc ở phạm vi toàn cục, danh mục hoặc tài nguyên.
  • Groups & categories (/): cấp quyền hàng loạt an toàn thay thế *.
  • Async checks: hỗ trợ hàm điều kiện tùy chỉnh và kiểm tra bất đồng bộ.
  • Events audit: luồng access để ghi nhận truy cập, cùng change và error.
  • Fail-closed checks: tryCan() không bao giờ ném lỗi; thất bại không bao giờ thành "cho phép".
  • Hardened: an toàn với prototype-pollution, regex ReDoS, thông điệp lỗi được ẩn và mã lỗi ổn định.

💡 Vì sao đáng chú ý

AccessControl không chỉ là một thư viện ACL đơn giản — nó là một motor phân quyền thực sự kết hợp RBAC và ABAC, giúp bạn xây dựng chính sách phức tạp mà vẫn giữ được tính bảo mật. Với tính năng fail-closed và enforced ownership, nó giảm thiểu rủi ro lỗ hổng phân quyền do lỗi cấu hình hoặc logic ứng dụng.

Dự án này được kiểm chứng bởi test coverage 100%, mutation testing 88%, cùng các bộ kiểm thử tính huống biên và fuzzing. Được viết bằng TypeScript và phát hành dưới dạng ESM, nó phù hợp cho cả dự án mới và hệ thống doanh nghiệp cần kiểm soát truy cập nghiêm ngặt.


#AccessControl #RBAC #ABAC #NodeJS #Security #Authorization #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
apache/casbin-node-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Node.js and Browser

2.9k
Nov 15, 2026
RepositoryGo
apache/casbin

Apache Casbin: an authorization library that supports access control models like ACL, RBAC, ABAC.

20.5k
Nov 21, 2026
RepositoryGo
Permify/permify

An open-source authorization as a service inspired by Google Zanzibar, designed to build and manage fine-grained and scalable authorization systems for any application. — Permify is now part of FusionAuth 🎉

6.0k
Nov 17, 2026
RepositoryGo
ory/keto

The most scalable and customizable permission server on the market. Fix your slow or broken permission system with Google's proven "Zanzibar" approach. Supports ACL, RBAC, and more. Written in Go, cloud native, headless, API-first. Available as a service on Ory Network and for self-hosters.

5.4k
Sep 4, 2026
RepositoryJava
apache/casbin-jcasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Java

2.7k
Nov 21, 2026
RepositoryPHP
santigarcor/laratrust

Handle roles and permissions in your Laravel application

2.3k
Nov 10, 2026
RepositoryPython
apache/casbin-pycasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Python

1.8k
Nov 22, 2026
RepositoryPHP
php-casbin/php-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC in PHP .

1.3k
Nov 16, 2026
RepositoryPHP
JosephSilber/bouncer

Laravel Eloquent roles and abilities.

3.6k
Mar 18, 2026