mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-26 19:36:46 -06:00
Merge #1181: Refuse text.loadFont path for plugins (@Silvertree2010)
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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"})),
|
||||
|
||||
Reference in New Issue
Block a user