How a permission check reads a prepared document

By DavidPermissions

A project editor asks to change a brief. To answer that request, the application needs the person's effective access in the brief's project. It could rebuild that answer from memberships, roles and policies each time.

saaslayer Permissions prepares the effective rules when access changes and stores them in DynamoDB. A supported direct reader can fetch the prepared document and evaluate a request locally. That moves work into the paths that maintain the document.

Start with one assignment

Consider a sample project tracker. A person has Project editor in Launch, granting read and edit access to briefs in that workspace. They have no other assignments or grants.

A simplified excerpt of the scoped rule information looks like this. Metadata and other document fields are omitted:

{
  "global": { "allows": [], "denies": [] },
  "scoped": {
    "ws-launch": {
      "allows": [
        {
          "action": "read",
          "resource": "brief/*",
          "service": "projects",
          "roleId": "project-editor"
        },
        {
          "action": "edit",
          "resource": "brief/*",
          "service": "projects",
          "roleId": "project-editor"
        }
      ],
      "denies": []
    }
  }
}

The roles, actions and workspace here belong to the sample application. The excerpt explains evaluation; it is not a document to insert into a service table.

Read the document and evaluate the requested operation

The direct reader looks up the person's PERMISSIONS item under their user key. With a current ordinary document, it can use that one document read to evaluate the requested action, resource, service and scope.

For the simplified example:

ActionResourceScopeResult
Editbrief/brief-launchws-launchAllow
Readbrief/brief-launchws-launchAllow
Exportbrief/brief-launchws-launchRefuse
Editbrief/brief-otherws-otherRefuse

The backend must first verify the caller and load the brief's actual workspace from application data. A scope supplied by the browser cannot establish which project owns the brief. After permission is allowed, the application still validates and performs the edit.

The idea, picturedPrepare permissions separately from checking them.
When access changes01Assignments & policiesAccess inputs change02Build effective accessApply the permission model03Permission documentStored in DynamoDB01Assignments & policiesAccess inputs change02Build effective accessApply the permission model03Permission documentStored in DynamoDB
When the application checks01Requested operationPerson · action · scope02Read current documentDirect DynamoDB read03Evaluate locallyAllow or refuse the request01Requested operationPerson · action · scope02Read current documentDirect DynamoDB read03Evaluate locallyAllow or refuse the request

Conceptual steady-state path. A current materialized document can be read and evaluated locally. Missing or stale data, invalidation, fallback behavior and revocation timing need their own integration checks; this is not a latency benchmark.

“One read” describes this ordinary permission-document path. It does not count the application's resource lookup or promise that the entire authenticated request needs one network operation. Overflow documents add a read; live registry checks, SSO session-standing checks and resource resolvers can add work too.

Follow a change back to the document

Removing Project editor changes the inputs used to prepare the person's access. Policy edits and group changes can affect many people, so bulk work may propagate through asynchronous cascades and repair jobs.

Readers must handle the period when a usable document is absent. In the Node direct reader, an invalidation tombstone is treated as a missing document:

Document stateDirect-reader behavior
Present and usableEvaluate its rules locally
Explicitly denies the requestReturn the denial; do not use missing-document fallback
Missing or invalidated, with fallbackApiBase configuredAsk the Permissions API to decide using the caller-scoped fallback path
Missing, with no fallback or a failed fallbackRefuse the check
Marked as overflowRead and merge the overflow item; refuse evaluation if the required document cannot be assembled

The API fallback also supports rebuilding the missing document so later checks can use the direct path again. Configure it when choosing that integration.

Default-deny handles missing or unusable data. Revoking an old allow also depends on the mutation, invalidation, rebuild and caching paths reaching the readers your application uses. Verify that removal flow with an existing session before promising a revocation interval.

Choose the integration you can operate

Use the HTTP backend when your application should request decisions from the deployed Permissions API. Use direct mode when you want local evaluation and can provide the required AWS read access, compatible reader and fallback configuration.

The permission-check guide covers the API contract. The quickstart covers setup. Whichever path you use, keep an allowed request, a refused request and an access-removal check alongside the integration.