feat(plugins): add persistent private filesystem directories (#2051)

Closes #1947

Adds API 1.3 `fs.plugin-dir`: a persistent owner-only directory per plugin (0700 directories / 0600 files on Unix, owner-only ACL on Windows), separate from the packaged code, storage and secrets. The plugin reads and writes under it without fs.* grants, can open files there in the editor and pass their paths to approved programs; editor saves keep the protection, restart keeps the content, uninstall removes it. Traversal and symlink escapes into other plugins' directories are rejected (real-Wasm regressions).

Co-authored-by: arnaud-ritti <[email protected]>
Цей коміт міститься в:
Arnaud Ritti authored and GitHub committed 2026-11-08 06:53:36 +08:00
1 джерело a5db5cdda8
коміт 04b1b863df
84 files changed
+1100 -51

No files matched your search

+18
Переглянути файл
@@ -325,6 +325,24 @@ used to write outside it. `project.write` does the same inside the open
projects, creating missing directories. Both are new in API 1.3
(`engines.openidea = "^1.3"`).
`host::fs::plugin_dir()` (API 1.3) returns a private directory belonging only to
this plugin, separate from its installed code and key-value storage. Reading and
writing inside it needs no `fs.*` or `project.read` grant, including during
activation or provider calls without an open project. The host creates the
directory owner-only (0700 on Unix, an owner-only inheritable ACL on Windows),
and files written there are owner-only from creation (0600 on Unix). Paths are
checked after symlink resolution: another plugin's directory, adjacent paths,
and links escaping this directory receive no implicit grant. Explicit `fs.*`
grants retain their normal behavior.
Use it for generated editor content or caches larger than `storage`. Files and
the directory survive idle reclaim, plugin reloads, updates, and app restarts;
uninstall removes them. There is no TTL or stop-time deletion. A returned path
works with `host::open_location` and as an argument to an approved process;
normal UI, trust, and process approval rules still apply. Editor saves preserve
the private file's permissions. Filesystem writes keep the usual size limits,
encoding behavior, and protection of unsaved editor changes.
Logging, notifications, status bar items, tasks and run-time contributions
are always available. Calling a gated function without its capability returns
`Error::Denied("<capability>")` — the plugin keeps running and can degrade
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
61485dc08ad905dbb2d8d211ef8be8a6e88292d2d41ba11c15be54c672eccba0
710e95defa1995356f259b1fd69c7df8cfe1d0c1c55b04df0f0d7173b7cb61b9
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1111db3957880758cf4ae2c34c95510846aef43c73ddeb03e901d5a10610544e
145b164b99c18b6e9d0d0c2704fff0fa878fc56761d5cb76669a2a0cc9ddb3aa
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
8d0c17fb643bb7368877ae7cfe342286bc1c8a1fc8fdc00c7491beb5c24390fe
897d2b653cb5b8a91ef806307efa6fefd773c0aaacc746bf87fd7d2bea4bf147
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ab15b403fb606ea226b491098f7b06335a03735d46a80a2d6e00cb042d201960
9724a33ae85205245ec0bb94369d55e2df08aa328e872af2c03ad45c230d7865
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ab64135fcdeee8579e9b9613b47cccd94f66ff46d7c3a0507320a1364ffe8921
d5245ffd43097795062f7bb887162c13d99d48b68f7883e4ff6adb41a663d157
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
5b73dc19e676472cb94ec6c020d7fc6279b59aa8e8439b3840ece799035f1a2b
2fbf40065eae7c9ef0e927dfae4fde1f698858b2ae3047db9c242a12e443d823
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c6763b53f7d4228678827234dfd02e413bb604c867b4ead8cd185316e6482897
7b5480ba83b888a43bb641f95ad679d60b132548516b92d91d8d7e118220f2c3
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1c735085dc8386adc94d4598eea8a2d5e582a98894f7742f83b97a9ddda7fb60
6762b2c436f8dd0a586759cbf0b2cc316560f581619fc32efb717f96505f720b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1d0dcf3288ec08122b64e51fceb0055f3627531b7152a3cccfe7d44ddd4887c2
f8e3d365d62382437b4af9d7889c135725cf437bb1ec3a1144466af72ef8f859
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ae73ca009c7b36b3dd118a3a903c0132baf9c78baaceffe8d2a8a4ea8d182d1d
9e8e7a1fc6aa73e11655114e4cf8c642ea6ea2318b0711fb4e1a82fb0f353bae
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
730d2bc7b15d2598840ec8668555f89cdf77b800c2ce21df7601880c57be6b2b
428dd3b2ebc9bc248775e385fc431f0621e564533ed54f70d12bf5db950627cb