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
);
}
}
}

View File

@@ -0,0 +1 @@
Versions/Current/Headers

View File

@@ -0,0 +1 @@
Versions/Current/Modules

View File

@@ -0,0 +1 @@
Versions/Current/Resources

View File

@@ -0,0 +1,18 @@
//
// test.h
// test
//
// Created by Trey Smith on 9/15/23.
//
#import <Foundation/Foundation.h>
//! Project version number for test.
FOUNDATION_EXPORT double testVersionNumber;
//! Project version string for test.
FOUNDATION_EXPORT const unsigned char testVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <test/PublicHeader.h>

View File

@@ -0,0 +1,6 @@
framework module test {
umbrella header "test.h"
export *
module * { export * }
}

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>22D68</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>test</string>
<key>CFBundleIdentifier</key>
<string>com.tauri.test</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>test</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string></string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>13.3</string>
<key>DTSDKBuild</key>
<string>22E245</string>
<key>DTSDKName</key>
<string>macosx13.3</string>
<key>DTXcode</key>
<string>1431</string>
<key>DTXcodeBuild</key>
<string>14E300c</string>
<key>LSMinimumSystemVersion</key>
<string>13.2</string>
</dict>
</plist>

View File

@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Info.plist</key>
<data>
/aPV7Q20g0elr7OiZJoUNggTOcg=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/test.h</key>
<dict>
<key>hash2</key>
<data>
5RA6Mnq5sNoaC4wKcFe6zymVmEL5Vb44G4BGqFjgZMM=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash2</key>
<data>
C6uLLSnQu9M2qLElVCkeo2JpnvWMxtArinQzmlh3v2A=
</data>
</dict>
<key>Resources/Info.plist</key>
<dict>
<key>hash2</key>
<data>
nPMotNIMgvMfHtkRdpeehzfBiCZLnksfiD3nldUPzTE=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,15 @@
[package]
name = "restart"
version = "0.1.0"
authors = ["Tauri Programme within The Commons Conservancy"]
license = "Apache-2.0 OR MIT"
edition = "2024"
[dependencies.tauri]
workspace = true
[dev-dependencies]
tempfile = "3"
[features]
process-relaunch-dangerous-allow-symlink-macos = []

View File

@@ -0,0 +1 @@
../../../LICENSE-APACHE-2.0

View File

@@ -0,0 +1 @@
../../../LICENSE-MIT

View File

@@ -0,0 +1 @@
../../../LICENSE.spdx

View File

@@ -0,0 +1,5 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
fn main() {}

View File

@@ -0,0 +1,30 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri::Env;
fn main() {
let mut argv = std::env::args();
let argc = argv.len();
if argc == 0 || argc > 2 {
panic!("restart test binary expect either no arguments or `restart`.")
}
println!(
"{}",
tauri::process::current_binary(&Default::default())
.expect("tauri::process::current_binary could not resolve")
.display()
);
match argv.nth(1).as_deref() {
Some("restart") => {
let mut env = Env::default();
env.args_os.clear();
tauri::process::restart(&env)
}
Some(invalid) => panic!("only argument `restart` is allowed, {invalid} is invalid"),
None => {}
};
}

View File

@@ -0,0 +1,125 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;
/// Helper for generic catch-all errors.
type Result = std::result::Result<(), Box<dyn std::error::Error>>;
/// <https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--1300-1699->
#[cfg(windows)]
const ERROR_PRIVILEGE_NOT_HELD: i32 = 1314;
/// Represents a successfully created symlink.
enum Symlink {
/// Path to the created symlink
Created(PathBuf),
/// A symlink that failed due to missing permissions (Windows).
#[allow(dead_code)]
Privilege,
}
/// Compile the test binary, run it, and compare it with expected output.
///
/// Failing to create a symlink due to permissions issues is also a success
/// for the purpose of this runner.
fn symlink_runner(create_symlinks: impl Fn(&Path) -> io::Result<Symlink>) -> Result {
let mut compiled_binary = PathBuf::from(env!("OUT_DIR")).join("../../../restart");
if cfg!(windows) {
compiled_binary.set_extension("exe");
}
println!("{compiled_binary:?}");
// set up all the temporary file paths
let temp = tempfile::TempDir::new()?;
let bin = temp.path().canonicalize()?.join("restart.exe");
// copy the built restart test binary to our temporary directory
std::fs::copy(compiled_binary, &bin)?;
if let Symlink::Created(link) = create_symlinks(&bin)? {
// run the command from the symlink, so that we can test if restart resolves it correctly
let mut cmd = Command::new(link);
// add the restart parameter so that the invocation will call tauri::process::restart
cmd.arg("restart");
let output = cmd.output()?;
// run `TempDir` destructors to prevent resource leaking if the assertion fails
drop(temp);
if output.status.success() {
// gather the output into a string
let stdout = String::from_utf8_lossy(&output.stdout);
// we expect the output to be the bin path, twice
assert_eq!(stdout, format!("{bin}\n{bin}\n", bin = bin.display()));
} else if cfg!(all(
target_os = "macos",
not(feature = "process-relaunch-dangerous-allow-symlink-macos")
)) {
// we expect this to fail on macOS without the dangerous symlink flag set
let stderr = String::from_utf8_lossy(&output.stderr);
// make sure it's the error that we expect
assert!(stderr.contains(
"StartingBinary found current_exe() that contains a symlink on a non-allowed platform"
));
} else {
// we didn't expect the program to fail in this configuration, just panic
panic!("restart integration test runner failed for unknown reason");
}
}
Ok(())
}
/// Cross-platform way to create a symlink
///
/// Symlinks that failed to create due to permissions issues (like on Windows)
/// are also seen as successful for the purpose of this testing suite.
fn create_symlink(original: &Path, link: PathBuf) -> io::Result<Symlink> {
#[cfg(unix)]
return std::os::unix::fs::symlink(original, &link).map(|()| Symlink::Created(link));
#[cfg(windows)]
return match std::os::windows::fs::symlink_file(original, &link) {
Ok(()) => Ok(Symlink::Created(link)),
Err(e) => match e.raw_os_error() {
Some(ERROR_PRIVILEGE_NOT_HELD) => Ok(Symlink::Privilege),
_ => Err(e),
},
};
}
/// Only use 1 test to prevent cargo from waiting on itself.
///
/// While not ideal, this is fine because they use the same solution for both cases.
#[test]
fn restart_symlinks() -> Result {
// single symlink
symlink_runner(|bin| {
let mut link = bin.to_owned();
link.set_file_name("symlink");
link.set_extension("exe");
create_symlink(bin, link)
})?;
// nested symlinks
symlink_runner(|bin| {
let mut link1 = bin.to_owned();
link1.set_file_name("symlink1");
link1.set_extension("exe");
create_symlink(bin, link1.clone())?;
let mut link2 = bin.to_owned();
link2.set_file_name("symlink2");
link2.set_extension("exe");
create_symlink(&link1, link2)
})
}