Access policy reference
Reference for Retool access policy rules, statuses, error codes, audit events, and API endpoints.
Reference for the components of an access policy, the errors enforcement produces, and the API and audit surfaces that expose them. For the semantics of enforcement, including how grants combine and why a query returns what it does, refer to Data access enforcement. For an introduction to the model, refer to Access policies.
Policy structure
A policy belongs to an organization and applies to one or more resources.
| Field | Description |
|---|---|
| Name | Display name. Defaults to Untitled policy. |
| Description | Optional explanation, visible to users with Own access to the resource. |
| Status | Draft, Active, or Inactive. Refer to Statuses. |
| Access level | Full access or Granular access. |
| Assignment | The permission groups the policy applies to, and the groups excluded from it. |
| Environments | The resource environments the policy covers. At least one is required. |
| Rules | The table, column, and row grants that make up granular access. |
Access levels
| Access level | Behavior |
|---|---|
| Full access | Grants unrestricted access to the resource. Rules are not evaluated. |
| Granular access | Grants only what the policy's rules allow. Anything not granted is blocked. |
Full access is not equivalent to granting read and write access to every table. It bypasses rule evaluation, which means it also bypasses restrictions that apply only to granular grants, including the block on GUI mode queries.
If any policy covering a user grants Full access to a resource, that user reaches all of its data regardless of other policies.
Full access to a resource compared to full access to a table
Two grants use similar wording and behave differently.
| Grant | Where you set it | Scope |
|---|---|---|
| Unrestricted access to this resource, shown as Full access once set | The policy's access level. | The whole resource, including statements that do not reference a specific table. |
| Allow read + write access to | A rule on a selected table. | The selected table only. |
Selecting every table in a granular rule is not equivalent to Full access. Granular rules are always evaluated against the tables they name, so a statement that references no table is blocked no matter how many tables the rules cover.
Data definition statements
Statements that change database structure, such as CREATE, ALTER, DROP, and RENAME, succeed only under Full access.
Under granular access, they return unsupported_query_construct, because enforcement cannot evaluate these statement types against a policy's rules. The reason identifies the statement type, in the form 'RenameStmt' statements are not supported by data security policy enforcement.
Rules
Each rule targets one table.
| Field | Description |
|---|---|
| Table | The table the rule grants. |
| Actions | read, write, or both. |
| Columns | The columns granted. Refer to Column grants. A rule listing no columns grants nothing. |
| Row filters | The filters narrowing which rows the rule grants. Each filter is one condition: a column, an operator, and a value. No filter grants every row. |
Actions
| Action | Grants |
|---|---|
| Allow read access to | Reading the granted data. |
| Allow write access to | Inserting, updating, and deleting the granted data. |
| Allow read + write access to | Both. |
Write grants do not validate the values a user writes. Refer to Row filters do not validate writes.
Column grants
Under Column access, choose the action, then name the columns it applies to. The column field offers two shortcuts above the table's individual columns.
| Option | Grants | SELECT * |
|---|---|---|
| All present + future columns | Every column on the table, including columns added to it later. | Allowed. |
| All present columns | Each column the table has now, selected individually. Columns added later are not covered. | Blocked. |
| A named column | That column only. | Blocked. |
Columns allowed indicates how many columns the rule currently grants. A rule that lists no columns grants nothing, so every rule needs at least one column or one of the shortcuts. Refer to Grants and their results for why a wildcard is blocked under a fixed column list.