Introduction
Formal’s permission system is built on the Open Policy Agent (OPA), allowing you to restrict user access to specific applications through Rego policies. By defining granular permissions, you can ensure users have access only to the applications necessary for their roles and responsibilities. These permissions are enforced against our API endpoints.Default permissions
Upon account creation, Formal operates under an allow-by-default model. Meaning, by default, if no permission blocks an endpoint for a given user, then the endpoint is allowed.Permission actions
A Permission can block a request with anallow rule, or rewrite its response with a response rule. allow runs before the API handles the request. response runs after, only for requests that allow lets through.
Rewrite responses
Aresponse rule replaces the response a user receives. Use it to hide list items, drop fields, or redact values. It has the same shape as the rewrite action of policies.
admin see only production resources and resources in one Space. The rule body decides when the rewrite applies, and keep_resource decides which items stay. Each keep_resource body is another way to keep an item.
json is the whole replacement response, so start from input.response.json with object.union to keep the other fields. input.response.json uses the same camelCase field names as input.args.
If a rewrite fails, the API returns an error instead of the original response. A rewrite fails when the rule errors, returns an action other than rewrite, or returns json that doesn’t match the response’s fields. It also fails when two Permissions rewrite the same response, so scope each response rule to the commands it’s for.
A filtered page can hold fewer items than limit, or none. listMetadata.nextCursor is unchanged, so keep requesting pages until it’s empty.
Rewrites apply only to unary API calls, and never to the Permissions application, so a broken rule can’t lock you out of fixing it. Rules can’t read fields the API marks sensitive, such as generated keys. Formal restores those fields after the rewrite, except inside list items. Totals such as technologySummaries still count hidden items. Hiding an item from a List command doesn’t hide it from Get, so add a rule for that command too.
Permission Model
Unlike other software products, Formal does not have the traditional concept of Roles. Instead, users can leverage Permissions to create role based access control (RBAC) using your organization’s Groups (which can be SCIM provisioned from your IDP into Formal).User experience when blocked
The Formal APIs will return HTTP 403 error status codes if a user is blocked on a particular endpoint. Users who are interacting with the Formal APIs through the Control Plane will experience “Forbidden” toasts or dialogs.
List of inputs
You can block or allow requests based on the following user and application inputs:User inputs
input.user.idinput.user.nameinput.user.emailinput.user.groupsinput.user.ip_addressinput.user.type(i.e.humanormachine)input.user.auth_method— how the request authenticated:browser_session,api_key,oidc,formal_sig, oroauthinput.user.oauth— the OAuth client acting for the user, present only whenauth_methodisoauth. See OAuth clients.
OAuth clients
An MCP client that connects to Formal MCP with OAuth calls the API as the user who approved it. Those calls carryinput.user.oauth:
An OAuth client reaches only the apps its scopes name, whatever Permissions
allow, and only their read commands unless its scope for the app is write.
Some writes stay out of its reach under any scope, as
Formal MCP access lists. Permissions
apply on top. See
Keep MCP clients from deleting policies.
Application inputs
input.app.nameinput.app.command.nameinput.app.command.type
input.args).
Argument keys use the API’s JSON field names in camelCase, such as input.args.spaceId and input.args.connectorId.
Response inputs
input.response.json— the API’s response, in the same JSON encoding asinput.args. Set only while aresponserule evaluates.
Target inputs
input.targets lists every Space, resource, connector, or satellite a resource, connector, or native user API request names, and every object under one:
- the resource, connector, or child object it reads, updates, or deletes, for example
DeleteResourceorUpdateConnectorListener - the parent of an object it creates or lists, for example
CreateNativeUserV3andListResourceHostnamesname their resource - the object a link joins, for example
CreateConnectorSatelliteLinknames the connector and the satellite - the Space it assigns, for example
spaceIdonCreateResource,UpdateResource,CreateConnector,UpdateConnector,ListResources, andListConnectors
type— for exampleresource,native_user_v3,connector_listener, orspaceid— the ID from the requestspace_id— the Space of the object, or of the resource or connector it belongs to. Empty when the object has no Space or does not exist.resource_id— the resource the object is or belongs to, for example a native user’s resource. Absent for connectors and their objects.connector_id— the connector the object is or belongs to, for example a listener rule’s connector. Absent for resources and their objects.
id, with its current Space, and the new Space from spaceId:
input.targets is absent when the request names none of these objects, for example ListUsers, GetPolicy, or ListLogs. It is also absent for other APIs, such as UpdateSatelliteV2 or UpdateSpaceV2, even when their request includes a Space.
List of command types
Here is a table listing all command types that can be used. If the API call contains the operation, then it is categorized as the corresponding type.List of applications
API endpoints are segmented into Applications. Here is a table listing all applications that can be configured for access permissions:Public API
Public API
These applications have public API endpoints accessible via API keys or the Control Plane.
Control Plane Only
Control Plane Only
These applications are only accessible through the Control Plane and do not have public API documentation.
For Control Plane only applications, we recommend restricting access at the application level rather than by individual command types, since the available commands are not publicly documented.
Example: Single Application
Below is an example of a Rego policy that grants access to the Sessions application exclusively for users in the admin group.Example: Granular Access Control
- Broad read access: Everyone can view most data using
readcommand types. - Self-service access: Everyone can manage their own credentials in the Access app.
- Administrative access: Users in
security-adminshave unrestricted access to all apps. - Team-specific access: Users in the
engineersgroup can access developer-focused tools.
default allow = false is set, any request that does not match at least one of these allow rules is blocked. Formal returns a 403 Forbidden error for these requests.
Example: Argument-based Access Control
policy_01kg6rhpe7em4rr2v0mcwm0mp4 unless the user is in the security-admins group.
Example: Scope a machine user to one Space
Run one machine user per environment, for example one per Kubernetes cluster running the Kubernetes operator. This permission only lets the machine user call APIs whose targets are all in one Space:target.connector_id to the connector’s ID. Resources and their objects have no connector_id, so that rule denies them.
The operator also reads users and groups to build native user identity links, so org_reads allows ListUsers and ListGroups. Remove them if the cluster does not use identity links. Manage FormalPolicy objects from a cluster whose machine user is not scoped, since policies have no Space.
Example: Restrict Access to Logs
Viewing Connector, Desktop, Control Plane, and workflow logs all use the Logs application. There is no separate permission per log source.security-admins can open Logs or call Logs APIs. For Control Plane audit fields and more permission patterns, see Control Plane Logs.
Example: Formal MCP only for pre-registered clients
Useinput.user.oauth to decide which MCP clients may read through
Formal MCP. Other ways of signing in are unaffected.
Example: Keep MCP clients from deleting policies
MCP clients you approve for write on Policies can change policies. Useinput.user.oauth.scopes to narrow what they can do.
Example: Show users only their own logs
security-admins see only their own log entries.
Example: Hide a resource’s hostname
admin get the resource without its hostname.
Example: Show users only the policies in one folder
data-team see only the policies in the Data Team folder and its subfolders, in the Control Plane and through the API. folderPath is empty for a policy that is in no folder. The second rule hides the other folders from the folder list. totalPolicyCount still counts every policy.
These rules hide policies from lists. They do not block access by ID:
GetPolicy still returns a hidden policy.