Authentication & RBAC
Relevant source files
The following files were used as context for generating this wiki page:
- packages/web/src/lib/agent/skills/content/access-rules.md
- packages/web/src/lib/agent/agent-prompts.ts
- packages/web/src/lib/agent/agent-context.ts
- packages/web/src/lib/agent/registries/tool-registry.ts
- packages/web/src/components/systems/context/system-config-context.tsx
- packages/core/api/systems-documentation.ts
- packages/shared/templates.ts
Authentication and Role-Based Access Control (RBAC) in superglue manage user identities and gate access to tools and external systems. While personal organizations grant admin access to all users, enterprise organizations use roles to define tool-level and system-level allowlists.
The system ensures security by differentiating between read-only and mutating requests across various protocols like HTTP, Postgres, Redis, and FTP. It also provides the AI agent with specific context regarding a user's role to prevent unauthorized configuration changes.
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:1-5, packages/web/src/lib/agent/agent-context.ts:182-192
RBAC Data Model
The core of the access control system is the Role interface. Roles contain allowlists for specific tools and systems.
Role Structure
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the role. |
name | string | Human-readable name. |
tools | "ALL" | string[] | List of allowed tool IDs or a wildcard. |
systems | "ALL" | Record<string, SystemPermission> | Map of system IDs to permissions. |
isBaseRole | boolean | Indicates if the role is a default system role (admin, member, enduser). |
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:7-17
System Permissions
System permissions determine the level of access a role has to a specific integration. Access is denied by default if a system is not listed in the role's map, unless the role uses the "ALL" wildcard.
| Level | Behavior |
|---|---|
"read-write" | Allows all operations, including mutations. |
"read-only" | Restricts access to non-mutating operations (e.g., GET/HEAD). |
{ rules: CustomRule[] } | Uses JavaScript expressions to gate specific requests. |
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:19-29
Base Roles and Hierarchy
Every user is assigned exactly one base role. These roles provide a starting point for permissions and govern the immutability of certain identity fields.
admin: Bypasses all RBAC checks. This role is immutable and cannot be re-assigned or edited.member: The default for team members. It starts with full access but can be narrowed. The name and description are immutable.enduser: The default for portal consumers. It starts with no access (empty lists). Permissions must be explicitly granted.
When a user creates a new tool or system, the backend automatically appends the resource to the creator's base role if that role is in "SPECIFIC" mode rather than "ALL".
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:73-95, packages/web/src/lib/agent/agent-context.ts:184-187
Mutation Detection Logic
The system identifies "mutating" requests to enforce read-only policies. If the system fails to parse a request, it defaults to a mutating state (fail-closed).
The following table summarizes how mutation is detected per protocol:
| Protocol | Mutating Operations |
|---|---|
| HTTP | POST, PUT, PATCH, DELETE |
| Postgres | Statements containing INSERT, UPDATE, DELETE, DROP, ALTER, CREATE, TRUNCATE |
| Redis | Any command not in the read-only set (e.g., SET, DEL, HSET) |
| FTP / SMB | Operations other than list, get, exists, or stat |
| Transform | Never mutating (pure data transformation) |
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:41-52
Custom Access Rules
Custom rules use JavaScript expressions to evaluate a resolved stepConfig. These rules see actual runtime values (URLs, headers, body) after template variable substitution.
Evaluation Logic
- Single Role: All custom rules for a specific system must return truthy (AND logic).
- Multi-Role: Resolution follows a "most permissive wins" union. If any assigned role allows the request, it proceeds (OR logic).
// Example Custom Rule: Block POST requests to admin endpoints
stepConfig.method !== "POST" || !stepConfig.url.includes("/admin");
// Example Custom Rule: Only allow specific headers
!!stepConfig.headers["x-authorized-client"];
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:54-71
System Authentication
Superglue supports multiple authentication types defined in system templates. The SystemManager and system-config-context handle the lifecycle of these credentials.
Authentication Types
| Type | Implementation |
|---|---|
| OAuth | Managed via authenticate_oauth. Supports authorization_code and client_credentials grant types. |
| API Key | Stored in credentials object. Keys are namespaced as <<systemId_credKey>>. |
| Connection String | Used for databases/file servers. Credentials are embedded in the connection URL. |
Sources: packages/shared/templates.ts:5-20, packages/web/src/lib/agent/skills/content/systems-handling.md:12-20
OAuth Authentication Flow
The system provides a specific tool, authenticate_oauth, to handle token retrieval.
Agent Enforcement
The superglue AI agent is instructed to explain RBAC blocks clearly to users. It cannot modify access rules itself; these must be managed by an organization admin through the Control Panel.
The agent uses the following tools for RBAC management:
inspect_role: Reads the current draft state of a role.find_role: Searches persisted role configurations.edit_role: Proposes changes to tool or system allowlists.test_role_access: Validates a JS expression against a samplestepConfig.
Sources: packages/web/src/lib/agent/agent-prompts.ts:40-45, packages/web/src/lib/agent/registries/tool-registry.ts:1210-1221
Authentication and RBAC provide a fail-closed security layer that ensures tools and systems remain accessible only to authorized roles while facilitating the discovery and testing of integrations through a structured permission hierarchy.