agentleFS
taixuanntaixuann/development-space/.claude/skills/configuring-tauri-permissions/SKILL.md

configuring-tauri-permissions

Skill1 starsChanged 15 days agoMITView on GitHub

Guides the user through configuring Tauri permissions, including the security permission system, allow and deny lists, plugin permissions, permission identifiers, scopes, and capability integration.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use "*" to target all windows:

    line 129
  2. Distinctive:

    Verify command permission is in capability

    line 411
  3. Distinctive:

    Check scope includes the target path

    line 412
  4. Distinctive:

    Ensure capability targets correct window

    line 413
  5. Distinctive:

    Check identifier spelling (lowercase only)

    line 416
  6. Distinctive:

    Verify plugin is installed

    line 417
  7. Very specific:

    Run cargo build to regenerate permissions

    line 418
  8. Very specific:

    Check generated schema: src-tauri/gen/schemas/

    line 422
  9. Distinctive:

    Verify window names match capability targets

    line 424
  10. Distinctive:

    Check deny rules are not blocking access

    line 425
  11. Distinctive:

    Principle of Least Privilege: Only grant permissions actually needed

    line 429
  12. Very specific:

    Use Specific Scopes: Prefer $APPDATA/* over $HOME/

    line 430
  13. Very specific:

    Deny Sensitive Paths: Always deny access to .ssh, credentials, etc.

    line 431
  14. Distinctive:

    Separate Capabilities: Use different capabilities for different window types

    line 432
  15. Distinctive:

    Platform-Specific Config: Use platform targeting for OS-specific needs

    line 435

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tauri Permissions Configuration

This skill covers the Tauri v2 permission system for controlling frontend access to backend commands and system resources.

Permission System Overview

Permissions in Tauri are explicit privileges that grant or deny access to specific commands. They form the security boundary between frontend code and system resources.

Core Components

ComponentPurpose
PermissionDefines access to specific commands
ScopeRestricts commands to specific paths/resources
CapabilityLinks permissions to windows/webviews
IdentifierUnique name referencing a permission

Security Model

  • Frontend code cannot access commands without explicit permission
  • Deny rules always take precedence over allow rules
  • Permissions must be linked to capabilities to be active
  • Each window/webview can have different permissions

Permission Identifiers

Naming Convention

Format: <plugin-name>:<permission-type>

PatternExampleDescription
<name>:defaultfs:defaultDefault permission set
<name>:allow-<command>fs:allow-read-fileAllow specific command
<name>:deny-<command>fs:deny-write-fileDeny specific command
<name>:allow-<scope>fs:allow-app-readAllow with predefined scope

Identifier Rules

  • Lowercase ASCII letters only: [a-z]
  • Maximum length: 116 characters
  • Plugin prefixes (tauri-plugin-) added automatically at compile time

Directory Structure

Application Structure

src-tauri/
├── capabilities/
│   ├── default.json          # Main capability file
│   └── admin.toml            # Additional capabilities
├── permissions/
│   └── custom-permission.toml # Custom app permissions
└── tauri.conf.json

Plugin Structure

tauri-plugin-example/
├── permissions/
│   ├── default.toml          # Default permission set
│   ├── autogenerated/        # Auto-generated from commands
│   │   └── commands/
│   └── custom-scope.toml     # Custom scopes
└── src/
    ├── commands.rs
    └── build.rs

Capability Configuration

Capabilities link permissions to windows and define what frontend contexts can access.

JSON Format (Recommended for Apps)

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "main-capability",
  "description": "Main window permissions",
  "windows": ["main"],
  "permissions": [
    "core:default",
    "fs:default",
    "fs:allow-read-text-file",
    {
      "identifier": "fs:allow-write-text-file",
      "allow": [{ "path": "$APPDATA/*" }]
    }
  ]
}

TOML Format

"$schema" = "../gen/schemas/desktop-schema.json"
identifier = "main-capability"
description = "Main window permissions"
windows = ["main"]
permissions = [
  "core:default",
  "fs:default",
  "fs:allow-read-text-file"
]

[[permissions]]
identifier = "fs:allow-write-text-file"
allow = [{ path = "$APPDATA/*" }]

Window Targeting

{
  "identifier": "admin-capability",
  "windows": ["admin", "settings"],
  "permissions": ["fs:allow-write-all"]
}

Use "*" to target all windows:

{
  "windows": ["*"],
  "permissions": ["core:default"]
}

Platform-Specific Capabilities

{
  "identifier": "desktop-capability",
  "platforms": ["linux", "macOS", "windows"],
  "windows": ["main"],
  "permissions": ["fs:allow-app-read-recursive"]
}
{
  "identifier": "mobile-capability",
  "platforms": ["iOS", "android"],
  "windows": ["main"],
  "permissions": ["fs:allow-app-read"]
}

Allow and Deny Lists

Basic Scope Configuration

{
  "identifier": "fs:allow-read-file",
  "allow": [
    { "path": "$HOME/Documents/*" },
    { "path": "$APPDATA/**" }
  ],
  "deny": [
    { "path": "$HOME/Documents/secrets/*" }
  ]
}

Scope Variables

VariableDescription
$APPApplication install directory
$APPCONFIGApp config directory
$APPDATAApp data directory
$APPLOCALDATAApp local data directory
$APPCACHEApp cache directory
$APPLOGApp log directory
$HOMEUser home directory
$DESKTOPDesktop directory
$DOCUMENTDocuments directory
$DOWNLOADDownloads directory
$RESOURCEApp resource directory
$TEMPTemporary directory

Glob Patterns

PatternMatches
*Any file in directory
**Recursive (all subdirectories)
*.txtFiles with .txt extension

Deny Precedence

Deny rules always override allow rules:

{
  "permissions": [
    {
      "identifier": "fs:allow-read-file",
      "allow": [{ "path": "$HOME/**" }],
      "deny": [{ "path": "$HOME/.ssh/**" }]
    }
  ]
}

Plugin Permissions

Using Default Plugin Permissions

{
  "permissions": [
    "fs:default",
    "shell:default",
    "http:default",
    "dialog:default"
  ]
}

Common Plugin Permission Patterns

Filesystem Plugin

{
  "permissions": [
    "fs:default",
    "fs:allow-read-text-file",
    "fs:allow-write-text-file",
    "fs:allow-app-read-recursive",
    "fs:allow-app-write-recursive",
    "fs:deny-default"
  ]
}

HTTP Plugin

{
  "permissions": [
    "http:default",
    {
      "identifier": "http:default",
      "allow": [{ "url": "https://api.example.com/*" }],
      "deny": [{ "url": "https://api.example.com/admin/*" }]
    }
  ]
}

Shell Plugin

{
  "permissions": [
    "shell:allow-open",
    {
      "identifier": "shell:allow-execute",
      "allow": [
        { "name": "git", "cmd": "git", "args": true }
      ]
    }
  ]
}

Directory-Specific Filesystem Permissions

PermissionAccess
fs:allow-appdata-readRead $APPDATA (non-recursive)
fs:allow-appdata-read-recursiveRead $APPDATA (recursive)
fs:allow-appdata-writeWrite $APPDATA (non-recursive)
fs:allow-appdata-write-recursiveWrite $APPDATA (recursive)
fs:allow-home-read-recursiveRead $HOME (recursive)
fs:allow-temp-writeWrite to temp directory

Custom Permission Definition

TOML Permission File

Create src-tauri/permissions/my-permission.toml:

[[permission]]
identifier = "my-app:config-access"
description = "Access to app configuration files"
commands.allow = ["read_config", "write_config"]

[[scope.allow]]
path = "$APPCONFIG/*"

[[scope.deny]]
path = "$APPCONFIG/secrets.json"

Permission Sets

Group multiple permissions:

[[set]]
identifier = "my-app:full-access"
description = "Full application access"
permissions = [
  "my-app:config-access",
  "fs:allow-app-read-recursive",
  "fs:allow-app-write-recursive"
]

Auto-Generated Command Permissions

In plugin src/build.rs:

const COMMANDS: &[&str] = &["get_user", "save_user", "delete_user"];

fn main() {
    tauri_plugin::Builder::new(COMMANDS)
        .build();
}

This generates:

  • allow-get-user / deny-get-user
  • allow-save-user / deny-save-user
  • allow-delete-user / deny-delete-user

Default Permission Set

Create permissions/default.toml:

[default]
description = "Default permissions for my-plugin"
permissions = [
  "allow-get-user",
  "allow-save-user"
]

Remote Access Configuration

Allow remote URLs to access Tauri APIs (use with caution):

{
  "identifier": "remote-capability",
  "windows": ["main"],
  "remote": {
    "urls": ["https://*.myapp.com"]
  },
  "permissions": [
    "core:default"
  ]
}

Security Warning: Linux and Android cannot distinguish iframe requests from window requests.

Configuration in tauri.conf.json

Reference capabilities by identifier:

{
  "app": {
    "security": {
      "capabilities": ["main-capability", "admin-capability"]
    }
  }
}

Or inline capabilities directly:

{
  "app": {
    "security": {
      "capabilities": [
        {
          "identifier": "inline-capability",
          "windows": ["*"],
          "permissions": ["core:default"]
        }
      ]
    }
  }
}

Troubleshooting

Common Errors

"Not allowed on this command"

  • Verify command permission is in capability
  • Check scope includes the target path
  • Ensure capability targets correct window

Permission not found

  • Check identifier spelling (lowercase only)
  • Verify plugin is installed
  • Run cargo build to regenerate permissions

Debugging Permissions

  1. Check generated schema: src-tauri/gen/schemas/
  2. Review capability files load correctly
  3. Verify window names match capability targets
  4. Check deny rules are not blocking access

Best Practices

  1. Principle of Least Privilege: Only grant permissions actually needed
  2. Use Specific Scopes: Prefer $APPDATA/* over $HOME/**
  3. Deny Sensitive Paths: Always deny access to .ssh, credentials, etc.
  4. Separate Capabilities: Use different capabilities for different window types
  5. Document Custom Permissions: Include clear descriptions
  6. Review Plugin Defaults: Understand what default permissions grant
  7. Platform-Specific Config: Use platform targeting for OS-specific needs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.