Esta página solo está disponible en inglés.
Authorization with RBAC and ReBAC
Pathrule4 reglas • 2 memorias • 1 skill
Application authorization decides whether an authenticated principal may perform one action on one resource in one context. This bundle defines a deny-by-default decision boundary, object-level checks, role and relationship modeling, policy evolution, and adversarial tests. Unlike Auth Sessions, JWT, and OAuth, it starts after identity is known; unlike IAM and Least Privilege, it governs application resources rather than cloud administration.
Mapa de rutas sugerido
Pathrule coloca cada pieza en la ruta que le corresponde, para que tu asistente solo la vea donde tiene sentido. Esta es la vinculación a rutas que obtienes al importarlo; puedes ajustarla en tu espacio de trabajo.
Reglas
4Every protected operation asks one deny-first decision API/src/authorizationaltaestrictaHandlers call a central decision boundary with principal, action, resource, tenant, and trusted context before side effects begin.
| 1 | Authorization is a server-side precondition for every protected read and write, not a UI feature or a role-name convention. Route handlers, jobs, GraphQL resolvers, batch actions, and internal tools call one decision interface with the authenticated principal, canonical action, loaded resource, trusted tenant, and current policy context. Any missing input, evaluation error, or unknown action denies. |
| 2 | |
| 3 | - Resolve principal and tenant from authenticated server state, never from an unverified request field. |
| 4 | - Name actions from business capabilities such as invoice.approve rather than HTTP verbs or screen names. |
| 5 | - Return a stable allow or deny result with policy version and reason code, without leaking sensitive relationship data. |
| 6 | - Complete authorization before writes, external calls, queues, or protected response bytes. |
| 7 | |
| 8 | Verification: Remove each input, use an unknown action, inject an evaluator failure, and call the same operation through every transport; confirm all paths deny consistently. |
Memorias
2Roles, attributes, and relationships solve different dimensions/src/authorizationRBAC groups stable job capabilities, ABAC adds trusted context, and ReBAC expresses resource relationships such as owner, member, parent, or viewer.
| 1 | Use roles for stable bundles of capabilities, not for every team, customer, document, or exception. Use trusted attributes for contextual conditions such as account status, region, data classification, or approved time window. Use relationships when access depends on how a principal connects to a resource through ownership, membership, hierarchy, delegation, or sharing. Complex applications usually combine these dimensions behind one decision API. |
| 2 | |
| 3 | Do not copy relationship facts into ever-growing role names or accept authorization attributes from the client. Define tuple or relation ownership, cardinality, inheritance, cycle behavior, and deletion semantics. Keep policy readable enough that product and security owners can review the intended matrix. See /src/domain for canonical resource loading and /tests/authorization for edge coverage. |
Skills
1Por qué este patrón
Agents scatter role-name checks through handlers, trust tenant or owner ids from requests, and authorize list pages while missing the individual object mutation path.
Pensado para Teams building multi-user or multi-tenant applications with role, attribute, ownership, group, hierarchy, or sharing permissions.
Evita que tu asistente caiga en:
- Authenticated users accessing another tenant's object by changing an id
- Role strings becoming an unreviewable substitute for resource policy
- Stale authorization caches preserving access after a relationship changes
- Licencia
- Apache-2.0
- Versión
- 1.0.0
- Actualizado
- 2026-08-25