Detailed Permissions Reference
Relevant source files
The following files were used as context for generating this wiki page:
This reference provides a comprehensive overview of the Access Control List (ACL) and permission system for the tauri-plugin-centrifugo. In the Tauri v2 architecture, all plugin commands are blocked by default. Developers must explicitly enable specific capabilities in their configuration to grant the frontend access to Centrifugo real-time communication features.
The permission system is designed to provide granular control over WebSocket connections, channel subscriptions, message publishing, and administrative actions like RPC calls or token management.
Sources: README.md:214-222, permissions/schemas/schema.json:1-10
Permission Architecture
The permission system follows the standard Tauri v2 capability pattern. It utilizes a schema-driven approach to define allowed and denied commands, platform targets, and scopes.
Permission Structure
Permissions are structured as objects containing identifiers, descriptions, and sets of allowed or denied commands.
The diagram shows the relationship between permission files and the individual permission definitions used to control IPC access.
Sources: permissions/schemas/schema.json:7-142
Data Flow for Permission Validation
When a frontend component invokes a command, the Tauri IPC layer validates the request against the configured capabilities for that specific window or webview.
Default Permission Set
The plugin provides a default permission identifier that enables a comprehensive set of operations required for standard real-time applications. This is the recommended starting point for most implementations.
| Permission Identifier | Description |
|---|---|
centrifugo:default | Enables all standard communication commands including connect, publish, and subscribe. |
Commands Included in Default
The default set includes explicit "allow" rules for the following commands:
- Connection Management:
connect,disconnect,is_connected,get_connection_state,start_connection,stop_connection. - Subscription Management:
add_subscription,remove_subscription,get_subscriptions. - Data Operations:
publish,rpc,send. - Server Interaction:
presence,presence_stats,history,ping. - Authentication:
set_token,refresh,sub_refresh.
Sources: permissions/autogenerated/reference.md:3-23, permissions/schemas/schema.json:521-539
Granular Permission Reference
For security-sensitive applications, developers can choose to grant only specific permissions rather than the entire default set.
Connection & Session Control
These permissions govern the ability to establish and maintain the WebSocket link to the Centrifugo server.
| Allow Identifier | Deny Identifier | Description |
|---|---|---|
allow-connect | deny-connect | Control establishing the initial connection. |
allow-set-token | deny-set-token | Control the ability to set or update JWT tokens. |
allow-ping | deny-ping | Permission to heartbeat the server. |
Sources: permissions/autogenerated/reference.md:53-76, permissions/autogenerated/reference.md:121-132
Channel & Message Operations
These permissions control the flow of data between the client and specific Centrifugo channels.
| Allow Identifier | Deny Identifier | Description |
|---|---|---|
allow-add-subscription | deny-add-subscription | Control dynamic channel subscriptions. |
allow-publish | deny-publish | Grant/Revoke ability to send messages to channels. |
allow-rpc | deny-rpc | Control remote procedure calls to the server. |
allow-history | deny-history | Access to message history/cache for channels. |
Sources: permissions/autogenerated/reference.md:33-48, permissions/autogenerated/reference.md:93-100, permissions/autogenerated/reference.md:173-180
Capability Configuration
To apply these permissions, they must be included in a capability file (e.g., src-tauri/capabilities/default.json).
{
"identifier": "centrifugo-communication",
"description": "Allows the main window to communicate via Centrifugo",
"windows": ["main"],
"permissions": [
"centrifugo:default"
]
}
Capabilities can be limited to specific platforms such as macOS, windows, linux, android, or iOS. If no platforms are specified, the permission applies globally.
Sources: examples/tauri-app/src-tauri/gen/schemas/desktop-schema.json:49-115, permissions/schemas/schema.json:303-345
Conclusion
The tauri-plugin-centrifugo utilizes a robust ACL system to ensure that potentially dangerous commands—such as publishing data or executing RPC calls—are only available to authorized windows. By leveraging the default permission set or fine-tuning with granular identifiers, developers can secure their real-time communication layer according to the principle of least privilege.