pub struct PrivacyConfig {
pub profile: PrivacyProfile,
pub command_allowlist: Option<HashSet<String>>,
pub command_blocklist: HashSet<String>,
pub disabled_tools: HashSet<String>,
pub storage_key_blocklist: HashSet<String>,
pub redactor: Redactor,
pub redaction_enabled: bool,
}Expand description
Privacy controls for the MCP server.
Combines a PrivacyProfile (tiered permission matrix) with fine-grained
overrides: command allowlists/blocklists, per-tool disabling, and output redaction.
Precedence: explicit disabled_tools overrides → profile matrix → allowlist/blocklist.
Fields§
§profile: PrivacyProfileThe active privacy profile tier.
command_allowlist: Option<HashSet<String>>If set, only these Tauri commands can be invoked (positive allowlist).
command_blocklist: HashSet<String>Tauri commands that are always blocked, even if on the allowlist.
disabled_tools: HashSet<String>MCP tool/action names explicitly disabled (override layer on top of profile).
storage_key_blocklist: HashSet<String>localStorage/sessionStorage keys that storage.set must never write
(operator-configured, since which keys carry app trust is app-specific).
redactor: RedactorOutput redactor with regex and JSON-key matching.
redaction_enabled: boolWhether output redaction is active.
Implementations§
Source§impl PrivacyConfig
impl PrivacyConfig
Sourcepub fn is_command_allowed(&self, command: &str) -> bool
pub fn is_command_allowed(&self, command: &str) -> bool
Returns true if the Tauri command passes both the allowlist and blocklist.
Sourcepub fn is_storage_key_allowed(&self, key: &str) -> bool
pub fn is_storage_key_allowed(&self, key: &str) -> bool
Returns true if storage.set may write the given storage key (i.e. the
key is not in the operator’s storage_key_blocklist). Use this to protect
keys an app trusts for auth/role/tier/feature-flag decisions (audit #33).
Sourcepub fn is_tool_enabled(&self, tool_or_action: &str) -> bool
pub fn is_tool_enabled(&self, tool_or_action: &str) -> bool
Returns true if the given tool or qualified action (e.g. "window.manage")
is permitted by the current profile AND not in the explicit disabled set.
Sourcepub fn is_call_allowed(&self, bare_tool: &str, capability: &str) -> bool
pub fn is_call_allowed(&self, bare_tool: &str, capability: &str) -> bool
Authoritative dispatch gate for a tool call.
bare_tool is the top-level tool name (e.g. "recording"); capability
is the canonical matrix identity for the specific action (e.g.
"recording.replay"), as resolved by
mcp::authz::canonical_capability. A call is allowed only when:
- the operator has not explicitly disabled the whole tool by its bare name
(
disable_tool("recording")must block everyrecording.*action); AND - the resolved capability is permitted by the profile and not itself in
disabled_tools.
This is what closes the per-action authorization gap: an action whose handler forgot to check it is still gated here, and a bare-name disable now covers all of a compound tool’s actions.
Sourcepub fn is_invoke_allowed(&self, command: &str) -> bool
pub fn is_invoke_allowed(&self, command: &str) -> bool
Check whether invoke_command is allowed for a specific command name.
In Test profile, invoke_command is only allowed if the command is on the
allowlist. In FullControl, it’s always allowed. In Observe, always blocked.
Sourcepub fn redact_output(&self, output: &str) -> String
pub fn redact_output(&self, output: &str) -> String
Apply redaction rules to the output string if redaction is enabled.