Merge #1181: Refuse text.loadFont path for plugins (@Silvertree2010)

This commit is contained in:
bflatastic
2026-10-24 09:18:13 +07:00
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -134,6 +134,9 @@ fn refusal(m: &Manifest, command: &str, params: &Value) -> Option<String> {
if command == "image.place" && get(params, "path").is_some() {
return Some("plugins can't read files: pass the image as `data`".into());
}
if command == "text.loadFont" && get(params, "path").is_some() {
return Some("plugins can't read files: pass the font as `data`".into());
}
// `path` here is a file on disk (elsewhere it is a vector path or an action's place).
if matches!(command, "variable.export" | "codeConnect.export" | "component.playground") && get(params, "path").is_some() {
return Some("plugins can't write files: leave out `path` to get the result back".into());
+1
View File
@@ -164,6 +164,7 @@ fn files_dialogs_history_and_plugins_are_off_limits() {
("file.saveAs", json!({"path": target})),
("file.open", json!({"path": "C:/Windows/win.ini"})),
("image.place", json!({"path": "secret.png"})),
("text.loadFont", json!({"path": "/etc/hosts"})),
("library.add", json!({"path": "lib.figcraft"})),
("plugin.run", json!({"id": "org.test.deny"})),
("plugin.remove", json!({"id": "org.test.deny"})),