This project is a high-performance, secure file management showcase. It demonstrates the industry-standard Decoupled Authorization architecture, separating Identity Authentication (Auth0) from Granular Access Control (Cerbos).
link: https://github.com/ChrisXHLeung/jsonManagerment_Cerbos
Solution in detail: https://www.chriscn.cn/decoupled-abac-architecture/
ποΈ System Architecture
The system operates as a Policy Enforcement Point (PEP), delegating all logic to a centralized Policy Decision Point (PDP).
- Identity Layer (OIDC): Auth0 handles user sessions and issues JWTs containing role claims.
- Authorization Layer (ABAC): Cerbos evaluates requests against YAML-defined policies using real-time attributes (time, filename).
- Application Layer (PEP): A Node.js service that manages JSON I/O and enforces the decisions received from Cerbos via gRPC.
π₯ Access Control Logic (ABAC)
Unlike traditional static RBAC, this system uses Attribute-Based Access Control (ABAC) to enforce dynamic rules.
π Global Security Guardrails
- Sensitivity Filter: Any file matching
(?i)sensitivein its name is strictly isolated. No role (including Admin) can delete or modify these files via the standard API path. - Release Filter: The User role is restricted to a “Discovery Mode,” only seeing files tagged with
release.
π Permission Matrix
| Action | User (Observer) | Member (Contributor) | Admin (Superuser) |
|---|---|---|---|
| List & Read | β
release files only |
β All non-sensitive | β Full Access |
| Create | β Denied | β Work Hours OnlyΒΉ | β Full Access |
| Update | β Denied | β Denied | β οΈ Non-sensitive only |
| Delete | β Denied | β Denied | β οΈ Non-sensitive only |
ΒΉ Time Attribute: Member
createactions are restricted to MonβFri, 09:00β17:00 UTC.
π Repository Structure
.
βββ PDP/ # Policy Decision Point (PDP)
β βββ conf.yaml # Cerbos server configuration
β βββ policies/ # ABAC/RBAC logic defined in YAML
βββ PEP/ # Policy Enforcement Point (PEP)
βββ storage/ # Flat-file JSON database
βββ views/ # UI Templates (EJS)
βββ index.js # Express logic & Cerbos gRPC Client
π οΈ Tech Stack Highlights
- Communication: gRPC for ultra-low latency between API and Authorization engine.
- Identity: OpenID Connect (OIDC) flow with PKCE.
- Policy Engine: Cerbos – stateless, scalable, and audit-ready.
- Express Middleware: Custom middleware to bridge JWT claims to Cerbos principal context.