@openclaw/matrix 2026.11.10 → 2026.12.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +57 -0
- package/node_modules/@openclaw/fs-safe/README.md +6 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +10 -0
- package/node_modules/@openclaw/fs-safe/dist/bounded-read.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/bounded-read.js +15 -4
- package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +11 -2
- package/node_modules/@openclaw/fs-safe/dist/drvfs-parent.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/drvfs-parent.js +38 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-acquisition.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-acquisition.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +13 -8
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-io.js +13 -0
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-mutation.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-mutation.js +34 -24
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-stale-admission.js +7 -2
- package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +20 -20
- package/node_modules/@openclaw/fs-safe/dist/file-observation.d.ts +13 -2
- package/node_modules/@openclaw/fs-safe/dist/file-observation.js +8 -4
- package/node_modules/@openclaw/fs-safe/dist/file-store-sync-write.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store-sync-write.js +11 -1
- package/node_modules/@openclaw/fs-safe/dist/file-store-write-options.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store-write-options.js +17 -0
- package/node_modules/@openclaw/fs-safe/dist/file-store.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/file-store.js +12 -16
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/guest.js +3 -4
- package/node_modules/@openclaw/fs-safe/dist/json-document-store.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/json-document-store.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/json-store.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/json.d.ts +5 -2
- package/node_modules/@openclaw/fs-safe/dist/json.js +6 -2
- package/node_modules/@openclaw/fs-safe/dist/local-file-descriptor.js +16 -10
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +4 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.d.ts +20 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.js +18 -0
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.d.ts +3 -18
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +48 -24
- package/node_modules/@openclaw/fs-safe/dist/opened-file-failure.js +19 -7
- package/node_modules/@openclaw/fs-safe/dist/output.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/output.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/path-policy.js +4 -1
- package/node_modules/@openclaw/fs-safe/dist/permissions-windows.js +35 -10
- package/node_modules/@openclaw/fs-safe/dist/pinned-open.d.ts +9 -2
- package/node_modules/@openclaw/fs-safe/dist/pinned-open.js +42 -23
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +85 -34
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +4 -0
- package/node_modules/@openclaw/fs-safe/dist/prepare-directory-mode.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/prepare-directory-mode.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/publication-recovery.d.ts +24 -0
- package/node_modules/@openclaw/fs-safe/dist/publication-recovery.js +151 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/realpath.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/realpath.js +22 -11
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +5 -0
- package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.d.ts +7 -0
- package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.js +75 -2
- package/node_modules/@openclaw/fs-safe/dist/replace-file-types.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/replace-file.js +14 -10
- package/node_modules/@openclaw/fs-safe/dist/root-context.js +28 -12
- package/node_modules/@openclaw/fs-safe/dist/root-copy.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/root-file-final-admission.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/root-file-final-admission.js +53 -36
- package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/root-file.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/root-file.js +24 -13
- package/node_modules/@openclaw/fs-safe/dist/root-impl.js +17 -1
- package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +4 -2
- package/node_modules/@openclaw/fs-safe/dist/root-path.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/root-path.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/root-read-admission.js +31 -9
- package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +6 -2
- package/node_modules/@openclaw/fs-safe/dist/secret-file.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/secret-file.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +84 -4
- package/node_modules/@openclaw/fs-safe/dist/sibling-temp.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-temp.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +22 -15
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-publication.d.ts +22 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-publication.js +303 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +9 -1
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-root.d.ts +8 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-root.js +37 -3
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-staging.d.ts +14 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-staging.js +155 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-stale-admission.js +7 -2
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-write.d.ts +10 -0
- package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-write.js +143 -0
- package/node_modules/@openclaw/fs-safe/dist/temp-target.js +28 -7
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +34 -18
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +13 -3
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.js +1 -1
- package/node_modules/@openclaw/fs-safe/dist/temp-workspace-types.d.ts +9 -0
- package/node_modules/@openclaw/fs-safe/dist/test-hooks.d.ts +6 -0
- package/node_modules/@openclaw/fs-safe/dist/text-atomic.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/text-atomic.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-owner.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-owner.js +2 -1
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +6 -1
- package/node_modules/@openclaw/fs-safe/docs/atomic.md +64 -0
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +69 -0
- package/node_modules/@openclaw/fs-safe/docs/file-store.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/json-store.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/json.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/output.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/permissions.md +20 -7
- package/node_modules/@openclaw/fs-safe/docs/reading.md +24 -9
- package/node_modules/@openclaw/fs-safe/docs/root.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +12 -7
- package/node_modules/@openclaw/fs-safe/docs/staged-file.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/temp-isolation-reference.md +73 -0
- package/node_modules/@openclaw/fs-safe/docs/temp.md +65 -0
- package/node_modules/@openclaw/fs-safe/docs/testing.md +1 -0
- package/node_modules/@openclaw/fs-safe/docs/writing.md +2 -0
- package/node_modules/@openclaw/fs-safe/package.json +25 -20
- package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-freebsd-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
- package/package.json +5 -5
|
@@ -100,6 +100,38 @@ On Linux x64 or arm64 with Docker, run `pnpm build`, copy the matching GNU artif
|
|
|
100
100
|
artifact and run native security and no-replace move tests in Rocky Linux 8
|
|
101
101
|
(glibc 2.28). Both GNU architectures execute this load test on matching runners.
|
|
102
102
|
|
|
103
|
+
### FreeBSD runtime admission
|
|
104
|
+
|
|
105
|
+
The shared FreeBSD 14.4 workflow prepares JavaScript with Node 24.22.1 and
|
|
106
|
+
installs the FreeBSD `node24` package inside each VM. Before native builds or
|
|
107
|
+
package proofs, it verifies the actual executable is stable Node 24, version
|
|
108
|
+
24.22.1 or newer, and matches the expected FreeBSD architecture. The package
|
|
109
|
+
name alone does not establish that its security fixes are present. If admission
|
|
110
|
+
fails, refresh FreeBSD package metadata and upgrade the selected Node package
|
|
111
|
+
before rerunning. Do not bypass the floor to obtain native artifacts; a missing
|
|
112
|
+
patched supplier package blocks this qualification route.
|
|
113
|
+
|
|
114
|
+
### Windows runtime contract
|
|
115
|
+
|
|
116
|
+
Windows x64 and ARM64 addons statically link compiler-specific runtime support
|
|
117
|
+
and dynamically link the inbox, OS-serviced UCRT. Consumers do not need a
|
|
118
|
+
separate Visual C++ Redistributable. `pnpm native:build` and release builds use
|
|
119
|
+
`scripts/build-native.mjs`; it preserves inherited Rust flags and Cargo's
|
|
120
|
+
`CARGO_ENCODED_RUSTFLAGS` precedence while appending the hybrid CRT settings.
|
|
121
|
+
Build, staging, signing preparation and package collection reject ordinary or
|
|
122
|
+
delay imports of VC redistributable DLLs, missing OS UCRT imports, and the wrong
|
|
123
|
+
native architecture or PE kind.
|
|
124
|
+
|
|
125
|
+
The security helper remains a deterministic .NET Framework 4.6.2 IL-only AnyCPU
|
|
126
|
+
PE32 executable, using the Windows CLR and OS P/Invoke libraries. It has no
|
|
127
|
+
native addon architecture or UCRT-import requirement. Its build and package
|
|
128
|
+
gates check that managed format and reject VC redistributable imports without
|
|
129
|
+
changing the helper's framework, signing, unsigned reproducibility comparison
|
|
130
|
+
or signed-byte manifest verification. Import inspection accepts Authenticode
|
|
131
|
+
certificate overlays and never rewrites signed bytes.
|
|
132
|
+
Test fixtures, harnesses and debug builds do not ship and keep their existing
|
|
133
|
+
runtime configuration; they are not subject to release runtime admission.
|
|
134
|
+
|
|
103
135
|
### Windows ARM64 builds
|
|
104
136
|
|
|
105
137
|
`windows-11-arm` builds and runs the ARM64 MSVC addon using native ARM64 Node
|
|
@@ -191,6 +223,43 @@ pnpm build
|
|
|
191
223
|
pnpm test --config scripts/slow-package-copy.config.ts
|
|
192
224
|
```
|
|
193
225
|
|
|
226
|
+
### Windows long-path temporary-file consumers
|
|
227
|
+
|
|
228
|
+
`pnpm package:smoke` includes `consumer-temp-file-probe.mjs` on Windows in
|
|
229
|
+
each normal root-only npm and pnpm installation. The existing bundled-package
|
|
230
|
+
CI jobs run it on Node 22, 24 and 26 using the collected root and native binding.
|
|
231
|
+
It imports `@openclaw/fs-safe/advanced` from the installed package, checks
|
|
232
|
+
compatible and real-native bounded cleanup, and verifies file round-trips,
|
|
233
|
+
path spelling, scoped rejection, and natural/explicit process-exit cleanup.
|
|
234
|
+
Native-off consumers also verify bounded cleanup refuses before creation.
|
|
235
|
+
Receipts, module hashes and source identity are recorded in `consumer-proof.json`.
|
|
236
|
+
|
|
237
|
+
### Windows public-permission/browser boundary proof
|
|
238
|
+
|
|
239
|
+
After `pnpm native:build` and `pnpm build`, Windows x64 contributors with Node
|
|
240
|
+
26 can run:
|
|
241
|
+
|
|
242
|
+
```powershell
|
|
243
|
+
$env:FS_SAFE_NATIVE_MODE = "require"
|
|
244
|
+
pnpm test test/permissions-windows-native.test.ts
|
|
245
|
+
node scripts/windows-permissions-browser-proof.mjs
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The regression suite applies real ACLs only to task-owned temporary fixtures.
|
|
249
|
+
The browser proof downloads and SHA-256-verifies the affected core's pinned
|
|
250
|
+
layout module, strips TypeScript syntax, and executes the entire module with
|
|
251
|
+
real filesystem operations and this checkout's built permission inspector.
|
|
252
|
+
Its existing dependency seam redirects state and browser-profile roots into
|
|
253
|
+
temporary storage; it never consults an installed OpenClaw or Chrome profile.
|
|
254
|
+
Filesystem wrappers count and forward copy/profile-read operations.
|
|
255
|
+
|
|
256
|
+
The proof creates user-owned source, destination, and profile fixtures with
|
|
257
|
+
TrustedInstaller and other untrusted write grants. It checks refusal before
|
|
258
|
+
copying or reading profile bytes, and verifies private secure reads remain
|
|
259
|
+
strict. Ownership acceptance is covered by synthetic native/fallback descriptor
|
|
260
|
+
tests; changing a real fixture to TrustedInstaller ownership requires privileges
|
|
261
|
+
and is not attempted by this non-elevated proof.
|
|
262
|
+
|
|
194
263
|
## Checks
|
|
195
264
|
|
|
196
265
|
Run the complete repository gate before handoff:
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# File store
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
Store defaults and write options accept `allowDrvfsRenameRecovery`, including synchronous stores and private writes. Buffered/JSON writes compare bytes during [verified DrvFS recovery](atomic.md#drvfs-hidden-rename-recovery); streamed copies retain metadata checks.
|
|
3
5
|
`fileStore` is exported from `@openclaw/fs-safe/store`. It is a managed wrapper around `root()` for the common "store files under a directory at known modes, prune old ones, hand back absolute paths" pattern. Useful for caches, ingest staging, generated artifacts, anywhere the consumer wants object-style access plus stream and copy primitives.
|
|
4
6
|
|
|
5
7
|
```ts
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# JSON store
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
`jsonStore` and `fileStore().json()` accept `allowDrvfsRenameRecovery`, inherited from the parent store unless overridden. See [verified DrvFS recovery](atomic.md#drvfs-hidden-rename-recovery) before enabling this off-by-default exception.
|
|
3
5
|
`jsonStore` is exported from `@openclaw/fs-safe/store`. It is the single-path
|
|
4
6
|
convenience wrapper for `fileStore(...).json(...)`: a small read-modify-write
|
|
5
7
|
handle around a single JSON file. It bakes in atomic writes, explicit fallback
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# JSON files
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
`WriteJsonSyncOptions`, used by `writeJsonSync`, and `WriteJsonOptions`, used by `writeJson`, accept `allowDrvfsRenameRecovery` in their options. It is off by default; [verified DrvFS recovery](atomic.md#drvfs-hidden-rename-recovery) compares the serialized bytes and documents the residual inode-reuse risk.
|
|
3
5
|
`@openclaw/fs-safe/json` is the standalone JSON surface: strict and lenient read variants plus atomic JSON writes.
|
|
4
6
|
|
|
5
7
|
```ts
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# External outputs
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
For sibling staging, `allowDrvfsRenameRecovery` enables the [verified DrvFS exception](atomic.md#drvfs-hidden-rename-recovery). The callback output is hashed before rename and compared after recovery; the same identity, owner, mode, size and parent checks still apply.
|
|
3
5
|
`@openclaw/fs-safe/output` covers the case where another library insists on
|
|
4
6
|
writing to an absolute path you give it. Browser downloads, renderers, media
|
|
5
7
|
tools, and native libraries often have this shape:
|
|
@@ -42,7 +42,7 @@ POSIX remediation strings shell-quote paths with whitespace or metacharacters
|
|
|
42
42
|
and protect option-like paths with `--`, so they can be presented as commands
|
|
43
43
|
without letting the inspected pathname add shell syntax.
|
|
44
44
|
|
|
45
|
-
`inspectPathPermissions()` follows symlink targets for the effective mode but tells you whether the original path was a symlink. On POSIX it reports owner/group/world bits. On Windows it delegates to the ACL helpers below and also reports `ownerSid` plus `ownerTrusted` when ownership can be verified. `ownerTrusted` is true only for a local volume owned by the current user, LocalSystem,
|
|
45
|
+
`inspectPathPermissions()` follows symlink targets for the effective mode but tells you whether the original path was a symlink. On POSIX it reports owner/group/world bits. On Windows it delegates to the ACL helpers below and also reports `ownerSid` plus `ownerTrusted` when ownership can be verified. `ownerTrusted` is true only for a local volume owned by the current user, LocalSystem, built-in Administrators, or the exact TrustedInstaller service SID; remote filesystems fail closed. This remains a pathname reporting API with the fallbacks described below. `readSecureFile()` obtains descriptor-bound owner/DACL facts for the exact handle it reads, using native support or the packaged prebuilt .NET Framework helper in `auto` and `off` modes.
|
|
46
46
|
|
|
47
47
|
## Advanced Windows ACL helpers
|
|
48
48
|
|
|
@@ -139,8 +139,15 @@ principal classification and remediation command construction.
|
|
|
139
139
|
Missing or nonboolean locality leaves both inspectors unverified; only
|
|
140
140
|
`remote: false` establishes locality for owner trust. An explicit `remote: true`
|
|
141
141
|
retains the ACL report but never grants trusted ownership.
|
|
142
|
-
The
|
|
143
|
-
|
|
142
|
+
The public classifier trusts the current user, SYSTEM, and Administrators. It
|
|
143
|
+
also trusts the exact TrustedInstaller service SID
|
|
144
|
+
`S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464`
|
|
145
|
+
as owner. Its servicing grants are trusted only on TrustedInstaller-, SYSTEM-, or
|
|
146
|
+
Administrators-owned paths without an explicit current-user or current-container
|
|
147
|
+
write grant.
|
|
148
|
+
User-owned profiles with TrustedInstaller write grants still report group write
|
|
149
|
+
access; other service SIDs remain untrusted. Private-file and private-directory
|
|
150
|
+
admission retain their stricter policy.
|
|
144
151
|
The built-in query has a fixed 30-second process deadline. A command failure or timeout returns an
|
|
145
152
|
unverified result (`source: "unknown"`) so callers fail closed. Advanced callers
|
|
146
153
|
that inject a custom `exec` implementation own that executor's deadline.
|
|
@@ -176,10 +183,16 @@ apply to the inspected object, and deny ACEs never subtract coarse grants or
|
|
|
176
183
|
claim effective-access evaluation. Unsupported ACE layouts remain unverified.
|
|
177
184
|
|
|
178
185
|
When the native binding is available, `inspectPathPermissions()`
|
|
179
|
-
reads the owner and DACL directly with Windows security APIs
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
cannot classify
|
|
186
|
+
reads the owner and DACL directly with Windows security APIs and applies the
|
|
187
|
+
same public ACE classifier as the structured .NET fallback. Secure descriptor
|
|
188
|
+
reads and private creation retain their separate, narrower principal policy.
|
|
189
|
+
Descriptor forms it cannot classify completely fall back to the structured
|
|
190
|
+
.NET query; `mode: "off"` exercises that fallback deterministically.
|
|
191
|
+
|
|
192
|
+
Ownership does not establish private access or authorize a later operation.
|
|
193
|
+
Additional untrusted writers remain rejected even on a TrustedInstaller-owned
|
|
194
|
+
path. The inspector does not make a pathname race-free; use descriptor-bound
|
|
195
|
+
secure reads and private creation for their stricter contracts.
|
|
183
196
|
|
|
184
197
|
## Policy-free owner and DACL facts
|
|
185
198
|
|
|
@@ -12,13 +12,20 @@ const opened = await fs.open("large.log"); // FileHandle for strea
|
|
|
12
12
|
|
|
13
13
|
## What every read does
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
On POSIX, `root()` acquisition and `Root.open()`/read admission use asynchronous
|
|
16
|
+
metadata and canonicalization, including `~` expansion and bounded-read size
|
|
17
|
+
observations. Bun uses the native resolver on a worker to preserve physical path,
|
|
18
|
+
permission, and record-lock semantics. The optional native addon can still load
|
|
19
|
+
synchronously on first use. File data is read asynchronously.
|
|
20
|
+
Canonical paths retain native realpath spelling, including Windows short paths.
|
|
21
|
+
|
|
22
|
+
Windows retains synchronous metadata and final admission to preserve native
|
|
23
|
+
namespace and delete-sharing behavior. Explicit synchronous APIs and custom
|
|
24
|
+
`openRootFile` `ioFs` adapters also retain their synchronous contract. This does
|
|
25
|
+
not make every fs-safe operation nonblocking: stat/list/walk observation guards,
|
|
26
|
+
archive extraction, copy, publication, move, directory modes, and supporting lock,
|
|
27
|
+
queue, and secret-file operations may still use synchronous metadata or durability
|
|
28
|
+
calls.
|
|
22
29
|
|
|
23
30
|
Regardless of shape, every read goes through the same boundary checks:
|
|
24
31
|
|
|
@@ -197,7 +204,8 @@ for (const absolutePath of sourceFiles) {
|
|
|
197
204
|
try {
|
|
198
205
|
consume(fs.readFileSync(opened.fd));
|
|
199
206
|
} finally {
|
|
200
|
-
|
|
207
|
+
if (opened.close) opened.close();
|
|
208
|
+
else fs.closeSync(opened.fd);
|
|
201
209
|
}
|
|
202
210
|
}
|
|
203
211
|
```
|
|
@@ -213,7 +221,14 @@ are never cached. Other platforms, unavailable native support, other path
|
|
|
213
221
|
spellings, explicit canonical-root hints, custom filesystem adapters, and
|
|
214
222
|
symlink-following policies retain the ordinary per-open admission path.
|
|
215
223
|
|
|
216
|
-
Successful
|
|
224
|
+
Successful native batch opens include an idempotent `opened.close()` bound to
|
|
225
|
+
the descriptor's originating native closer. Always use it when present, including
|
|
226
|
+
after changing native configuration; otherwise close the Node-opened descriptor
|
|
227
|
+
with `fs.closeSync(opened.fd)`. The optional method preserves the existing result
|
|
228
|
+
fields and ordinary one-shot/fallback results. Do not close the same descriptor
|
|
229
|
+
through both methods.
|
|
230
|
+
|
|
231
|
+
Successful opens transfer descriptor ownership to the caller. Batch `close()` and
|
|
217
232
|
`Symbol.dispose` release retained root descriptors, are idempotent, and do not close
|
|
218
233
|
previously returned descriptors. Opening after close returns a validation
|
|
219
234
|
failure with code `invalid-path`. Keep batches scoped to one operation rather
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# root()
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
Root defaults and buffered write/create options accept `allowDrvfsRenameRecovery`. See the [verified DrvFS exception and residual reuse risk](atomic.md#drvfs-hidden-rename-recovery); the default remains strict.
|
|
3
5
|
`root()` is the primary entry point. It takes a trusted directory and returns a capability-style `Root` handle whose methods accept relative paths and refuse to escape the directory.
|
|
4
6
|
|
|
5
7
|
```ts
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Security model
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
The off-by-default [`allowDrvfsRenameRecovery` exception](atomic.md#drvfs-hidden-rename-recovery) releases continuous inode retention only after post-rename ENOENT on a descriptor-verified DrvFS mount. Exact metadata and available content must match afterward. Recycled identities and identical replacement content remain a residual risk; bounded retries do not bound scheduling pauses.
|
|
3
5
|
`fs-safe` is a library-level guardrail: a capability-style root handle for Node.js code that handles untrusted relative paths. It assumes the calling process already has whatever filesystem permissions it needs and aims to stop trivial path tricks from broadening that authority. It is not a sandbox and does not replace operating-system isolation.
|
|
4
6
|
|
|
5
7
|
The same shape exists in other languages: Go's [`os.Root` / `OpenInRoot`](https://go.dev/blog/osroot) and Rust's [`cap-std`](https://github.com/bytecodealliance/cap-std) both expose a root handle whose operations refuse to escape it. `fs-safe` is the Node-side equivalent: a single `root()` capability that carries the boundary across every read, write, move, and remove, instead of leaving each call site to redo `path.resolve(...).startsWith(...)` and hope.
|
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
For [Linux kernel write leases](platform-capabilities.md#linux-write-leases), `FileWriteLease.isHeld() === false` means “do not act on the file,” including while the kernel is still processing a lease break. The caller’s `SIGIO` handler still owns break notification.
|
|
4
4
|
|
|
5
|
-
`acquireFileLock()` and `withFileLock()` provide a cross-process file lock with retry and process-exit cleanup. The lock is
|
|
5
|
+
`acquireFileLock()` and `withFileLock()` provide a cross-process file lock with retry and process-exit cleanup. The lock is a sidecar file (e.g. `state.json` ↔ `state.json.lock`). Each contender writes and syncs the complete owner record, including its ownership token, to a private same-directory staging file before claiming the final name with native no-replace rename or a hardlink. Exactly one contender can publish; neither operation replaces an existing lock. This applies to raw and Root-backed acquisition, both async and sync.
|
|
6
|
+
|
|
7
|
+
With either publication primitive, a crash before publication leaves no final lock; a crash after publication leaves a complete owner record. The containing directory is synced where supported. These are process-crash guarantees, not a promise against every filesystem or storage device's power-loss behavior. Hardlink publication briefly has two names for the same complete file. Root-backed contenders recognize a matching staging inode and retry without reading or reclaiming that linked record; ordinary Root readers retain their hardlink policy. The staging link is removed before acquisition succeeds.
|
|
8
|
+
|
|
9
|
+
Directory persistence remains best-effort when directory read access or directory fsync is unavailable; this does not prevent otherwise permitted lock acquisition. Other I/O errors and revoked mutation authority still fail acquisition. After a crash leaves both hardlinks, guarded staging cleanup can remove the abandoned link before the existing stale-owner policy inspects the complete final record.
|
|
10
|
+
|
|
11
|
+
When native no-replace rename is unavailable and the filesystem refuses hardlinks with a recognized unsupported-operation error, acquisition falls back to exclusive creation (`O_EXCL`) of the final lock and writes and syncs the owner record through that descriptor. This preserves mutual exclusion on mounts such as FUSE, exFAT, SMB, and Android/Termux without hardlink support. A hardlink permission refusal also has to pass this exclusive open; actual directory permission errors, identity failures, and Root policy failures still propagate. Existing locks are never replaced.
|
|
12
|
+
|
|
13
|
+
This compatibility fallback has a small crash window: contenders can see an empty or partial owner record while it is being written, and a crash can leave that record behind. Unwritten bytes remain NUL-padded until the complete record is written, so even a finished JSON prefix with an unfinished ownership token remains unparseable. Empty records and records containing unwritten NUL padding remain contention and are never reclaimed by age, including through stale-recovery admission and custom parsers. Custom parsers are skipped for empty or NUL-padded records and otherwise retain their legacy-format and exception behavior; without a custom parser, malformed JSON also remains contention. An explicit `shouldReclaim` callback still receives `null` for these records so it can report application-specific diagnostics: `false` keeps waiting, while `true` fails closed with `file_lock_stale`. It never authorizes removal of an unverifiable record, even with `remove-if-unchanged`. Existing empty or incomplete locks remain untouched and require application-owned offline recovery after proving every possible writer has stopped (for example, Doctor can name the lock needing recovery).
|
|
14
|
+
|
|
15
|
+
Staging files use a reserved `.fs-safe-lock-<namespace>-<pid>-<random>.tmp` name. Before staging, an acquisition examines at most 64 directory entries for abandoned stages in its own target/hostname namespace. If the final record has a second link, publication recognition can scan farther and select at most one exact matching stage for the same guarded cleanup. It removes only identity-verified regular files whose local PID is confirmed absent; live or reused PIDs, other targets, unknown ownership, and ambiguous identities are preserved. Root mutation policies are checked against each candidate staging path before removal. A crash during hardlink publication can leave a second staging link; cleanup removes that link only, never the final lock. This bounded, best-effort cleanup may leave unrelated artifacts outside the opportunistic scan or artifacts on filesystems with inconclusive identity. Applications may remove remaining staging artifacts during explicit offline recovery after stopping every owner, including other hosts sharing the directory. No age-based lock or staging reclamation is used.
|
|
6
16
|
|
|
7
17
|
On Windows, both the target and an explicitly supplied `lockPath` reject NTFS
|
|
8
18
|
alternate-stream and directory-index namespace spellings before parent creation,
|
|
@@ -11,12 +21,7 @@ normal meaning, and ordinary colon-bearing POSIX paths remain valid.
|
|
|
11
21
|
|
|
12
22
|
JavaScript raw-sidecar creation passes mode `0o600` to that exclusive open. On POSIX, the process umask may further restrict the new file but cannot add group or other access. No pathname `chmod` fallback is used.
|
|
13
23
|
|
|
14
|
-
Root-backed lock records and reclaim guards
|
|
15
|
-
exclusively, including with the native backend. The native path retains the
|
|
16
|
-
admitted parent descriptor and removes incomplete claims only while their exact
|
|
17
|
-
identity remains owned. Ordinary Root creates still stage privately; lock records
|
|
18
|
-
use this internal exclusive-create path so racing contenders can retry without
|
|
19
|
-
an ambiguous rename outcome.
|
|
24
|
+
Root-backed lock records and reclaim guards retain their admitted parent and native cleanup receipt through publication. Their internal create path uses the same complete-record publication and the same exclusive-create compatibility fallback, while preserving Root mutation policy and exact identity checks. Ordinary Root creates retain their existing publication contract.
|
|
20
25
|
|
|
21
26
|
```ts
|
|
22
27
|
import { acquireFileLock } from "@openclaw/fs-safe/file-lock";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Retained-directory staging
|
|
3
|
+
|
|
4
|
+
`stageFileInDirectory` accepts `allowDrvfsRenameRecovery`. It is off by default and retains exact staged bytes for the [verified DrvFS recovery check](atomic.md#drvfs-hidden-rename-recovery). Restrictive modes are applied before rename when this option is enabled.
|
|
3
5
|
description: "Prepare and publish one file while retaining its original directory for abort cleanup."
|
|
4
6
|
---
|
|
5
7
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Temp workspace isolation reference
|
|
2
|
+
|
|
3
|
+
This reference demonstrates one way to satisfy the lifetime isolation
|
|
4
|
+
precondition for `trustedWritableAncestors`. It qualifies only this configuration;
|
|
5
|
+
it does not establish that another deployment has equivalent isolation.
|
|
6
|
+
|
|
7
|
+
The trusted host runs as UID/GID 10001. Its private temp root is owned by that
|
|
8
|
+
identity at mode `0700`, beneath a root-owned volume directory at mode `2777`.
|
|
9
|
+
An untrusted process uses the same kernel UID/GID. A trusted root supervisor
|
|
10
|
+
places that process in separate mount, PID, network, IPC, and UTS namespaces,
|
|
11
|
+
enters a minimal filesystem root, drops all capabilities and supplementary
|
|
12
|
+
groups, and sets `no_new_privs` before starting untrusted code.
|
|
13
|
+
|
|
14
|
+
The untrusted view contains read-only runtime binaries, a namespace-local
|
|
15
|
+
`/proc`, and a separate writable `/workspace`. It has no mount of the trusted
|
|
16
|
+
temp ancestry, host `/proc`, inherited directory descriptors, or host control
|
|
17
|
+
sockets. Its environment contains no credentials. The PID namespace prevents
|
|
18
|
+
access to same-UID trusted host processes through host process paths. The
|
|
19
|
+
privileged namespace launcher and kernel are trusted; kernel escapes and
|
|
20
|
+
malicious administrators are outside this reference's threat model.
|
|
21
|
+
This proof addresses filesystem namespace integrity; it does not qualify
|
|
22
|
+
resource limits or a complete application sandbox.
|
|
23
|
+
|
|
24
|
+
The enforcement mechanism is the restricted filesystem and process view for
|
|
25
|
+
the entire untrusted process lifetime. A dedicated workload, matching UID,
|
|
26
|
+
private directory modes, or removal of an environment setting alone does not
|
|
27
|
+
provide that mechanism. Any untrusted descendants must remain under equivalent
|
|
28
|
+
restrictions, including during restart and recovery.
|
|
29
|
+
|
|
30
|
+
## Run the proof
|
|
31
|
+
|
|
32
|
+
Use a disposable Linux VM or an isolated Crabbox runner with Node, pnpm, Rust,
|
|
33
|
+
the package build prerequisites, and util-linux (`unshare`, `mount`, `chroot`,
|
|
34
|
+
and `setpriv`). The supervisor needs root to create the namespaces; the host
|
|
35
|
+
and untrusted filesystem operations run unprivileged. Build the package and
|
|
36
|
+
optionally its native binding first:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
pnpm install --frozen-lockfile
|
|
40
|
+
pnpm native:build
|
|
41
|
+
pnpm build
|
|
42
|
+
sudo env "PATH=$PATH" pnpm proof:temp-isolation
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Do not run the privileged proof on a production host. It creates only temporary
|
|
46
|
+
fixtures and mounts inside its task-owned mount namespaces. The proof fails
|
|
47
|
+
when required isolation features are unavailable rather than skipping them.
|
|
48
|
+
|
|
49
|
+
The unsafe control confirms that the same UID can replace a private root when
|
|
50
|
+
given the writable ancestry. The isolated adversary then repeatedly attempts
|
|
51
|
+
root/workspace rename, removal/recreation, symlink substitution, and process-root
|
|
52
|
+
access while trusted workspace writes and reads continue. It must still be
|
|
53
|
+
able to write its permitted workspace. Protected directory identities must stay
|
|
54
|
+
unchanged. The adversary remains active across normal stop/start, a killed host
|
|
55
|
+
followed by recovery, and overlapping trusted hosts. Normally stopped workspaces
|
|
56
|
+
must clean up successfully; the killed host's workspace must remain intact.
|
|
57
|
+
The proof runs with native mode `off` and `auto`; `auto` exercises a native
|
|
58
|
+
binding only when one has been built and staged.
|
|
59
|
+
It stages a root-owned, read-only copy of the runtime for unprivileged trusted
|
|
60
|
+
workers, so the invoking checkout can remain private to the runner's login user.
|
|
61
|
+
The JSON result records actual native loading, runtime and reference hashes,
|
|
62
|
+
and the Node/kernel versions so the proof can be tied to the tested artifacts.
|
|
63
|
+
|
|
64
|
+
## Applying the result
|
|
65
|
+
|
|
66
|
+
Retain the exact source revision or candidate content hash, runtime image,
|
|
67
|
+
command, configuration, and JSON result. A production deployment needs a review
|
|
68
|
+
of its actual mounts, process namespaces, identities, privilege restrictions,
|
|
69
|
+
descriptor/socket handoffs, other writers, and lifecycle enforcement against
|
|
70
|
+
this contract. Revalidate after changes to that boundary. The library warning
|
|
71
|
+
reports reliance on external isolation and does not verify equivalence.
|
|
72
|
+
|
|
73
|
+
If equivalence cannot be established, keep `trustedWritableAncestors` disabled.
|
|
@@ -47,6 +47,58 @@ under trusted ancestry. Do not make shared `/tmp` private or take ownership of
|
|
|
47
47
|
another user's directory. A caller's preferred root takes precedence over
|
|
48
48
|
`TMPDIR`; changing `TMPDIR` only changes the resolver's fallback location.
|
|
49
49
|
|
|
50
|
+
### Externally isolated ancestors
|
|
51
|
+
|
|
52
|
+
When a deployment excludes untrusted writers through external isolation, it
|
|
53
|
+
can pass `trustedWritableAncestors` to allow group/world-write on exact named
|
|
54
|
+
ancestors without sticky protection. For example, an isolated volume mounted
|
|
55
|
+
at `/sandbox` can contain a private temp root:
|
|
56
|
+
|
|
57
|
+
Untrusted processes, including same-UID model tools, terminal sessions, and
|
|
58
|
+
worker subprocesses, must not be able to rename or recreate the trusted
|
|
59
|
+
ancestry. Otherwise, later workspace reads or writes may target replacement
|
|
60
|
+
directories. Private root/child permissions and `cleanupSafety: "require-bounded"`
|
|
61
|
+
do not prevent redirected I/O. A volume dedicated to one workload is insufficient
|
|
62
|
+
if untrusted processes inside that workload can mutate this ancestry. Isolation
|
|
63
|
+
must hold from admission through the completion of workspace use and cleanup.
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
await withTempWorkspace({
|
|
67
|
+
rootDir: "/sandbox/private-temp",
|
|
68
|
+
prefix: "job-",
|
|
69
|
+
// Deployment isolation excludes every untrusted writer for the workspace lifetime.
|
|
70
|
+
trustedWritableAncestors: ["/sandbox"],
|
|
71
|
+
}, async (workspace) => {
|
|
72
|
+
await workspace.writeText("result.txt", "done");
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Entries must be existing, normalized, canonical absolute paths; symlink aliases
|
|
77
|
+
are rejected. Matching is exact, not recursive or by prefix. The list is copied
|
|
78
|
+
at admission, and omitted or empty lists keep the default policy. All four
|
|
79
|
+
workspace helpers accept the option; it does not configure other fs-safe APIs.
|
|
80
|
+
|
|
81
|
+
Only the matching ancestor's writable-mode requirement changes. Ownership,
|
|
82
|
+
directory type, path and identity checks, and private root/child permissions
|
|
83
|
+
still apply, even if the private root is listed. Windows ACL requirements are
|
|
84
|
+
unchanged. This option does not establish isolation: the caller must ensure
|
|
85
|
+
that untrusted writers cannot replace directories through the trusted ancestor for
|
|
86
|
+
the workspace's lifetime. Obtain the list from trusted deployment configuration,
|
|
87
|
+
not workspace contents or untrusted requests.
|
|
88
|
+
|
|
89
|
+
The first ancestor writable-mode check bypassed through this option emits a
|
|
90
|
+
`FS_SAFE_TRUSTED_WRITABLE_ANCESTOR` warning through Node's warning event, once
|
|
91
|
+
per process and without paths. An unused entry or a directory already accepted
|
|
92
|
+
by the strict policy emits no such warning. The warning reports reliance on
|
|
93
|
+
external isolation; it does not verify that isolation or guarantee that the
|
|
94
|
+
remaining workspace admission checks succeed.
|
|
95
|
+
|
|
96
|
+
See the [isolation reference](temp-isolation-reference.md) for a reproducible
|
|
97
|
+
Linux configuration and adversarial lifetime proof. Its result applies only
|
|
98
|
+
to the tested configuration; other deployments must establish equivalent isolation.
|
|
99
|
+
|
|
100
|
+
### Platform and identity checks
|
|
101
|
+
|
|
50
102
|
On Android only (`process.platform === "android"`), ancestors may also be owned
|
|
51
103
|
by Android's OS system identity, AID_SYSTEM (UID 1000). The system is trusted like
|
|
52
104
|
root; this does not trust arbitrary foreign UIDs or stop the walk at `HOME` or
|
|
@@ -384,6 +436,19 @@ type TempFile = {
|
|
|
384
436
|
};
|
|
385
437
|
```
|
|
386
438
|
|
|
439
|
+
`tempFile()` and its `file()` method preserve safe Unicode filenames, including
|
|
440
|
+
CJK text, accents, and emoji. They select a basename, replace unsafe punctuation,
|
|
441
|
+
whitespace, and control characters, and protect Windows device names. Overlong
|
|
442
|
+
names are shortened to 255 UTF-8 bytes as written and under NFC/NFD, preserving
|
|
443
|
+
the extension when possible. The separate safe-path-segment identifier helpers
|
|
444
|
+
remain ASCII-only.
|
|
445
|
+
|
|
446
|
+
On Windows, `tempFile()` and `withTempFile()` support temporary directory paths
|
|
447
|
+
longer than `MAX_PATH` in both cleanup modes without exposing extended-length
|
|
448
|
+
path prefixes to callers. Bounded cleanup retains its existing root
|
|
449
|
+
canonicalization. Path admission, identity checks, and cleanup requirements
|
|
450
|
+
still apply.
|
|
451
|
+
|
|
387
452
|
The default `cleanupSafety: "compatible"` retains the historical temp-file
|
|
388
453
|
behavior without loading or probing the native helper. Cleanup captures the
|
|
389
454
|
directory identity at creation time and preserves a replacement observed by
|
|
@@ -247,6 +247,7 @@ as numbers or bigints.
|
|
|
247
247
|
| `beforeRootListObservation` | `directoryPath, withFileTypes` | After `Root.list()` admits the selected directory, before collecting names and optional metadata. |
|
|
248
248
|
| `afterPinnedWriteFallbackRename` | `targetPath` | After fallback rename commits, before post-commit identity checks. |
|
|
249
249
|
| `beforeSiblingTempWrite` | `tempPath` | Before the `writeViaSiblingTempPath` producer runs, with its selected output pathname still absent. |
|
|
250
|
+
| `beforeSidecarLockPublish` (**sync**) | `lockPath, temporaryPath` | After the complete staging record is synced, immediately before exclusive publication. |
|
|
250
251
|
| `beforeSidecarLockSnapshotOpen` | `lockPath` | After sidecar inspection, before opening it for a bounded snapshot read. |
|
|
251
252
|
| `beforeRegularFileAppendOpen` | `filePath` | After append preflight and the initial size-budget check, before async open. |
|
|
252
253
|
| `beforeRegularFileAppendOpenSync` (**sync**) | `filePath` | The corresponding sync append point, before `openSync`. |
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Writing
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
Writes and creates can explicitly enable `allowDrvfsRenameRecovery` through Root defaults or per-call options. Native and TypeScript paths use the same [DrvFS admission and recovery contract](atomic.md#drvfs-hidden-rename-recovery).
|
|
3
5
|
The `Root` handle exposes a tight set of mutation verbs. Replacement writes
|
|
4
6
|
(`write`, `writeJson`, and `copyIn`) publish with a sibling-temp commit so no
|
|
5
7
|
half-written replacement appears at the destination. Create-only writes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/fs-safe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.2",
|
|
4
4
|
"description": "Capability-style filesystem roots for Node.js apps that handle untrusted relative paths.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"filesystem",
|
|
@@ -157,6 +157,7 @@
|
|
|
157
157
|
"test:coverage:collect": "pnpm build && pnpm archive:wasm:allocator-tests && vitest run --coverage --coverage.reporter=json --coverage.thresholds.lines=0 --coverage.thresholds.functions=0 --coverage.thresholds.statements=0 --coverage.thresholds.branches=0",
|
|
158
158
|
"test:coverage:merge": "node scripts/merge-coverage.mjs",
|
|
159
159
|
"test:security": "vitest run test/fs-safe.test.ts test/read-boundary-bypass.test.ts test/write-boundary-bypass.test.ts test/additional-boundary-bypass.test.ts test/adversarial-boundary-payloads.test.ts",
|
|
160
|
+
"proof:temp-isolation": "node scripts/verify-temp-workspace-isolation.mjs",
|
|
160
161
|
"check": "pnpm lint:file-size && pnpm lint:fs-boundary && pnpm check:runtime",
|
|
161
162
|
"check:runtime": "pnpm build && pnpm archive:wasm:allocator-tests && pnpm docs:check && pnpm test && node scripts/check-pack.mjs",
|
|
162
163
|
"docs:check": "node scripts/check-doc-examples.mjs",
|
|
@@ -177,36 +178,40 @@
|
|
|
177
178
|
"crabbox:warmup": "crabbox warmup",
|
|
178
179
|
"archive:wasm": "node scripts/build-archive-wasm.mjs",
|
|
179
180
|
"archive:wasm:allocator-tests": "node scripts/build-archive-wasm.mjs --allocator-tests",
|
|
180
|
-
"archive:producer-smoke": "node scripts/archive-producer-smoke.mjs"
|
|
181
|
+
"archive:producer-smoke": "node scripts/archive-producer-smoke.mjs",
|
|
182
|
+
"archive:interop:fixtures": "node archive-core/tests/fixtures/generate-interop.mjs",
|
|
183
|
+
"archive:interop:test": "cargo test --locked -p fs-safe-archive-core --test interoperability",
|
|
184
|
+
"archive:interop:wasm": "node archive-core/tests/wasm-interoperability.mjs",
|
|
185
|
+
"archive:interop:writer": "cargo run --locked --quiet -p fs-safe-archive-core --example directory-link-reproducer"
|
|
181
186
|
},
|
|
182
187
|
"optionalDependencies": {
|
|
183
|
-
"@openclaw/fs-safe-darwin-arm64": "0.
|
|
184
|
-
"@openclaw/fs-safe-darwin-x64": "0.
|
|
185
|
-
"@openclaw/fs-safe-freebsd-arm64": "0.
|
|
186
|
-
"@openclaw/fs-safe-freebsd-x64": "0.
|
|
187
|
-
"@openclaw/fs-safe-linux-arm64-gnu": "0.
|
|
188
|
-
"@openclaw/fs-safe-linux-arm64-musl": "0.
|
|
189
|
-
"@openclaw/fs-safe-linux-x64-gnu": "0.
|
|
190
|
-
"@openclaw/fs-safe-linux-x64-musl": "0.
|
|
191
|
-
"@openclaw/fs-safe-win32-arm64-msvc": "0.
|
|
192
|
-
"@openclaw/fs-safe-win32-x64-msvc": "0.
|
|
188
|
+
"@openclaw/fs-safe-darwin-arm64": "0.28.2",
|
|
189
|
+
"@openclaw/fs-safe-darwin-x64": "0.28.2",
|
|
190
|
+
"@openclaw/fs-safe-freebsd-arm64": "0.28.2",
|
|
191
|
+
"@openclaw/fs-safe-freebsd-x64": "0.28.2",
|
|
192
|
+
"@openclaw/fs-safe-linux-arm64-gnu": "0.28.2",
|
|
193
|
+
"@openclaw/fs-safe-linux-arm64-musl": "0.28.2",
|
|
194
|
+
"@openclaw/fs-safe-linux-x64-gnu": "0.28.2",
|
|
195
|
+
"@openclaw/fs-safe-linux-x64-musl": "0.28.2",
|
|
196
|
+
"@openclaw/fs-safe-win32-arm64-msvc": "0.28.2",
|
|
197
|
+
"@openclaw/fs-safe-win32-x64-msvc": "0.28.2",
|
|
193
198
|
"jszip": "^3.10.2"
|
|
194
199
|
},
|
|
195
200
|
"devDependencies": {
|
|
196
|
-
"@emnapi/runtime": "2.0.0-beta.
|
|
197
|
-
"@napi-rs/cli": "3.10.
|
|
198
|
-
"@types/node": "^26.6.
|
|
199
|
-
"@vitest/coverage-v8": "5.
|
|
201
|
+
"@emnapi/runtime": "2.0.0-beta.3",
|
|
202
|
+
"@napi-rs/cli": "3.10.12",
|
|
203
|
+
"@types/node": "^26.6.6",
|
|
204
|
+
"@vitest/coverage-v8": "5.1.1",
|
|
200
205
|
"acorn": "8.19.0",
|
|
201
206
|
"fast-check": "^4.10.2",
|
|
202
207
|
"istanbul-lib-coverage": "3.2.2",
|
|
203
208
|
"istanbul-lib-report": "3.0.1",
|
|
204
209
|
"istanbul-reports": "3.2.0",
|
|
205
|
-
"sigstore": "5.0.
|
|
206
|
-
"tar": "7.5.
|
|
210
|
+
"sigstore": "5.0.1",
|
|
211
|
+
"tar": "7.5.23",
|
|
207
212
|
"typescript": "^7.0.2",
|
|
208
|
-
"vite": "8.3.
|
|
209
|
-
"vitest": "^5.0
|
|
213
|
+
"vite": "8.3.8",
|
|
214
|
+
"vitest": "^5.1.0"
|
|
210
215
|
},
|
|
211
216
|
"engines": {
|
|
212
217
|
"node": ">=22"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|