authz-models-architect
Architect-level authorization modelling — choosing RBAC, ABAC or ReBAC for a domain, where policy is evaluated, relationship and tenant modelling, and the enforcement points that stop privilege escalation across a product. Use when permissions outgrow a boolean on the user row.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- authz-models-architect
- license
- MIT
- metadata
- { "crusor-path": "website-architect/security-architect/authz-models-architect", "crusor-domain": "website-architect", "crusor-origin": "original", "crusor-sources": "owasp.org/www-project-authorization-cheat-sheet; openpolicyagent.org/docs; docs.cerbos.dev", "crusor-triggers": "rbac, abac, rebac, permissions, roles, policy, fine grained authorization, multi tenant, privilege escalation", "crusor-verified-on": "2026-10-30" }
- description
- Architect-level authorization modelling — choosing RBAC, ABAC or ReBAC for a domain, where policy is evaluated, relationship and tenant modelling, and the enforcement points that stop privilege escalation across a product. Use when permissions outgrow a boolean on the user row.
- compatibility
- Framework-agnostic; policy engines (OPA/Cedar) optional
03 SKILL.md 正文
Authorization Models Architect
Authorization is a model of the business, not a table of booleans. Pick the model the domain actually has, or every new feature becomes a permission patch.
When to use
- Roles are multiplying, or "can this user do X" is answered in five places.
- Adding teams, sharing, orgs, or multi-tenancy.
- An authorization bug let someone see another tenant's data.
When NOT to use
- A two-role internal tool — one enum and a guard is enough, and the model below is over-engineering.
Decision 1 — Choose the model
| Domain shape | Model |
|---|---|
| few global roles (admin, staff, customer) | RBAC |
| rules over attributes (plan, region, clearance, time) | ABAC |
| sharing and nested resources (docs, folders, teams) | ReBAC (Zanzibar-style) |
| per-resource custom permissions | ACL with an owner |
- Mixed domains exist: RBAC for the admin surface, ReBAC for customer content is normal — document which applies where.
- Roles grant capabilities, never specific records. "editor of document 42" is a relationship, not a role.
Decision 2 — Where policy is evaluated
edge/authn → who is this? (session/token)
service → may this subject do this action on this resource?
data → tenant/row scoping as a second net (RLS, query filters)
- The service layer is where the business rule lives; the database scoping is a backstop, not the only control.
- Centralise the check in one function/policy module per domain; scattered
if (user.role === 'admin')is how holes appear. - Deny by default; unknown action or resource → deny.
Decision 3 — Object-level checks
- Every access is
(subject, action, resource)— all three, never just the subject. - Fetch the resource with tenant/owner scoping in the query itself
(
WHERE tenant_id = $1 AND id = $2), so "not found" and "not yours" are the same answer. - List endpoints filter by the same rule as detail endpoints — the classic leak is a detail check that the list forgets.
- Batch/bulk operations check each item, not just the request.
Decision 4 — Modelling relationships
- Store edges explicitly (memberships, shares) with their own attributes (role on that resource, expiry).
- Denormalised permission caches must have a rebuild path and an invalidation event.
- Explicit deny beats allow; delegation has a scope and an expiry.
- Superadmin is a break-glass path: audited, time-boxed, never a normal role.
Decision 5 — Policy as code
- Policy files (OPA/Cedar/your own DSL) live in the repo, are tested like code, and are reviewed by whoever owns the domain.
- A policy test suite covers: allowed cases, denied cases, cross-tenant cases.
- Policy changes ship with a decision log entry, not silently.
Failure modes at scale
- Role explosion: 60 roles because teams needed slightly different access.
- Authorization in the UI plus a middleware that only checks "logged in".
- Detail endpoint scoped, list endpoint not.
- Tenant id read from the request body.
- Permission cache never invalidated after a role change.
Verification receipts
- Model documented: which domain uses RBAC/ABAC/ReBAC and why.
- Authorization matrix test per resource × action × subject class.
- Cross-tenant test on list and detail endpoints.
- Policy test suite run in CI.
- Audit trail for privileged and denied actions.
04 同仓库更多 Skills
interaction-patterns-architect
Architect-level interaction design in code — choosing established patterns over invented ones, feedback and latency behaviour, destructive-action safeguards, navigation and overlay conventions, and the state model behind every interactive surface. Use when a screen has to behave, not just look.
design-system-ops-architect
Architect-level operation of a design system in code — token pipelines and versioning, component API and variant policy, the catalogue as the contract, adoption metrics, and the governance that stops a system from forking into three. Use when a component library must survive several teams.
design-handoff-architect
Architect-level design handoff — what must be specified before implementation starts, tokens over raw values, responsive and content-limit contracts, state matrices, and the review loop that catches drift between design and code. Use when a design is about to become code.
content-microcopy-architect
Architect-level UI content — where strings live, voice and terminology consistency, error and empty-state copy as part of the interface, translation-ready authoring, and the content model a product needs before it multiplies screens. Use when the words in the interface matter as much as the pixels.
ui-ux-implementation-architect
Architect-level direction for turning a design into working UI — the handoff contract, component ownership versus screen-level layout, interaction and state conventions, design QA gates, and the review habits that keep an implementation faithful without frozen pixels. Use before any specific UI implementation skill.
test-strategy-architect
Architect-level test strategy — allocating assertions across unit, integration, contract and end-to-end layers, designing for testability through dependency boundaries, fixture and data strategy, and the flake and coverage policies that keep a suite trustworthy. Use when defining how a codebase is tested.