Refuse text.loadFont path for plugins

Fixes #1071

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
NetterSilver
2026-10-22 22:57:58 +02:00
co-authored by Claude Haiku 5.5
parent 80f916326f
commit b8741162cd
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -132,6 +132,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"})),