Merge #1191: Deny library.publishToServer to plugins (@Silvertree2010)

This commit is contained in:
bflatastic
2026-10-24 09:18:07 +07:00
+14
View File
@@ -107,6 +107,8 @@ const DENIED: &[&str] = &[
"plugins.",
"libraries.",
"library.add",
// Uploads the open document to a server.
"library.publishToServer",
"edit.undo",
"edit.redo",
"edit.repeat",
@@ -592,3 +594,15 @@ pub fn specs() -> Vec<CommandSpec> {
spec!("plugins.manage", "Manage plugins…", "{} opens the plugins window; returns the list like `plugin.list`", false, manage),
]
}
#[cfg(test)]
mod refusal_tests {
use super::*;
#[test]
fn read_only_plugin_cannot_publish_to_server() {
let m = Manifest::parse(r#"{"id":"x.y","name":"X","main":"plugin.wasm"}"#).unwrap();
let r = refusal(&m, "library.publishToServer", &json!({}));
assert!(r.is_some(), "library.publishToServer uploads the document and must be refused");
}
}