Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@radix-ui/react-tooltip": "^1.2.7",
"@tanstack/react-query": "^5.83.0",
"@tauri-apps/api": "^2.9.1",
"@tauri-apps/plugin-shell": "^2.3.4",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
Expand Down
101 changes: 101 additions & 0 deletions apps/desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fake = { version = "3", features = ["derive"] }
rand = "0.9"
bcrypt = "0.15"
reqwest = { version = "0.12", features = ["json"] }
tauri-plugin-shell = "2.3.4"

[profile.release]
panic = "abort"
Expand Down
20 changes: 17 additions & 3 deletions apps/desktop/src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "enables the default permissions",
"windows": ["main"],
"windows": [
"main"
],
"permissions": [
"core:default",
"core:window:allow-start-dragging",
"core:window:allow-minimize",
"core:window:allow-maximize",
"core:window:allow-close",
"core:window:allow-toggle-maximize"
"core:window:allow-toggle-maximize",
"shell:allow-open",
"shell:allow-spawn",
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "docker",
"cmd": "docker",
"args": true
}
]
}
Comment on lines +12 to +24
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Tauri v2 shell allow-execute args restriction allowlist syntax documentation

💡 Result:

Short answer — Tauri v2 shell allow-execute args allowlist:

  • In the capability/allowlist entry for the shell command, the args field may be:
    • true — allow any argument list;
    • false — allow no arguments;
    • an array — a positional specification where each item is either a fixed string argument or an object { "validator": "" } that validates that positional argument with the given regular expression.

Example capability snippet (JSON):
{
"permissions": [
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "run-git-commit",
"cmd": "git",
"args": ["commit", "-m", { "validator": "\S+" }]
}
]
}
]
}

Notes:

  • The args array must match the expected positional arguments exactly; validators are applied to that position.
  • By default no args are allowed unless specified.

Sources: Tauri v2 shell docs. [1][2]

References
[1] Tauri v2 plugin shell docs (official).
[2] Tauri v2 reference (shell) — allowlist args description.


Replace args: true with a whitelist of allowed docker subcommands.

args: true permits any docker argument, which is overly permissive. Use Tauri v2's array syntax to specify allowed subcommands:

{
  "identifier": "shell:allow-execute",
  "allow": [
    {
      "name": "docker",
      "cmd": "docker",
      "args": ["run", "ps", "logs"]
    }
  ]
}

If dynamic arguments are needed (e.g., container IDs), use regex validators for that position:

{
  "identifier": "shell:allow-execute",
  "allow": [
    {
      "name": "docker-logs",
      "cmd": "docker",
      "args": ["logs", { "validator": "[a-f0-9]{12}" }]
    }
  ]
}
🤖 Prompt for AI Agents
In `@apps/desktop/src-tauri/capabilities/default.json` around lines 14 - 26,
Replace the overly-permissive "args": true entry under the "shell:allow-execute"
block so only specific docker subcommands are allowed; change the allow entry
for the docker rule (identifier "shell:allow-execute", allow.name "docker", cmd
"docker") to use an array of allowed args like ["run","ps","logs"] and, where
dynamic values are needed (e.g., container IDs), replace positional items with a
validator object (e.g., { "validator": "<regex>" }) to restrict those argument
tokens.

]
}
}
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub fn run() {
tauri::Builder::default()
.manage(app_state)
.manage(certificates)
.plugin(tauri_plugin_shell::init())
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/features/app-sidebar/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function SidebarContent({ activeNavId, onNavSelect }: ContentProps) {
id: "docker",
label: "Docker Manager",
icon: Container,
disabled: true,
onClick: () => onNavSelect?.("docker"),
},
];

Expand Down
Loading
Loading