snapshot of https://github.com/tauri-apps/tauri.git (dev, 2026-09-23; blobs > 131072B omitted)
Some checks failed
Audit / audit-js (push) Failing after 0s
bench / bench (map[os:ubuntu-latest runner:xvfb-run --auto-servernum target:x86_64-unknown-linux-gnu], nightly) (push) Failing after 0s
covector version or publish / run-integration-tests (ubuntu-latest) (push) Failing after 0s
Audit / audit-rust (push) Failing after 0s
test `@tauri-apps/cli` / test (ubuntu-latest) (push) Failing after 0s
test `tauri-cli` / test (map[os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
deploy schema worker / deploy (push) Failing after 0s
lint rust / clippy (map[cargo:cargo include: os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
lint rust / clippy (map[cargo:cross include:--package api os:ubuntu-latest target:aarch64-linux-android]) (push) Failing after 0s
supply chain health status / check rust dependencies with cargo vet (push) Failing after 0s
test `@tauri-apps/api` e2e (mobile) / android (push) Failing after 0s
test `@tauri-apps/api` e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
Udeps / changes (push) Failing after 0s
Udeps / setup (push) Has been skipped
Udeps / udeps (push) Has been skipped
bench / bench (map[os:macos-latest runner: target:aarch64-apple-darwin], nightly) (push) Has been cancelled
bench / bench (map[os:windows-latest runner: target:x86_64-pc-windows-msvc], nightly) (push) Has been cancelled
covector version or publish / run-integration-tests (macos-latest) (push) Has been cancelled
covector version or publish / run-integration-tests (windows-latest) (push) Has been cancelled
covector version or publish / version-or-publish (push) Has been cancelled
test `@tauri-apps/cli` / test (macos-latest) (push) Has been cancelled
test `tauri-cli` / test (map[args:--no-default-features --features native-tls-vendored os:windows-latest restore-only:true target:aarch64-pc-windows-msvc]) (push) Has been cancelled
test `tauri-cli` / test (map[os:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
test `tauri-cli` / test (map[os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include:--package api os:macos-latest target:aarch64-apple-ios]) (push) Has been cancelled
test `@tauri-apps/api` e2e (mobile) / ios (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
test `@tauri-apps/cli` / test (windows-latest) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-23 17:00:42 +05:00
commit feda81bf2f
1178 changed files with 156404 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
[package]
name = "acl-tests"
version = "0.1.0"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
categories.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
[dev-dependencies]
tauri-utils = { workspace = true, features = ["build-2"] }
serde_json = "1"
insta = "1"

View File

@@ -0,0 +1,4 @@
identifier = "run-app"
description = "app capability"
windows = ["main"]
permissions = ["ping:allow-ping"]

View File

@@ -0,0 +1 @@
["ping"]

View File

@@ -0,0 +1,7 @@
identifier = "run-app"
description = "app capability"
windows = ["main"]
permissions = ["fs:read", "fs:allow-app"]
local = false
[remote]
urls = ["https://tauri.app"]

View File

@@ -0,0 +1,4 @@
identifier = "run-app"
description = "app capability"
windows = ["main"]
permissions = ["fs:read", "fs:allow-app"]

View File

@@ -0,0 +1,5 @@
identifier = "run-app"
description = "app capability"
windows = ["main"]
webviews = ["child1", "child2"]
permissions = ["ping:allow-ping"]

View File

@@ -0,0 +1 @@
["ping"]

View File

@@ -0,0 +1,4 @@
identifier = "run-app-external-url"
description = "external window capability"
windows = ["external"]
permissions = ["fs:read", "fs:deny-home"]

View File

@@ -0,0 +1,20 @@
{
"identifier": "run-app",
"description": "ap capability",
"windows": ["main"],
"permissions": [
{
"identifier": "fs:read",
"allow": [
{
"path": "$CONFIG/*"
}
]
},
"fs:allow-app",
"fs:deny-home",
"fs:allow-read-resources",
"fs:allow-move-temp",
"fs:read-download-dir"
]
}

View File

@@ -0,0 +1 @@
["fs"]

View File

@@ -0,0 +1,9 @@
identifier = "run-app"
description = "app capability"
windows = ["main"]
permissions = [
"os:allow-apt-linux",
"os:allow-library-folder-macos",
"os:deny-webview-folder-windows",
"os:open-browser",
]

View File

@@ -0,0 +1,39 @@
{
"identifier": "run-app",
"description": "app capability",
"windows": ["main"],
"permissions": [
{
"identifier": "fs:read",
"allow": [
{
"path": "$HOME/.config/**"
}
]
},
"fs:deny-home",
{
"identifier": "fs:allow-read-resources",
"deny": [
{
"path": "$RESOURCE/**/*.key"
}
]
},
"fs:allow-move-temp",
{
"identifier": "fs:allow-app",
"allow": [
{
"path": "$APPDATA/**"
}
],
"deny": [
{
"path": "$APPDATA/*.db"
}
]
},
"fs:read-download-dir"
]
}

View File

@@ -0,0 +1,11 @@
identifier = "run-app"
description = "app capability"
windows = ["main"]
permissions = [
"fs:read",
"fs:allow-app",
"fs:deny-home",
"fs:allow-read-resources",
"fs:allow-move-temp",
"fs:read-download-dir",
]

View File

@@ -0,0 +1 @@
["fs"]

View File

@@ -0,0 +1,6 @@
[[permission]]
identifier = "deny-home"
description = "Denies accessing the $HOME path."
[[permission.scope.deny]]
path = "$HOME"

View File

@@ -0,0 +1,6 @@
[[permission]]
identifier = "allow-move-temp"
description = "Enables the move command with the $TEMP base directory."
commands.allow = ["move"]
[[permission.scope.allow]]
path = "$TEMP/*"

View File

@@ -0,0 +1,4 @@
[[permission]]
identifier = "allow-read-dir"
description = "Enables the read_dir command without any pre-configured scope."
commands.allow = ["read_dir"]

View File

@@ -0,0 +1,4 @@
[[set]]
identifier = "read-download-dir"
description = "allows all read the $DOWNLOAD dir"
permissions = ["allow-read-dir", "allow-download-dir"]

View File

@@ -0,0 +1,4 @@
[[permission]]
identifier = "allow-read-file"
description = "Enables the read_file command without any pre-configured scope."
commands.allow = ["read_file"]

View File

@@ -0,0 +1,8 @@
[[permission]]
identifier = "allow-read-resources"
description = "Enables the read_file and read_dir command using the $RESOURCE base directory."
commands.allow = ["read_file", "read_dir"]
[[permission.scope.allow]]
path = "$RESOURCE/**"
[[permission.scope.allow]]
path = "$RESOURCE"

View File

@@ -0,0 +1,4 @@
[[set]]
identifier = "read"
description = "allows all read APIs"
permissions = ["allow-read-dir", "allow-read-file"]

View File

@@ -0,0 +1,13 @@
[[permission]]
identifier = "allow-app"
description = "Allows accessing the $APPDATA path."
[[permission.scope.allow]]
path = "$APPDATA"
[[permission]]
identifier = "allow-download-dir"
description = "Allows accessing the $DOWNLOAD directory."
[[permission.scope.allow]]
path = "$DOWNLOAD"
[[permission.scope.allow]]
path = "$DOWNLOAD/**"

View File

@@ -0,0 +1,7 @@
[[permission]]
identifier = "allow-apt-linux"
platforms = ["linux"]
description = "Allows spawning the apt command on Linux"
commands.allow = ["spawn"]
[[permission.scope.allow]]
command = "apt"

View File

@@ -0,0 +1,7 @@
[[permission]]
identifier = "allow-library-folder-macos"
platforms = ["macOS"]
description = "Allows access to the $HOME/Library folder on maOS"
[[permission.scope.allow]]
path = "$HOME/Library/**"

View File

@@ -0,0 +1,28 @@
[[permission]]
identifier = "allow-servo-linux"
platforms = ["linux"]
description = "Allows starting servo on Linux"
commands.allow = ["spawn"]
[[permission.scope.allow]]
command = "servo"
[[permission]]
identifier = "allow-edge-windows"
platforms = ["windows"]
description = "Allows starting edge on Windows"
commands.allow = ["spawn"]
[[permission.scope.allow]]
command = "edge"
[[permission]]
identifier = "allow-safari-macos"
platforms = ["macOS"]
description = "Allows starting safari on macOS"
commands.allow = ["spawn"]
[[permission.scope.allow]]
command = "safari"
[[set]]
identifier = "open-browser"
description = "allows opening a URL on the platform browser"
permissions = ["allow-servo-linux", "allow-edge-windows", "allow-safari-macos"]

View File

@@ -0,0 +1,6 @@
[[permission]]
identifier = "deny-webview-folder-windows"
platforms = ["windows"]
description = "Denies access to the webview folder on Windows"
[[permission.scope.deny]]
path = "$APPLOCALDATA/EBWebView/**"

View File

@@ -0,0 +1,4 @@
[[permission]]
identifier = "allow-ping"
description = "Enables the ping command without any pre-configured scope."
commands.allow = ["ping"]

View File

@@ -0,0 +1,40 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:ping|ping": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
},
denied_commands: {},
command_scope: {},
global_scope: {},
}

View File

@@ -0,0 +1,411 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:fs|read_dir": [
ResolvedCommand {
context: Remote {
url: RemoteUrlPattern(
UrlPattern {
protocol: Component {
pattern_string: "https",
regexp: Ok(
Regex(
"^https$",
),
),
group_name_list: [],
matcher: Matcher {
prefix: "",
suffix: "",
inner: Literal {
literal: "https",
},
ignore_case: false,
},
has_regexp_group: false,
},
username: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
password: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
hostname: Component {
pattern_string: "tauri.app",
regexp: Ok(
Regex(
"^tauri\\.app$",
),
),
group_name_list: [],
matcher: Matcher {
prefix: "",
suffix: "",
inner: Literal {
literal: "tauri.app",
},
ignore_case: false,
},
has_regexp_group: false,
},
port: Component {
pattern_string: "",
regexp: Ok(
Regex(
"^$",
),
),
group_name_list: [],
matcher: Matcher {
prefix: "",
suffix: "",
inner: Literal {
literal: "",
},
ignore_case: false,
},
has_regexp_group: false,
},
pathname: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
search: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
hash: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
},
"https://tauri.app",
),
},
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
"plugin:fs|read_file": [
ResolvedCommand {
context: Remote {
url: RemoteUrlPattern(
UrlPattern {
protocol: Component {
pattern_string: "https",
regexp: Ok(
Regex(
"^https$",
),
),
group_name_list: [],
matcher: Matcher {
prefix: "",
suffix: "",
inner: Literal {
literal: "https",
},
ignore_case: false,
},
has_regexp_group: false,
},
username: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
password: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
hostname: Component {
pattern_string: "tauri.app",
regexp: Ok(
Regex(
"^tauri\\.app$",
),
),
group_name_list: [],
matcher: Matcher {
prefix: "",
suffix: "",
inner: Literal {
literal: "tauri.app",
},
ignore_case: false,
},
has_regexp_group: false,
},
port: Component {
pattern_string: "",
regexp: Ok(
Regex(
"^$",
),
),
group_name_list: [],
matcher: Matcher {
prefix: "",
suffix: "",
inner: Literal {
literal: "",
},
ignore_case: false,
},
has_regexp_group: false,
},
pathname: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
search: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
hash: Component {
pattern_string: "*",
regexp: Ok(
Regex(
"^(.*)$",
),
),
group_name_list: [
"0",
],
matcher: Matcher {
prefix: "",
suffix: "",
inner: SingleCapture {
filter: None,
allow_empty: true,
},
ignore_case: false,
},
has_regexp_group: false,
},
},
"https://tauri.app",
),
},
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
},
denied_commands: {},
command_scope: {},
global_scope: {
"fs": ResolvedScope {
allow: [
Map(
{
"path": String(
"$APPDATA",
),
},
),
],
deny: [],
},
},
}

View File

@@ -0,0 +1,81 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:fs|read_dir": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
"plugin:fs|read_file": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
},
denied_commands: {},
command_scope: {},
global_scope: {
"fs": ResolvedScope {
allow: [
Map(
{
"path": String(
"$APPDATA",
),
},
),
],
deny: [],
},
},
}

View File

@@ -0,0 +1,91 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:ping|ping": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [
Pattern {
original: "child1",
tokens: [
Char(
'c',
),
Char(
'h',
),
Char(
'i',
),
Char(
'l',
),
Char(
'd',
),
Char(
'1',
),
],
is_recursive: false,
has_metachars: false,
},
Pattern {
original: "child2",
tokens: [
Char(
'c',
),
Char(
'h',
),
Char(
'i',
),
Char(
'l',
),
Char(
'd',
),
Char(
'2',
),
],
is_recursive: false,
has_metachars: false,
},
],
scope_id: None,
},
],
},
denied_commands: {},
command_scope: {},
global_scope: {},
}

View File

@@ -0,0 +1,358 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:fs|move": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
4,
),
},
],
"plugin:fs|read_dir": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
3,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "external",
tokens: [
Char(
'e',
),
Char(
'x',
),
Char(
't',
),
Char(
'e',
),
Char(
'r',
),
Char(
'n',
),
Char(
'a',
),
Char(
'l',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
"plugin:fs|read_file": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
2,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
3,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "external",
tokens: [
Char(
'e',
),
Char(
'x',
),
Char(
't',
),
Char(
'e',
),
Char(
'r',
),
Char(
'n',
),
Char(
'a',
),
Char(
'l',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
},
denied_commands: {},
command_scope: {
1: ResolvedScope {
allow: [
Map(
{
"path": String(
"$CONFIG/*",
),
},
),
],
deny: [],
},
2: ResolvedScope {
allow: [
Map(
{
"path": String(
"$CONFIG/*",
),
},
),
],
deny: [],
},
3: ResolvedScope {
allow: [
Map(
{
"path": String(
"$RESOURCE/**",
),
},
),
Map(
{
"path": String(
"$RESOURCE",
),
},
),
],
deny: [],
},
4: ResolvedScope {
allow: [
Map(
{
"path": String(
"$TEMP/*",
),
},
),
],
deny: [],
},
},
global_scope: {
"fs": ResolvedScope {
allow: [
Map(
{
"path": String(
"$APPDATA",
),
},
),
Map(
{
"path": String(
"$DOWNLOAD",
),
},
),
Map(
{
"path": String(
"$DOWNLOAD/**",
),
},
),
],
deny: [
Map(
{
"path": String(
"$HOME",
),
},
),
Map(
{
"path": String(
"$HOME",
),
},
),
],
},
},
}

View File

@@ -0,0 +1,297 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:fs|move": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
4,
),
},
],
"plugin:fs|read_dir": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
3,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
"plugin:fs|read_file": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
2,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
3,
),
},
],
},
denied_commands: {},
command_scope: {
1: ResolvedScope {
allow: [
Map(
{
"path": String(
"$HOME/.config/**",
),
},
),
],
deny: [],
},
2: ResolvedScope {
allow: [
Map(
{
"path": String(
"$HOME/.config/**",
),
},
),
],
deny: [],
},
3: ResolvedScope {
allow: [
Map(
{
"path": String(
"$RESOURCE/**",
),
},
),
Map(
{
"path": String(
"$RESOURCE",
),
},
),
],
deny: [
Map(
{
"path": String(
"$RESOURCE/**/*.key",
),
},
),
],
},
4: ResolvedScope {
allow: [
Map(
{
"path": String(
"$TEMP/*",
),
},
),
],
deny: [],
},
},
global_scope: {
"fs": ResolvedScope {
allow: [
Map(
{
"path": String(
"$APPDATA/**",
),
},
),
Map(
{
"path": String(
"$APPDATA",
),
},
),
Map(
{
"path": String(
"$DOWNLOAD",
),
},
),
Map(
{
"path": String(
"$DOWNLOAD/**",
),
},
),
],
deny: [
Map(
{
"path": String(
"$HOME",
),
},
),
Map(
{
"path": String(
"$APPDATA/*.db",
),
},
),
],
},
},
}

View File

@@ -0,0 +1,247 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:fs|move": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
2,
),
},
],
"plugin:fs|read_dir": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
],
"plugin:fs|read_file": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: None,
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
],
},
denied_commands: {},
command_scope: {
1: ResolvedScope {
allow: [
Map(
{
"path": String(
"$RESOURCE/**",
),
},
),
Map(
{
"path": String(
"$RESOURCE",
),
},
),
],
deny: [],
},
2: ResolvedScope {
allow: [
Map(
{
"path": String(
"$TEMP/*",
),
},
),
],
deny: [],
},
},
global_scope: {
"fs": ResolvedScope {
allow: [
Map(
{
"path": String(
"$APPDATA",
),
},
),
Map(
{
"path": String(
"$DOWNLOAD",
),
},
),
Map(
{
"path": String(
"$DOWNLOAD/**",
),
},
),
],
deny: [
Map(
{
"path": String(
"$HOME",
),
},
),
],
},
},
}

View File

@@ -0,0 +1,95 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:os|spawn": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
2,
),
},
],
},
denied_commands: {},
command_scope: {
1: ResolvedScope {
allow: [
Map(
{
"command": String(
"apt",
),
},
),
],
deny: [],
},
2: ResolvedScope {
allow: [
Map(
{
"command": String(
"servo",
),
},
),
],
deny: [],
},
},
global_scope: {},
}

View File

@@ -0,0 +1,68 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:os|spawn": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
],
},
denied_commands: {},
command_scope: {
1: ResolvedScope {
allow: [
Map(
{
"command": String(
"safari",
),
},
),
],
deny: [],
},
},
global_scope: {
"os": ResolvedScope {
allow: [
Map(
{
"path": String(
"$HOME/Library/**",
),
},
),
],
deny: [],
},
},
}

View File

@@ -0,0 +1,68 @@
---
source: crates/tests/acl/src/lib.rs
expression: resolved
---
Resolved {
has_app_acl: false,
allowed_commands: {
"plugin:os|spawn": [
ResolvedCommand {
context: Local,
windows: [
Pattern {
original: "main",
tokens: [
Char(
'm',
),
Char(
'a',
),
Char(
'i',
),
Char(
'n',
),
],
is_recursive: false,
has_metachars: false,
},
],
webviews: [],
scope_id: Some(
1,
),
},
],
},
denied_commands: {},
command_scope: {
1: ResolvedScope {
allow: [
Map(
{
"command": String(
"edge",
),
},
),
],
deny: [],
},
},
global_scope: {
"os": ResolvedScope {
allow: [],
deny: [
Map(
{
"path": String(
"$APPLOCALDATA/EBWebView/**",
),
},
),
],
},
},
}

View File

@@ -0,0 +1,82 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#[cfg(test)]
mod tests {
use std::{
collections::BTreeMap,
env::temp_dir,
fs::{read_dir, read_to_string},
path::Path,
};
use tauri_utils::{
acl::{build::parse_capabilities, manifest::Manifest, resolved::Resolved},
platform::Target,
};
fn load_plugins(plugins: &[String]) -> BTreeMap<String, Manifest> {
let mut manifests = BTreeMap::new();
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let out_dir = temp_dir();
for plugin in plugins {
let plugin_path = manifest_dir.join("fixtures").join("plugins").join(plugin);
let permission_files = tauri_utils::acl::build::define_permissions(
&format!("{}/*.toml", plugin_path.display()),
plugin,
&out_dir,
|_| true,
)
.expect("failed to define permissions");
let manifest = Manifest::new(permission_files, None);
manifests.insert(plugin.to_string(), manifest);
}
manifests
}
#[test]
fn resolve_acl() {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let fixtures_path = manifest_dir.join("fixtures").join("capabilities");
for fixture_path in read_dir(fixtures_path).expect("failed to read fixtures") {
let fixture_entry = fixture_path.expect("failed to read fixture entry");
let mut settings = insta::Settings::clone_current();
settings.set_snapshot_path(
if fixture_entry.path().file_name().unwrap() == "platform-specific-permissions" {
Path::new("../fixtures/snapshots").join(Target::current().to_string())
} else {
Path::new("../fixtures/snapshots").to_path_buf()
},
);
let _guard = settings.bind_to_scope();
let fixture_plugins_str = read_to_string(fixture_entry.path().join("required-plugins.json"))
.expect("failed to read fixture required-plugins.json file");
let fixture_plugins: Vec<String> = serde_json::from_str(&fixture_plugins_str)
.expect("required-plugins.json is not a valid JSON");
let manifests = load_plugins(&fixture_plugins);
let capabilities = parse_capabilities(&format!("{}/cap*", fixture_entry.path().display()))
.expect("failed to parse capabilities");
let resolved = Resolved::resolve(&manifests, capabilities, Target::current())
.expect("failed to resolve ACL");
insta::assert_debug_snapshot!(
fixture_entry
.path()
.file_name()
.unwrap()
.to_string_lossy()
.to_string(),
resolved
);
}
}
}