Skip to content

Commit 7d21e3b

Browse files
docs: how security > capabilities works (#13946)
* docs: how `security > capabilities` works * Add how to use it * Apply suggestions * Relative to `Cargo.toml` * Remove the relative base wording
1 parent 4d270a9 commit 7d21e3b

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

crates/tauri-cli/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@
11501150
]
11511151
},
11521152
"capabilities": {
1153-
"description": "List of capabilities that are enabled on the application.\n\n If the list is empty, all capabilities are included.",
1153+
"description": "List of capabilities that are enabled on the application.\n\n By default (not set or empty list), all capability files from `./capabilities/` are included,\n by setting values in this entry, you have fine grained control over which capabilities are included\n\n You can either reference a capability file defined in `./capabilities/` with its identifier or inline a [`Capability`]\n\n ### Example\n\n ```json\n {\n \"app\": {\n \"capabilities\": [\n \"main-window\",\n {\n \"identifier\": \"drag-window\",\n \"permissions\": [\"core:window:allow-start-dragging\"]\n }\n ]\n }\n }\n ```",
11541154
"default": [],
11551155
"type": "array",
11561156
"items": {

crates/tauri-schema-generator/schemas/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@
11501150
]
11511151
},
11521152
"capabilities": {
1153-
"description": "List of capabilities that are enabled on the application.\n\n If the list is empty, all capabilities are included.",
1153+
"description": "List of capabilities that are enabled on the application.\n\n By default (not set or empty list), all capability files from `./capabilities/` are included,\n by setting values in this entry, you have fine grained control over which capabilities are included\n\n You can either reference a capability file defined in `./capabilities/` with its identifier or inline a [`Capability`]\n\n ### Example\n\n ```json\n {\n \"app\": {\n \"capabilities\": [\n \"main-window\",\n {\n \"identifier\": \"drag-window\",\n \"permissions\": [\"core:window:allow-start-dragging\"]\n }\n ]\n }\n }\n ```",
11541154
"default": [],
11551155
"type": "array",
11561156
"items": {

crates/tauri-utils/src/config.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2468,7 +2468,26 @@ pub struct SecurityConfig {
24682468
pub pattern: PatternKind,
24692469
/// List of capabilities that are enabled on the application.
24702470
///
2471-
/// If the list is empty, all capabilities are included.
2471+
/// By default (not set or empty list), all capability files from `./capabilities/` are included,
2472+
/// by setting values in this entry, you have fine grained control over which capabilities are included
2473+
///
2474+
/// You can either reference a capability file defined in `./capabilities/` with its identifier or inline a [`Capability`]
2475+
///
2476+
/// ### Example
2477+
///
2478+
/// ```json
2479+
/// {
2480+
/// "app": {
2481+
/// "capabilities": [
2482+
/// "main-window",
2483+
/// {
2484+
/// "identifier": "drag-window",
2485+
/// "permissions": ["core:window:allow-start-dragging"]
2486+
/// }
2487+
/// ]
2488+
/// }
2489+
/// }
2490+
/// ```
24722491
#[serde(default)]
24732492
pub capabilities: Vec<CapabilityEntry>,
24742493
/// The headers, which are added to every http response from tauri to the web view

0 commit comments

Comments
 (0)