Get started

Authorization

Roles, per-object roles, relationships and conditions in one policy per app, and the four answers a check can return.

Each app has one authorization policy. Your backend asks Scute whether a user may take an action, and Scute answers from the policy. The same engine answers checks for your users and for AI agents acting for them, and logs each decision with a plain-language explanation.

Policy objects#

ObjectWhat it isExample
ResourceA kind of object in your appinvoice
ActionSomething done to a resourcerefund
PermissionA resource and action pair, slug resource:actioninvoice:refund
RoleA named set of permissionsbilling_admin

Permission slugs match [a-z0-9][a-z0-9_\-.:]*. Define these in the dashboard (the app's authorization policy page) or through the API.

Models#

RBAC#

Assign roles to users. An assignment can have an expiry (expiresAt in authzAssignRole(userId, role, { expiresAt })). A user holds every permission of every role assigned to them.

ReBAC#

A role can be held on one object: "Ada is editor of document:42". Assign it with POST /v1/apps/:app_id/authz/instances/:type/:key/roles. Relationship tuples link objects to each other (GET, POST, DELETE /v1/apps/:app_id/authz/relationships), so a role can follow a relationship: an editor of a folder is an editor of the documents in it. A decision on a role held this way includes path, the chain the user came through.

ABAC#

A role's permission can carry a condition on attributes of the user, the resource and the request context. Conditions are JSON:

{ "lt": [{ "var": "resource.amount" }, 5000] }
  • Combinators: all, any, not.
  • Comparisons: eq, ne, lt, lte, gt, gte, in, contains, starts_with, and exists.
  • Operands: literals or { "var": "user.x" }, { "var": "resource.x" }, { "var": "context.x" }.
  • Limits: depth 8, 64 nodes, lists of 100 items, strings of 256 characters. null literals are refused.

Conditions fail closed: a missing attribute never grants access.

Checking a permission#

A check names the user, the action and optionally the resource ("invoice:42", or { type, key, attributes }) and a context object.

curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/check \  -H "Authorization: Bearer $SCUTE_SECRET" \  -H "Content-Type: application/json" \  -d '{"user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "action": "refund", "resource": "invoice:42"}'
EndpointUse
POST /v1/auth/:app_id/authz/checkOne check
POST /v1/auth/:app_id/authz/check-batchUp to 100 checks, answers in order. More returns 422 batch_too_large
GET /v1/auth/:app_id/authz/users/:user_id/permissionsA user's effective permissions
GET /v1/auth/:app_id/authz/authorized-users?action=...Users who may take an action (default limit 100)
POST /v1/auth/:app_id/authz/filterA filter for list queries, so a list returns only rows the user may see

In the browser, scute.authz.can(action, resource?, context?) and canMany(checks) check the signed-in user. They work only when the app turns on client checks (authz_settings.client_checks). The React hooks are useCan and usePermissions.

For decisions without a network call, GET /v1/apps/:app_id/authz/snapshot returns a policy snapshot signed with RS256. ScuteLocalAuthz in @scute/js-core checks against it and falls back to the API for what the snapshot cannot answer.

Answers#

decisionMeaning
allowThe user may act. allowed is true only for this answer.
denyThe user may not act. reason and explanation say why.
allow_with_step_upAllowed after a fresh verification. The answer includes step_up with method, ttl and authorizes_action.
allow_with_approvalAllowed after a reviewer approves this operation. The answer includes approval with the permission and resource.

Step-up answers#

The permission has requires_verification. Start a challenge bound to the permission (authzStartStepUp), let the user complete it, then check again with challenge set to its token. The challenge must be under 10 minutes old and is spent by the check. See MFA and step-up.

Approval answers#

The permission has requires_approval. The user files an operation request (scute.authz.requestAccess({ action, resource, reason })). A reviewer approves or denies it. Your backend then checks again with approval set to the request's ID. An approved request is spent by the first check that answers allow.

Users can also request a role ({ role, resource?, duration?, reason? }). The app must allow access requests in its authorization settings.

Permission flags#

FlagEffect
requires_verificationAnswer allow_with_step_up until a fresh verification
requires_approvalAnswer allow_with_approval until an approved request
autonomous_allowedAn agent may use the permission with no person present
blocked_while_impersonatingDenied while support staff are signed in as the user
requester_onlyThe action may target only the person who asked

All flags default to false. Agents add their own limits on top of these: see AI agents.