Skip to content

Commit 5e06708

Browse files
committed
fix(fs): allow open, seek and fstat in the write permission sets
The stream path of writeFile calls `open`, which only the nested command list of `allow-write-file` granted (plugins/fs/permissions/write-all.toml, write-files.toml), so `fs:allow-appdata-write-recursive` and the other write sets rejected streamed writes; seek/fstat were missing for FileHandles created under these sets. Adds open, seek and fstat to write-all and write-files. This widens the write sets slightly (open is already implied by allow-write-file); the generated reference does not list set members, so nothing to regenerate.
1 parent 55f9645 commit 5e06708

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎.changes/fix-fs-write-sets-open.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fs: patch
3+
fs-js: patch
4+
---
5+
6+
The `write-all` and `write-files` permissions (and so every `allow-*-write[-recursive]` set) now also allow the `open`, `seek` and `fstat` commands. `writeFile` with a `ReadableStream` uses `open` and failed with "not allowed" under these sets, and the `FileHandle` returned by `create` could not `seek` or `stat`.

‎plugins/fs/permissions/write-all.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ commands.allow = [
1414
"write",
1515
"write_file",
1616
"write_text_file",
17+
# used by `writeFile` with a stream and by the `FileHandle` returned by `create` and `open`
18+
"open",
19+
"seek",
20+
"fstat",
1721
]

‎plugins/fs/permissions/write-files.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ commands.allow = [
1313
"write",
1414
"write_file",
1515
"write_text_file",
16+
# used by `writeFile` with a stream and by the `FileHandle` returned by `create` and `open`
17+
"open",
18+
"seek",
19+
"fstat",
1620
]

0 commit comments

Comments
 (0)