Skip to content

Commit c2b8f47

Browse files
authored
enhance: include permission identifier in ACL error messages (#15373)
1 parent 472f6d0 commit c2b8f47

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"tauri-utils": "patch:enhance"
3+
---
4+
5+
Improve diagnostics for invalid plugin and permission identifiers.
6+
7+
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.
8+
9+
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`.

‎crates/tauri-utils/src/acl/identifier.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ impl<'de> Deserialize<'de> for Identifier {
216216
where
217217
D: Deserializer<'de>,
218218
{
219-
Self::try_from(String::deserialize(deserializer)?).map_err(serde::de::Error::custom)
219+
let raw = String::deserialize(deserializer)?;
220+
Self::try_from(raw.clone()).map_err(|e| {
221+
serde::de::Error::custom(format!(
222+
"invalid plugin or permission identifier '{raw}': {e}"
223+
))
224+
})
220225
}
221226
}
222227

0 commit comments

Comments
 (0)