Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changes/acl-identifier-error-context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"tauri-utils": "patch:enhance"
---

Improve diagnostics for invalid plugin and permission identifiers.

The `Identifier` deserializer now wraps the inner error with the offending identifier string so the message reads `invalid plugin or permission identifier '<value>': ...`, surfacing the bad entry without requiring a grep through the file.

The previous parse failure (`failed to parse JSON: identifiers can only include lowercase ASCII, hyphens which are not leading or trailing, and a single colon if using a prefix at line 16 column 23`) now reads `failed to parse JSON: invalid plugin or permission identifier 'sqlite_proxy:allow-foo': identifiers can only include lowercase ASCII, hyphens which are not leading or trailing, and a single colon if using a prefix at line 16 column 23`.
7 changes: 6 additions & 1 deletion crates/tauri-utils/src/acl/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,12 @@ impl<'de> Deserialize<'de> for Identifier {
where
D: Deserializer<'de>,
{
Self::try_from(String::deserialize(deserializer)?).map_err(serde::de::Error::custom)
let raw = String::deserialize(deserializer)?;
Self::try_from(raw.clone()).map_err(|e| {
serde::de::Error::custom(format!(
"invalid plugin or permission identifier '{raw}': {e}"
))
})
}
}

Expand Down
Loading