RBAC Fundamentals
- Core Concepts
- Default Roles
- Roles: Sets of permissions that can be assigned to users
- Subjects: Resources that can be acted upon (pages, files, events, etc.)
- Actions: Operations that can be performed on subjects (read, create, update, etc.)
- Rules: Define which roles can perform which actions on which subjects
- Conditions: Optional criteria that further restrict when rules apply
Managing Roles and Rules
Accessing RBAC Settings
- Go to your workspace
- Navigate to Settings > Advanced > Manage Roles
- Edit the YAML configuration
- Save your changes
Defining Roles
auth section allows you to automatically assign roles based on authentication providers.Creating Rules
- action: What can be done (a single action or list)
- subject: What it can be done to (a single subject or list)
- role: Which role this applies to (if omitted, applies to everyone)
- conditions: Restrict the rule to specific cases. If omitted (or an empty object), the rule will apply to every instance of specified subject
- inverted: Set to
trueto make this a deny rule instead of allow - reason: Documentation string for the rule
Adding Conditions
Common RBAC Patterns
Public Access
Public Access
role specified apply to everyone, including unauthenticated users.Role-Based Access
Role-Based Access
API Key Permissions
API Key Permissions
The api key value can’t be directly accessed, but instead can be injected in
fetch instruction :Automatic assignment
Automatic assignment
Subjects and Actions
RBAC controls access to various resource types through subject and action combinations:Workspaces
Workspaces
workspacesActions :read: allows reading the workspace configurationupdate: allows updating the workspace configurationdelete: allows deleting the workspacemanage_security: allows updating security configurationmanage_permissions: allows sharing / unsharingaggregate_search: allows using /search APIget_usage: allows using /usage APImanage_repositories: allows managing repositories settingsmanage: allows all above actions
Pages
Pages
pagesActions :create: allows creating a pageread: allows reading pagesupdate: allows updating pagesdelete: allows deleting pagesmanage: allows all above actions
Files
Files
filesActions :create: allows uploading a fileread: allows reading filesupdate: allows updating filesdelete: allows deleting filesmanage: allows all above actions
Assets
Assets
assetsActions :create: allows uploading a new assetread: allows reading and listing assetsupdate: allows replacing an asset, or changing its access, labels, or metadatadelete: allows deleting assetsmanage: allows all above actions
read to more users: any signed-in user for authenticated, anyone for public, and the organizations and groups of its bindings for private. Rules can match the path, folder, name, mimetype, sharing, bindings, labels, and metadata of an asset. See Workspace assets.Events
Events
eventsActions :create: allows emitting an eventread: allows reading eventsmanage: allows all above actions
Automations
Automations
automationsActions :create: allows creating an automationread: allows reading automationsupdate: allows updating automationsdelete: allows deleting automationsexecute: allows executing automationsmanage: allows all above actions
Secrets
Secrets
secretsActions :create: allows creating secretsread: allows reading secretsupdate: allows updating secretsdelete: allows deleting secretsmanage: allows all above actions
Secure secrets
Secure secrets
secure_secretsActions :create/update: allows depositing a credentialread: allows replaying one, which only an automation taking on a role can do
$secret: references of the secrets module and never handed back to a caller, whatever the rule says. What a rule must prove depends on who it applies to. See Secure secrets below.Apps
Apps
appsActions :create: allows publishing an appread: allows viewing/installing appsupdate: allows updating appsdelete: allows deleting appsmanage: allows all above actions
Restrict a rule to some users
role. Add a user condition to apply it only to the users it matches, or to give a role to the users it matches. It is written like conditions, with the subset of MongoDB queries, and matched on the caller of each request.
Give a role, or restrict a single rule
The sameuser condition can be written on a role or on a rule:
auth nor user is only given explicitly, when the workspace is shared with a user.
For example, this role gives the members of the partner organization read access to the pages and assets labelled partners:
Fields of the user
authProvider describes the current session only. To target every user who signed in with an SSO provider once, use auth on a role, or match authData.<provider>.
Examples
This rule lets the members of thesales group of the acme organization read the pages labelled sales, and nobody else through this rule:
members, but never an anonymous session (such as a public chat embed):
acme whose organization role grants the permission reports:read of the workspace my-workspace, and lets them read the pages labelled reports:
user condition works on a single rule. Unlike the permission of the access, a user condition doesn’t expand the wildcards nor tie the permission to an organization: list them, and add org.slug, otherwise the role of any organization can grant it.
A user condition only narrows the users a rule applies to: it never grants anything by itself. On an inverted rule (inverted: true), it narrows the users the denial applies to. A condition that is not a valid query is refused when the security is saved.
The caller is fully known on the HTTP calls (endpoints, API) and the websockets, not on the runs an event or a schedule starts. So a user condition on an automations rule, or the automations rules of a role given from user, only apply to the endpoint calls: the events are controlled when they are emitted (see Control who calls the endpoints and emits events).
A user can only target their own organizations and their groups in a user condition, with listed values (a value, $in or $eq on orgSlugs, groupIds or org.slug): another organization, another field of the active organization (org.groups…), or an operator that may reach any organization ($nin, $ne, $regex…), is refused, unless the platform allows cross-organization sharing (ALLOW_CROSS_ORG_SHARING). Platform superadmins target any organization. The conditions a security already has, or that a duplicated or imported workspace brings, are kept.
Secure secrets
Secure secrets store credentials: an OAuth refresh token a member deposits when connecting their account, an API key a connector needs. Two rules describe their lifecycle, and they are deliberately asymmetric.Letting members deposit their own credential
${user.id}, anchored, with every other character a literal. Without it, one rule would let any member overwrite every other member’s credential.
A single fixed-width character class such as [a-f0-9]{16} is allowed, so a connector can hold one credential per remote account rather than one per person. Its width must be fixed: with a variable one, two different pairs could spell the same name.
manage is never grantable here, and delete only to a role (below). read is accepted, but a rule carrying no role applies to every member, so granting it here would let each of them read all the others’ credentials — the platform lets you write it and does not recommend it.
Letting an automation replay them
A scheduled synchronisation, or any automation acting for the workspace rather than for its caller, has no user behind it. It cannot read a credential under anyone’s permissions, which is exactly the problem: the tokens the workspace’s own members deposited are unreadable to its own sync. Nothing about the shape of a run answers that. An unauthenticated cron and an unauthenticated HTTP call are indistinguishable, so the workspace states it instead: it declares a role, and the automation takes that role on for the one call that needs it.delete belongs there for the same reason as the write: a connector that sees a token rejected for good drops it, so the run stops retrying and the member is asked to reconnect. It is grantable only to a role — on a rule that applies to every member it would hand each of them the right to destroy the others’ credentials.
assumeRole applies to that single call. Everything around it keeps the caller’s own rights, and nothing is carried to the automations it calls, to an emit, or across a workspace boundary.
What each rule has to prove
The two rules above look alike and answer different questions. A rule carried by no role lands ondefault, which applies to every member. Writing a name they choose would let one member overwrite another’s credential, so ${user.id} is mandatory there: it is the only thing keeping members apart.
A rule carried by a role applies to whoever takes it on, which is an automation acting for the workspace. It may name a family of secrets instead, for reads and writes alike. Reads, because a synchronisation serves everyone and there is no user to bind to. Writes, because providers that rotate their refresh tokens hand back a new one that has to be stored for a member who is not there.
A family pattern must carry a literal prefix of at least six characters ending on a separator, and can never reach the reserved prismeai_ namespace.
Two things remain out of reach whatever the role. Secrets of scope: user belong to a person, and a run without one is refused before permissions are even consulted. And owner cannot be assumed at all, so a developer has to declare a role that states what it opens rather than reaching for everything.
Roles of installed apps
A workspace grants an installed app access to secrets through a role namedapp:<source workspace id>:<role>, whose rules name app:<source workspace id>: secrets. Nothing is read from the app’s own security rules: a rule applies only once this workspace holds it, and changes only when this workspace changes it.
These roles are normally written by granting what the app asks for, but they are ordinary rules of security.yml:
- A rule carried by an
app:role names anapp:<source workspace id>:prefix: that app’s own, or another app’s, so that it shares that app’s secrets. Any other name would match nothing, so it is refused. - A rule carried by no role cannot name
app:secrets: ondefault, it would apply to every member. - Only the app named by the role can take it on. An automation of the workspace itself cannot assume an
app:role, and the workspace cannot be shared with a member under one. - A rule held before these checks existed, and now refused, is kept as long as it is unchanged: saving the security returns a warning for it. Changing it, or adding it to another workspace by an import, is refused. Duplicating the workspace fails while it holds such a rule, and the error names the rule to fix: a copy holds no role yet to compare it with.
- An
app:role cannot carryauth: it would be given to every member it matches, or become an API key the app can no longer take on.
app:<other source workspace id>:<name>:
not_found on the other’s secrets. An app cannot ask for it in requiredAuthorizations, whose names are relative to its own secrets: the workspace writes it.
What an app may ask for is declared by its publisher in requiredAuthorizations: see Asking for authorizations.
Granting and withdrawing. Granting, and editing these roles in security.yml, require the manage_security permission: owners hold it, and a custom role can be given it. To withdraw what an app was granted, remove its app: role and the rules carrying it from security.yml, or uninstall the app: any uninstall withdraws them, unless another installed app still uses them, and keeps the app’s secrets unless their purge is asked. See Secrets stored by apps. The app then gets Unknown role again, and a reinstalled app waits for an owner to grant it again.
Control who calls the endpoints and emits events
access.endpoints: private and access.events: private). A workspace created before keeps its access: without access.endpoints, anyone, even without signing in, can call its endpoints. The access of the workspace app doesn’t change that: the app calls them, it doesn’t protect them. Settings › Security › Access control sets both:
rules of the security add.
The settings are stored in the access section of the security, and the rules add exceptions to it:
bindings takes organizations (principalType: org, an organization slug, or * for the members of any organization) and groups (principalType: group, as organization:group).
The access belongs to the environment, like the bindings of the assets: an import into an existing workspace (archive, Git pull) never replaces its access, which you change from Access control or the API. A workspace created by an import gets the access of the imported security.
Through the API, GET /v2/workspaces/{workspaceId}/security/access returns the access and the levels in force, and PUT /v2/workspaces/{workspaceId}/security/access sets the access alone (an empty object removes it), keeping the rest of the security as it is.
Require a permission of the organization roles
orgPermission), which the roles of the organizations grant: only the members of the organizations and groups of bindings whose role grants it get in. It narrows the bindings, it never opens to anyone else:
<subject>:<action>, and an organization role grants it as ws:<workspace slug>:<subject>:<action>: Access control shows this full name, to copy into a role of AI Governance. ws:<workspace slug>:<subject>:*, ws:<workspace slug>:*, ws:* and * grant it too.
- The permission comes from the role of the active organization of the user, and only counts when it is one of the organizations of
bindings(or the organization of a group ofbindings): a user granted it by another organization they switched to doesn’t get in. The roles of the other organizations can’t give it. - It requires a private access with bindings, and only applies to the private levels: an
authenticatedendpoint access ignores it. - Its subject can’t be one of the workspace subjects (
automations,assets,events,pages…), kept for the permissions of the workspaces themselves. - With every organization (
*) inbindings, the role of the active organization of the user, whichever it is, can grant it: any organization administrator can give it to their members. Bind given organizations to keep it to the roles of these organizations. - The full name follows the slug of the workspace: once the slug changes, the roles must grant the new name (
ws:<new slug>:…), and remove the former one, which a workspace taking the former slug would require under the same name. A duplicated or imported workspace requires it under its own slug. - In a
usercondition of a rule or a role,permissionsis matched as is, wildcards included: list the ones that grant it, and combine it withorg.slug(an organization of yours) so that the role of another organization can’t give it. See the example.
- The
rulesof the security: exceptions, which open (or close) for some roles, users or automations. - The owners and editors, and the endpoints with
authorizations.action: public(since v27.11.0,publicis a native action open to anyone): allowed whateveraccessand the defaults say. access: who can call the endpoints without action and emit events.- Without
access(workspaces created before it): the endpoints stay public; the events are only open to whom the rules let in, so a workspace without such a rule only lets the owners and editors emit events. Access control always sets a level for the events.
role nor user that opens a surface to anyone reopens it whatever its access: Access control then says so. It doesn’t detect every widening: a role given automatically to every signed-in user (an auth provider without conditions) with a rule opening the events, for example, widens their access without a notice. The rule Anyone can create any events that older workspaces have opens the events to anyone: setting the events in Access control replaces it.
Open the events a page emits
A new workspace keeps its endpoints and events to its owners and editors (access.endpoints: private, access.events: private): open the endpoints its pages call to their users in Access control (Signed-in users, or Private with organizations and groups). Most events are internal to the workspace, emitted by its automations, and a user emitting them directly could trigger automations that skip the checks of its endpoints. Pages mostly call endpoints, protected by the endpoints access and the actions of the roles.
A page that emits events needs a rule for them, for the roles that use it, or for everyone:
access is part of the security: it is exported, versioned and imported with the workspace, its organizations and groups included. Check them after importing a workspace from an environment with other organizations.
Securing Automations
Beyond who can call them (see Control who calls the endpoints and emits events), the automations of a workspace can each require a role. To restrict access to sensitive automations:Define Authorization Action
authorizations.action field specifies a permission key for this automation.Create Permission Rule
Test the Restriction
- Users with the admin role can execute the automation
- Users without the admin role receive an authorization error
- The automation cannot be called indirectly by other automations without permission
Open several automations to the holders of an organization permission
authorizations.action: reports:
acme (or of its analysts group) whose organization role grants ws:my-workspace:reports:read:
ws:my-workspace:reports:read in a role of AI Governance (custom permission). The permission is read from the role of the active organization of the user: org.slug (or a group, always of the active organization) keeps it to the roles of acme. A role given from user only applies its automations rules to the endpoint calls. Owners and editors keep calling these endpoints.
Using API Keys
External API Keys
External API Keys
- Use Prismeai APIs to generate an api key :
- Include the received apikey in
x-prismeai-api-keyheader :
Workspace API Keys
Workspace API Keys
Example RBAC Configuration
Here’s a complete example of a typical RBAC configuration:Full RBAC Example
Full RBAC Example
Security Best Practices
Principle of Least Privilege
Give users only the permissions they actually need:
- Start with minimal permissions and add as required
- Use specific conditions to limit rule scope
- Avoid “manage” permission when more specific actions suffice
- Regularly review and prune unnecessary permissions
Secure Public Access
Carefully control what unauthenticated users can do:
- Use explicit conditions on public rules
- Limit event creation to specific event types
- Be cautious with file upload permissions
- Restrict user session events appropriately
Protect Sensitive Automations
Secure automations that access sensitive data:
- Add authorization requirements to important automations
- Create specific roles for administrative functions
- Avoid sensitive data exposure through events
- Test automations with different user roles
Manage API Access
Control programmatic access carefully:
- Create API keys with minimal required permissions
- Rotate API keys regularly
- Monitor API key usage for unusual patterns
- Delete unused API keys promptly
Troubleshooting
Access Denied Unexpectedly
Access Denied Unexpectedly
- Verify the user has the correct role assignment
- Look for inverted rules (deny rules) that might be applying
- Check if conditions on rules are unintentionally restrictive
- Ensure the rule order places more specific rules after general ones
An endpoint answers 403 after restricting the access
An endpoint answers 403 after restricting the access
authorizations.action: public if it must stay open to anyone.Too Much Access
Too Much Access
- Look for overly broad rules without conditions
- Check if the user has multiple roles granting cumulative permissions
- Verify automatic role assignment isn’t giving unintended access
- Ensure public rules (no role specified) aren’t too permissive