feat(fs): enhance scope config to accept string as well (#1053)

* feat(fs): enhance scope config to accept string as well

* clippy

* Update protocol.rs

* regression resolving path variables

* add change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Amr Bashir
2024-03-26 16:37:03 +02:00
committed by GitHub
parent fe4ad4dd5c
commit f39d362add
10 changed files with 189 additions and 112 deletions
@@ -8,6 +8,7 @@
{
"identifier": "http:default",
"allow": [
"https://tauri.app",
{
"url": "http://localhost:3003"
}
@@ -72,11 +73,7 @@
"path": "$APPDATA/db/**"
}
],
"deny": [
{
"path": "$APPDATA/db/*.stronghold"
}
]
"deny": ["$APPDATA/db/*.stronghold"]
}
]
}
@@ -2133,30 +2133,50 @@
},
"allow": {
"items": {
"title": "Entry",
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"title": "FsScopeEntry",
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"type": "string"
},
{
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"description": "FS scope path.",
"type": "string"
}
}
}
}
]
}
},
"deny": {
"items": {
"title": "Entry",
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"title": "FsScopeEntry",
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"type": "string"
},
{
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"description": "FS scope path.",
"type": "string"
}
}
}
}
]
}
}
}
@@ -2236,8 +2256,8 @@
},
"allow": {
"items": {
"title": "ScopeEntry",
"description": "HTTP scope entry object definition.",
"title": "HttpScopeEntry",
"description": "HTTP scope entry.",
"anyOf": [
{
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
@@ -2260,8 +2280,8 @@
},
"deny": {
"items": {
"title": "ScopeEntry",
"description": "HTTP scope entry object definition.",
"title": "HttpScopeEntry",
"description": "HTTP scope entry.",
"anyOf": [
{
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
@@ -2133,30 +2133,50 @@
},
"allow": {
"items": {
"title": "Entry",
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"title": "FsScopeEntry",
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"type": "string"
},
{
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"description": "FS scope path.",
"type": "string"
}
}
}
}
]
}
},
"deny": {
"items": {
"title": "Entry",
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"title": "FsScopeEntry",
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"type": "string"
},
{
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"description": "FS scope path.",
"type": "string"
}
}
}
}
]
}
}
}
@@ -2236,8 +2256,8 @@
},
"allow": {
"items": {
"title": "ScopeEntry",
"description": "HTTP scope entry object definition.",
"title": "HttpScopeEntry",
"description": "HTTP scope entry.",
"anyOf": [
{
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
@@ -2260,8 +2280,8 @@
},
"deny": {
"items": {
"title": "ScopeEntry",
"description": "HTTP scope entry object definition.",
"title": "HttpScopeEntry",
"description": "HTTP scope entry.",
"anyOf": [
{
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",