このページは英語でのみご覧いただけます。
Authorization with RBAC and ReBAC
Pathruleルール4件 • メモリ2件 • スキル1件
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.
推奨されるパスの配置
Pathruleは各要素を対応するパスに配置するため、アシスタントはそれが属する場所でだけ参照します。これはインポート時に適用されるスコープで、ワークスペースで調整できます。
ルール
4Every protected operation asks one deny-first decision API/src/authorization高強制Handlers 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. |
メモリ
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. |
スキル
1このパターンを使う理由
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.
対象:Teams building multi-user or multi-tenant applications with role, attribute, ownership, group, hierarchy, or sharing permissions
アシスタントが次のことをしないようにします。
- 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
- ライセンス
- Apache-2.0
- バージョン
- 1.0.0
- 更新日
- 2026-08-25