mirror of
https://github.com/block/buzz.git
synced 2026-10-30 22:11:36 +00:00
Grant activity windows Tauri capabilities
Co-authored-by: Rizz <302abe414ca6e3134763d2539bfcf145aea2a63fe5f8455204ed602fd40cf381@buzz.block.builderlab.xyz> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window and trusted huddle companions",
|
||||
"windows": ["main", "huddle-*"],
|
||||
"description": "Capability for the main window and trusted companion windows",
|
||||
"windows": ["main", "huddle-*", "agent-activity-*"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:webview:allow-set-webview-zoom",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Guards on the packaged-app Content-Security-Policy in `tauri.conf.json`.
|
||||
//! Guards on packaged-app security configuration in `tauri.conf.json` and
|
||||
//! `capabilities/default.json`.
|
||||
//!
|
||||
//! The CSP is only enforced on assets Tauri itself serves, so neither
|
||||
//! `just dev` (loads the Vite `devUrl`) nor the Playwright suite (runs under
|
||||
@@ -12,6 +13,25 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
const TAURI_CONF: &str = include_str!("../tauri.conf.json");
|
||||
const DEFAULT_CAPABILITY: &str = include_str!("../capabilities/default.json");
|
||||
|
||||
#[test]
|
||||
fn companion_windows_receive_the_default_capability() {
|
||||
let capability: serde_json::Value =
|
||||
serde_json::from_str(DEFAULT_CAPABILITY).expect("default capability is valid JSON");
|
||||
let windows = capability["windows"]
|
||||
.as_array()
|
||||
.expect("default capability declares trusted windows");
|
||||
|
||||
for pattern in ["huddle-*", "agent-activity-*"] {
|
||||
assert!(
|
||||
windows
|
||||
.iter()
|
||||
.any(|window| window.as_str() == Some(pattern)),
|
||||
"default capability must include trusted companion pattern {pattern}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn csp_directives() -> HashMap<String, Vec<String>> {
|
||||
let conf: serde_json::Value =
|
||||
|
||||
Reference in New Issue
Block a user