@openclaw/fs-safe 0.11.0 → 0.13.0
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/CHANGELOG.md +119 -0
- package/README.md +15 -8
- package/dist/absolute-path.d.ts.map +1 -1
- package/dist/absolute-path.js +32 -11
- package/dist/advanced.d.ts +3 -1
- package/dist/advanced.d.ts.map +1 -1
- package/dist/advanced.js +3 -1
- package/dist/archive-entry.d.ts.map +1 -1
- package/dist/archive-entry.js +4 -3
- package/dist/archive-gzip-tail.d.ts.map +1 -1
- package/dist/archive-gzip-tail.js +13 -9
- package/dist/archive-input.d.ts.map +1 -1
- package/dist/archive-input.js +6 -2
- package/dist/archive-merge.d.ts.map +1 -1
- package/dist/archive-merge.js +15 -2
- package/dist/archive-native.d.ts.map +1 -1
- package/dist/archive-native.js +7 -19
- package/dist/archive-plan.js +1 -1
- package/dist/archive-read.d.ts.map +1 -1
- package/dist/archive-read.js +55 -46
- package/dist/archive-staging.d.ts.map +1 -1
- package/dist/archive-staging.js +43 -10
- package/dist/archive-tar-inspect.d.ts.map +1 -1
- package/dist/archive-tar-inspect.js +4 -1
- package/dist/archive-zip-admission.d.ts +1 -1
- package/dist/archive-zip-admission.d.ts.map +1 -1
- package/dist/archive-zip-admission.js +2 -2
- package/dist/archive-zip-directory.d.ts +3 -0
- package/dist/archive-zip-directory.d.ts.map +1 -1
- package/dist/archive-zip-directory.js +13 -2
- package/dist/archive-zip-loader.d.ts +3 -2
- package/dist/archive-zip-loader.d.ts.map +1 -1
- package/dist/archive-zip-loader.js +30 -4
- package/dist/archive-zip-manifest.d.ts +5 -0
- package/dist/archive-zip-manifest.d.ts.map +1 -0
- package/dist/archive-zip-manifest.js +22 -0
- package/dist/archive-zip-names.d.ts +6 -1
- package/dist/archive-zip-names.d.ts.map +1 -1
- package/dist/archive-zip-names.js +50 -17
- package/dist/archive-zip-preflight.d.ts.map +1 -1
- package/dist/archive-zip-preflight.js +3 -2
- package/dist/archive.d.ts.map +1 -1
- package/dist/archive.js +9 -4
- package/dist/bounded-read.js +2 -2
- package/dist/darwin-acl.d.ts +4 -0
- package/dist/darwin-acl.d.ts.map +1 -0
- package/dist/darwin-acl.js +24 -0
- package/dist/deny-mutations.d.ts.map +1 -1
- package/dist/deny-mutations.js +8 -2
- package/dist/device-path.d.ts.map +1 -1
- package/dist/device-path.js +5 -3
- package/dist/directory-durability.d.ts.map +1 -1
- package/dist/directory-durability.js +67 -23
- package/dist/directory-entry-path.d.ts +3 -0
- package/dist/directory-entry-path.d.ts.map +1 -0
- package/dist/directory-entry-path.js +21 -0
- package/dist/directory-guard.d.ts +17 -1
- package/dist/directory-guard.d.ts.map +1 -1
- package/dist/directory-guard.js +134 -48
- package/dist/directory-mode-node.d.ts +12 -0
- package/dist/directory-mode-node.d.ts.map +1 -1
- package/dist/directory-mode-node.js +102 -4
- package/dist/effective-uid.d.ts +2 -0
- package/dist/effective-uid.d.ts.map +1 -0
- package/dist/effective-uid.js +25 -0
- package/dist/file-handle-transfer.d.ts.map +1 -1
- package/dist/file-handle-transfer.js +98 -27
- package/dist/file-hash.d.ts.map +1 -1
- package/dist/file-hash.js +12 -2
- package/dist/file-lock-sync.d.ts.map +1 -1
- package/dist/file-lock-sync.js +36 -6
- package/dist/file-lock.d.ts.map +1 -1
- package/dist/file-lock.js +29 -9
- package/dist/file-observation.d.ts +1 -1
- package/dist/file-observation.d.ts.map +1 -1
- package/dist/file-store-boundary.d.ts +6 -2
- package/dist/file-store-boundary.d.ts.map +1 -1
- package/dist/file-store-boundary.js +20 -65
- package/dist/file-store-copy-source.d.ts +5 -0
- package/dist/file-store-copy-source.d.ts.map +1 -0
- package/dist/file-store-copy-source.js +31 -0
- package/dist/file-store-path.d.ts.map +1 -1
- package/dist/file-store-path.js +4 -1
- package/dist/file-store-prune.d.ts.map +1 -1
- package/dist/file-store-prune.js +9 -1
- package/dist/file-store-sync-directory.d.ts +16 -0
- package/dist/file-store-sync-directory.d.ts.map +1 -0
- package/dist/file-store-sync-directory.js +349 -0
- package/dist/file-store.d.ts.map +1 -1
- package/dist/file-store.js +11 -28
- package/dist/filename.d.ts +1 -0
- package/dist/filename.d.ts.map +1 -1
- package/dist/filename.js +85 -23
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +3 -2
- package/dist/guarded-mkdir.d.ts +10 -0
- package/dist/guarded-mkdir.d.ts.map +1 -1
- package/dist/guarded-mkdir.js +217 -33
- package/dist/guest.d.ts.map +1 -1
- package/dist/guest.js +16 -5
- package/dist/home-dir.d.ts.map +1 -1
- package/dist/home-dir.js +73 -10
- package/dist/install-path.d.ts +6 -0
- package/dist/install-path.d.ts.map +1 -1
- package/dist/install-path.js +67 -19
- package/dist/json-durable-queue-ownership.d.ts +8 -0
- package/dist/json-durable-queue-ownership.d.ts.map +1 -1
- package/dist/json-durable-queue-ownership.js +134 -43
- package/dist/json-durable-queue-paths.d.ts +11 -0
- package/dist/json-durable-queue-paths.d.ts.map +1 -0
- package/dist/json-durable-queue-paths.js +42 -0
- package/dist/json-durable-queue-read.d.ts +6 -0
- package/dist/json-durable-queue-read.d.ts.map +1 -0
- package/dist/json-durable-queue-read.js +61 -0
- package/dist/json-durable-queue.d.ts +1 -1
- package/dist/json-durable-queue.d.ts.map +1 -1
- package/dist/json-durable-queue.js +83 -134
- package/dist/json-store.d.ts.map +1 -1
- package/dist/json-store.js +5 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +54 -22
- package/dist/local-file-access.d.ts.map +1 -1
- package/dist/local-file-access.js +4 -0
- package/dist/local-file-descriptor.d.ts +17 -0
- package/dist/local-file-descriptor.d.ts.map +1 -0
- package/dist/local-file-descriptor.js +84 -0
- package/dist/local-roots.d.ts.map +1 -1
- package/dist/local-roots.js +35 -7
- package/dist/move-path-cleanup.d.ts +2 -0
- package/dist/move-path-cleanup.d.ts.map +1 -1
- package/dist/move-path-cleanup.js +44 -18
- package/dist/move-path.d.ts.map +1 -1
- package/dist/move-path.js +31 -6
- package/dist/native-binding.d.ts +21 -0
- package/dist/native-binding.d.ts.map +1 -1
- package/dist/native-directory-observation.d.ts +17 -0
- package/dist/native-directory-observation.d.ts.map +1 -0
- package/dist/native-directory-observation.js +37 -0
- package/dist/native-parent-admission.d.ts +31 -0
- package/dist/native-parent-admission.d.ts.map +1 -0
- package/dist/native-parent-admission.js +124 -0
- package/dist/native-pinned-write-windows.d.ts +0 -1
- package/dist/native-pinned-write-windows.d.ts.map +1 -1
- package/dist/native-pinned-write-windows.js +0 -3
- package/dist/native-pinned-write.d.ts.map +1 -1
- package/dist/native-pinned-write.js +309 -40
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +15 -5
- package/dist/overwrite-file-handle.d.ts.map +1 -1
- package/dist/overwrite-file-handle.js +5 -1
- package/dist/owner-dacl.d.ts.map +1 -1
- package/dist/owner-dacl.js +2 -0
- package/dist/path-policy.d.ts.map +1 -1
- package/dist/path-policy.js +7 -2
- package/dist/path-prefix.d.ts +7 -0
- package/dist/path-prefix.d.ts.map +1 -0
- package/dist/path-prefix.js +82 -0
- package/dist/path-scope-lexical.d.ts +14 -0
- package/dist/path-scope-lexical.d.ts.map +1 -0
- package/dist/path-scope-lexical.js +37 -0
- package/dist/path-segment-route.d.ts +7 -0
- package/dist/path-segment-route.d.ts.map +1 -0
- package/dist/path-segment-route.js +24 -0
- package/dist/path-suffix-aliases.d.ts +10 -0
- package/dist/path-suffix-aliases.d.ts.map +1 -0
- package/dist/path-suffix-aliases.js +386 -0
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +35 -6
- package/dist/permissions-windows.d.ts.map +1 -1
- package/dist/permissions-windows.js +14 -3
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +37 -8
- package/dist/pinned-mutation-admission.d.ts +25 -0
- package/dist/pinned-mutation-admission.d.ts.map +1 -0
- package/dist/pinned-mutation-admission.js +425 -0
- package/dist/pinned-mutation-observation.d.ts +34 -0
- package/dist/pinned-mutation-observation.d.ts.map +1 -0
- package/dist/pinned-mutation-observation.js +142 -0
- package/dist/pinned-mutation-shared-route.d.ts +24 -0
- package/dist/pinned-mutation-shared-route.d.ts.map +1 -0
- package/dist/pinned-mutation-shared-route.js +70 -0
- package/dist/pinned-open.d.ts +6 -0
- package/dist/pinned-open.d.ts.map +1 -1
- package/dist/pinned-open.js +28 -10
- package/dist/pinned-write-types.d.ts +75 -0
- package/dist/pinned-write-types.d.ts.map +1 -0
- package/dist/pinned-write-types.js +1 -0
- package/dist/pinned-write.d.ts +7 -33
- package/dist/pinned-write.d.ts.map +1 -1
- package/dist/pinned-write.js +152 -17
- package/dist/private-directory.d.ts.map +1 -1
- package/dist/private-directory.js +2 -0
- package/dist/private-producer-handoff.d.ts +16 -0
- package/dist/private-producer-handoff.d.ts.map +1 -0
- package/dist/private-producer-handoff.js +272 -0
- package/dist/private-temp-workspace.d.ts +2 -39
- package/dist/private-temp-workspace.d.ts.map +1 -1
- package/dist/private-temp-workspace.js +183 -77
- package/dist/publish-file.d.ts.map +1 -1
- package/dist/publish-file.js +33 -29
- package/dist/regular-file.d.ts.map +1 -1
- package/dist/regular-file.js +56 -45
- package/dist/replace-directory.d.ts.map +1 -1
- package/dist/replace-directory.js +12 -5
- package/dist/replace-file-temp-owner.d.ts +1 -0
- package/dist/replace-file-temp-owner.d.ts.map +1 -1
- package/dist/replace-file-temp-owner.js +12 -1
- package/dist/replace-file.d.ts.map +1 -1
- package/dist/replace-file.js +24 -24
- package/dist/root-boundary.d.ts +29 -0
- package/dist/root-boundary.d.ts.map +1 -0
- package/dist/root-boundary.js +182 -0
- package/dist/root-context.d.ts +12 -1
- package/dist/root-context.d.ts.map +1 -1
- package/dist/root-context.js +89 -16
- package/dist/root-directory-creation.d.ts +13 -0
- package/dist/root-directory-creation.d.ts.map +1 -0
- package/dist/root-directory-creation.js +212 -0
- package/dist/root-directory-list.d.ts +16 -4
- package/dist/root-directory-list.d.ts.map +1 -1
- package/dist/root-directory-list.js +182 -33
- package/dist/root-directory.d.ts +23 -0
- package/dist/root-directory.d.ts.map +1 -0
- package/dist/root-directory.js +141 -0
- package/dist/root-errors.d.ts.map +1 -1
- package/dist/root-errors.js +12 -1
- package/dist/root-file-final-admission.d.ts +21 -0
- package/dist/root-file-final-admission.d.ts.map +1 -0
- package/dist/root-file-final-admission.js +83 -0
- package/dist/root-file.d.ts.map +1 -1
- package/dist/root-file.js +103 -24
- package/dist/root-impl.d.ts +1 -0
- package/dist/root-impl.d.ts.map +1 -1
- package/dist/root-impl.js +316 -325
- package/dist/root-move-noreplace.d.ts +14 -0
- package/dist/root-move-noreplace.d.ts.map +1 -0
- package/dist/root-move-noreplace.js +202 -0
- package/dist/root-move-preflight.d.ts +8 -0
- package/dist/root-move-preflight.d.ts.map +1 -0
- package/dist/root-move-preflight.js +16 -0
- package/dist/root-observed-path.d.ts +9 -0
- package/dist/root-observed-path.d.ts.map +1 -0
- package/dist/root-observed-path.js +95 -0
- package/dist/root-path-errors.d.ts +12 -0
- package/dist/root-path-errors.d.ts.map +1 -0
- package/dist/root-path-errors.js +13 -0
- package/dist/root-path-existing.d.ts +2 -0
- package/dist/root-path-existing.d.ts.map +1 -1
- package/dist/root-path-existing.js +63 -22
- package/dist/root-path-observation.d.ts +63 -0
- package/dist/root-path-observation.d.ts.map +1 -0
- package/dist/root-path-observation.js +180 -0
- package/dist/root-path-stat.d.ts +5 -0
- package/dist/root-path-stat.d.ts.map +1 -0
- package/dist/root-path-stat.js +101 -0
- package/dist/root-path-symlink.d.ts.map +1 -1
- package/dist/root-path-symlink.js +23 -4
- package/dist/root-path.d.ts +13 -0
- package/dist/root-path.d.ts.map +1 -1
- package/dist/root-path.js +263 -73
- package/dist/root-paths-lexical.d.ts +9 -0
- package/dist/root-paths-lexical.d.ts.map +1 -0
- package/dist/root-paths-lexical.js +22 -0
- package/dist/root-paths.d.ts +3 -29
- package/dist/root-paths.d.ts.map +1 -1
- package/dist/root-paths.js +89 -178
- package/dist/root-read-admission.d.ts +26 -0
- package/dist/root-read-admission.d.ts.map +1 -0
- package/dist/root-read-admission.js +94 -0
- package/dist/root-remove-identity.d.ts +15 -0
- package/dist/root-remove-identity.d.ts.map +1 -0
- package/dist/root-remove-identity.js +89 -0
- package/dist/root-remove-receipt.d.ts +17 -0
- package/dist/root-remove-receipt.d.ts.map +1 -0
- package/dist/root-remove-receipt.js +37 -0
- package/dist/root-remove.d.ts +2 -1
- package/dist/root-remove.d.ts.map +1 -1
- package/dist/root-remove.js +172 -10
- package/dist/root-walk.d.ts.map +1 -1
- package/dist/root-walk.js +2 -1
- package/dist/root-write-admission.d.ts +68 -0
- package/dist/root-write-admission.d.ts.map +1 -0
- package/dist/root-write-admission.js +322 -0
- package/dist/root-write-compatibility.d.ts +13 -0
- package/dist/root-write-compatibility.d.ts.map +1 -0
- package/dist/root-write-compatibility.js +74 -0
- package/dist/root-write-complete-parent.d.ts +42 -0
- package/dist/root-write-complete-parent.d.ts.map +1 -0
- package/dist/root-write-complete-parent.js +195 -0
- package/dist/root-write-mode.d.ts +2 -0
- package/dist/root-write-mode.d.ts.map +1 -1
- package/dist/root-write-mode.js +20 -7
- package/dist/root-write-publication.d.ts +24 -0
- package/dist/root-write-publication.d.ts.map +1 -0
- package/dist/root-write-publication.js +85 -0
- package/dist/root-write-verification.d.ts.map +1 -1
- package/dist/root-write-verification.js +18 -7
- package/dist/safe-path-segment.d.ts.map +1 -1
- package/dist/safe-path-segment.js +3 -1
- package/dist/secret-file.d.ts.map +1 -1
- package/dist/secret-file.js +62 -24
- package/dist/secret-read-async.d.ts.map +1 -1
- package/dist/secret-read-async.js +18 -13
- package/dist/secret-read-policy.d.ts.map +1 -1
- package/dist/secret-read-policy.js +5 -1
- package/dist/secure-file-windows.d.ts +10 -0
- package/dist/secure-file-windows.d.ts.map +1 -0
- package/dist/secure-file-windows.js +186 -0
- package/dist/secure-file.d.ts.map +1 -1
- package/dist/secure-file.js +98 -10
- package/dist/secure-temp-dir.d.ts +6 -3
- package/dist/secure-temp-dir.d.ts.map +1 -1
- package/dist/secure-temp-dir.js +121 -101
- package/dist/secure-temp-repair.d.ts +35 -0
- package/dist/secure-temp-repair.d.ts.map +1 -0
- package/dist/secure-temp-repair.js +106 -0
- package/dist/sibling-staged-file.d.ts +3 -1
- package/dist/sibling-staged-file.d.ts.map +1 -1
- package/dist/sibling-staged-file.js +181 -50
- package/dist/sibling-temp.d.ts.map +1 -1
- package/dist/sibling-temp.js +27 -12
- package/dist/sidecar-lock-acquire.d.ts.map +1 -1
- package/dist/sidecar-lock-acquire.js +45 -15
- package/dist/sidecar-lock-root.d.ts.map +1 -1
- package/dist/sidecar-lock-root.js +4 -2
- package/dist/sidecar-lock.d.ts.map +1 -1
- package/dist/sidecar-lock.js +2 -3
- package/dist/staged-directory.d.ts +14 -5
- package/dist/staged-directory.d.ts.map +1 -1
- package/dist/staged-directory.js +54 -3
- package/dist/standalone-publication-path.d.ts +2 -0
- package/dist/standalone-publication-path.d.ts.map +1 -0
- package/dist/standalone-publication-path.js +6 -0
- package/dist/stat-observation.d.ts +11 -0
- package/dist/stat-observation.d.ts.map +1 -0
- package/dist/stat-observation.js +64 -0
- package/dist/strict-file-identity.d.ts.map +1 -1
- package/dist/strict-file-identity.js +39 -2
- package/dist/symlink-parents.d.ts.map +1 -1
- package/dist/symlink-parents.js +7 -2
- package/dist/temp-target.d.ts +2 -0
- package/dist/temp-target.d.ts.map +1 -1
- package/dist/temp-target.js +133 -4
- package/dist/temp-workspace-admission.d.ts +22 -0
- package/dist/temp-workspace-admission.d.ts.map +1 -0
- package/dist/temp-workspace-admission.js +374 -0
- package/dist/temp-workspace-child-admission.d.ts +13 -0
- package/dist/temp-workspace-child-admission.d.ts.map +1 -0
- package/dist/temp-workspace-child-admission.js +95 -0
- package/dist/temp-workspace-descriptor.d.ts +48 -0
- package/dist/temp-workspace-descriptor.d.ts.map +1 -0
- package/dist/temp-workspace-descriptor.js +363 -0
- package/dist/temp-workspace-identity.d.ts +15 -0
- package/dist/temp-workspace-identity.d.ts.map +1 -0
- package/dist/temp-workspace-identity.js +41 -0
- package/dist/temp-workspace-owner.d.ts +7 -6
- package/dist/temp-workspace-owner.d.ts.map +1 -1
- package/dist/temp-workspace-owner.js +121 -61
- package/dist/temp-workspace-permissions.d.ts +4 -0
- package/dist/temp-workspace-permissions.d.ts.map +1 -0
- package/dist/temp-workspace-permissions.js +32 -0
- package/dist/temp-workspace-types.d.ts +40 -0
- package/dist/temp-workspace-types.d.ts.map +1 -0
- package/dist/temp-workspace-types.js +1 -0
- package/dist/temp.d.ts +1 -1
- package/dist/temp.d.ts.map +1 -1
- package/dist/temp.js +1 -1
- package/dist/test-hooks.d.ts +7 -0
- package/dist/test-hooks.d.ts.map +1 -1
- package/dist/text-atomic.d.ts.map +1 -1
- package/dist/text-atomic.js +3 -1
- package/dist/trash.d.ts.map +1 -1
- package/dist/trash.js +54 -8
- package/dist/walk.d.ts.map +1 -1
- package/dist/walk.js +20 -16
- package/dist/windows-owner.d.ts.map +1 -1
- package/dist/windows-owner.js +5 -0
- package/dist/windows-path-alias.d.ts +39 -0
- package/dist/windows-path-alias.d.ts.map +1 -0
- package/dist/windows-path-alias.js +153 -0
- package/docs/advanced.md +28 -1
- package/docs/archive.md +29 -2
- package/docs/atomic.md +27 -3
- package/docs/contributing.md +4 -1
- package/docs/copy.md +4 -1
- package/docs/durability.md +18 -2
- package/docs/errors.md +14 -6
- package/docs/file-store.md +30 -3
- package/docs/filename.md +21 -7
- package/docs/guest.md +5 -0
- package/docs/install-path.md +61 -15
- package/docs/install.md +12 -8
- package/docs/json-store.md +5 -1
- package/docs/json.md +11 -0
- package/docs/mutation-policy-proof.md +65 -0
- package/docs/native-helper.md +28 -9
- package/docs/native.md +46 -10
- package/docs/output.md +33 -11
- package/docs/path-prefix.md +64 -0
- package/docs/path-suffix-aliases.md +159 -0
- package/docs/path.md +12 -1
- package/docs/permissions.md +26 -1
- package/docs/private-file-store.md +14 -0
- package/docs/public-api.md +14 -0
- package/docs/quickstart.md +1 -1
- package/docs/reading.md +8 -1
- package/docs/root.md +21 -4
- package/docs/secret-file.md +3 -0
- package/docs/secure-file.md +21 -16
- package/docs/security-model.md +76 -9
- package/docs/sidecar-lock.md +28 -1
- package/docs/store.md +27 -2
- package/docs/temp.md +262 -34
- package/docs/test-hooks.md +14 -0
- package/docs/writing.md +38 -8
- package/package.json +10 -10
package/dist/local-roots.js
CHANGED
|
@@ -7,6 +7,7 @@ import { isFileUrl, safeFileURLToPath } from "./local-file-access.js";
|
|
|
7
7
|
import { realpathSync } from "./realpath.js";
|
|
8
8
|
import { ROOT_PATH_ALIAS_POLICIES, resolveRootPathSync } from "./root-path.js";
|
|
9
9
|
import { root } from "./root.js";
|
|
10
|
+
import { assertNoWindowsPathAlias, isWindowsPathAliasError, pathForWindowsFilesystem, resolvePathPreservingWindowsRoot, } from "./windows-path-alias.js";
|
|
10
11
|
function resolveLocalPathInput(input, label) {
|
|
11
12
|
if (isFileUrl(input)) {
|
|
12
13
|
try {
|
|
@@ -20,14 +21,18 @@ function resolveLocalPathInput(input, label) {
|
|
|
20
21
|
if (input.includes("\0")) {
|
|
21
22
|
throw new FsSafeError("invalid-path", `${label} must not contain NUL bytes`);
|
|
22
23
|
}
|
|
24
|
+
assertNoWindowsPathAlias(input, "filesystem", `${label} uses a Windows filesystem namespace alias`);
|
|
23
25
|
const homePrefix = input === "~" || input.startsWith("~/") ||
|
|
24
26
|
(path.sep === "\\" && input.startsWith("~\\"));
|
|
25
27
|
const expanded = homePrefix ? `${resolveRequiredHomeDir()}${path.sep}${input.slice(2)}` : input;
|
|
28
|
+
assertNoWindowsPathAlias(expanded, "filesystem", `${label} uses a Windows filesystem namespace alias`);
|
|
26
29
|
if (path.isAbsolute(expanded))
|
|
27
30
|
return expanded;
|
|
28
31
|
const drive = path.parse(expanded).root;
|
|
29
32
|
const base = drive ? path.resolve(drive) : process.cwd();
|
|
30
|
-
|
|
33
|
+
const resolved = `${base}${path.sep}${expanded.slice(drive.length)}`;
|
|
34
|
+
assertNoWindowsPathAlias(resolved, "filesystem", `${label} uses a Windows filesystem namespace alias`);
|
|
35
|
+
return resolved;
|
|
31
36
|
}
|
|
32
37
|
function resolveLocalRootInput(input, label) {
|
|
33
38
|
const trimmed = input.trim();
|
|
@@ -40,29 +45,44 @@ function resolveLocalRootInput(input, label) {
|
|
|
40
45
|
if (resolved.includes("\0")) {
|
|
41
46
|
throw new FsSafeError("invalid-path", `${label} entry must not contain NUL bytes`);
|
|
42
47
|
}
|
|
48
|
+
assertNoWindowsPathAlias(resolved, "filesystem", `${label} entry uses a Windows filesystem namespace alias`);
|
|
43
49
|
if (!path.isAbsolute(resolved)) {
|
|
44
50
|
throw new FsSafeError("invalid-path", `${label} entries must be absolute paths: ${input}`);
|
|
45
51
|
}
|
|
46
|
-
|
|
52
|
+
const absolute = resolvePathPreservingWindowsRoot(resolved);
|
|
53
|
+
assertNoWindowsPathAlias(absolute, "filesystem", `${label} entry uses a Windows filesystem namespace alias`);
|
|
54
|
+
return absolute;
|
|
47
55
|
}
|
|
48
56
|
function resolveRootRealSync(rootDir) {
|
|
57
|
+
let realPath;
|
|
49
58
|
try {
|
|
50
59
|
// Configured roots may themselves be symlinks. Follow only this trusted
|
|
51
60
|
// root entry, then use its canonical directory for containment checks.
|
|
52
|
-
const
|
|
61
|
+
const operationPath = pathForWindowsFilesystem(rootDir);
|
|
62
|
+
const stat = fsSync.statSync(operationPath);
|
|
53
63
|
if (!stat.isDirectory()) {
|
|
54
64
|
return null;
|
|
55
65
|
}
|
|
56
|
-
|
|
66
|
+
realPath = realpathSync(operationPath);
|
|
57
67
|
}
|
|
58
68
|
catch {
|
|
59
69
|
return null;
|
|
60
70
|
}
|
|
71
|
+
assertNoWindowsPathAlias(realPath, "filesystem", "local root uses a Windows filesystem namespace alias");
|
|
72
|
+
return realPath;
|
|
61
73
|
}
|
|
62
74
|
export function resolveLocalPathFromRootsSync(options) {
|
|
63
75
|
const label = options.label ?? "local roots";
|
|
64
|
-
const requestedPath = resolveLocalPathInput(options.filePath, "file path");
|
|
65
76
|
const rootDirs = options.roots.map((rootEntry) => resolveLocalRootInput(rootEntry, label));
|
|
77
|
+
let requestedPath;
|
|
78
|
+
try {
|
|
79
|
+
requestedPath = resolveLocalPathInput(options.filePath, "file path");
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (isWindowsPathAliasError(error))
|
|
83
|
+
return null;
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
66
86
|
for (const rootDir of rootDirs) {
|
|
67
87
|
const rootReal = resolveRootRealSync(rootDir);
|
|
68
88
|
if (!rootReal) {
|
|
@@ -89,7 +109,7 @@ export function resolveLocalPathFromRootsSync(options) {
|
|
|
89
109
|
continue;
|
|
90
110
|
if (candidate.exists && options.requireFile === true) {
|
|
91
111
|
try {
|
|
92
|
-
if (!fsSync.lstatSync(requestedPath).isFile())
|
|
112
|
+
if (!fsSync.lstatSync(pathForWindowsFilesystem(requestedPath)).isFile())
|
|
93
113
|
continue;
|
|
94
114
|
}
|
|
95
115
|
catch {
|
|
@@ -103,8 +123,16 @@ export function resolveLocalPathFromRootsSync(options) {
|
|
|
103
123
|
export async function readLocalFileFromRoots(options) {
|
|
104
124
|
const maxBytes = normalizeMaxBytes(options.maxBytes);
|
|
105
125
|
const label = options.label ?? "local roots";
|
|
106
|
-
const requestedPath = resolveLocalPathInput(options.filePath, "file path");
|
|
107
126
|
const rootDirs = options.roots.map((rootEntry) => resolveLocalRootInput(rootEntry, label));
|
|
127
|
+
let requestedPath;
|
|
128
|
+
try {
|
|
129
|
+
requestedPath = resolveLocalPathInput(options.filePath, "file path");
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (isWindowsPathAliasError(error))
|
|
133
|
+
return null;
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
108
136
|
for (const rootDir of rootDirs) {
|
|
109
137
|
let scopedRoot;
|
|
110
138
|
try {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fsSync from "node:fs";
|
|
1
2
|
export type EntryIdentity = {
|
|
2
3
|
ctimeMs: number;
|
|
3
4
|
dev: number;
|
|
@@ -12,6 +13,7 @@ export type CopiedEntryManifest = (EntryIdentity & {
|
|
|
12
13
|
name: string;
|
|
13
14
|
manifest: CopiedEntryManifest;
|
|
14
15
|
}>;
|
|
16
|
+
directoryIdentity: Readonly<Pick<fsSync.BigIntStats, "dev" | "ino">>;
|
|
15
17
|
kind: "directory";
|
|
16
18
|
}) | (EntryIdentity & {
|
|
17
19
|
kind: "leaf";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move-path-cleanup.d.ts","sourceRoot":"","sources":["../src/move-path-cleanup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"move-path-cleanup.d.ts","sourceRoot":"","sources":["../src/move-path-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAM7B,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,CAAC,aAAa,GAAG;IACf,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAAC;IACjE,iBAAiB,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IACrE,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC,GACF,CAAC,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEvC,KAAK,wBAAwB,GAAG,SAAS,GA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5
|
+
import { inspectFileIdentitySync } from "./strict-file-identity.js";
|
|
4
6
|
export function entryIdentity(stat) {
|
|
5
7
|
return {
|
|
6
8
|
ctimeMs: stat.ctimeMs,
|
|
@@ -21,9 +23,6 @@ export function sameIdentity(a, b) {
|
|
|
21
23
|
a.mtimeMs === b.mtimeMs &&
|
|
22
24
|
a.ctimeMs === b.ctimeMs);
|
|
23
25
|
}
|
|
24
|
-
function sameDirectoryNode(a, b) {
|
|
25
|
-
return a.dev === b.dev && a.ino === b.ino;
|
|
26
|
-
}
|
|
27
26
|
export function sourceChangedError(sourcePath) {
|
|
28
27
|
return Object.assign(new Error(`Source changed during move fallback: ${sourcePath}`), {
|
|
29
28
|
code: "ESTALE",
|
|
@@ -113,22 +112,19 @@ function mergeCleanupResults(a, b) {
|
|
|
113
112
|
return a === "stale" || b === "stale" ? "stale" : "removed";
|
|
114
113
|
}
|
|
115
114
|
export async function cleanupCopiedEntry(sourcePath, manifest, state, assertBeforeMutation) {
|
|
116
|
-
const aliasGroup = manifest.kind === "leaf" ? state.aliasGroups.get(identityKey(manifest)) : undefined;
|
|
117
|
-
if (aliasGroup?.stale) {
|
|
118
|
-
return "stale";
|
|
119
|
-
}
|
|
120
|
-
let currentStat;
|
|
121
|
-
try {
|
|
122
|
-
currentStat = fsSync.lstatSync(sourcePath);
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
if (error?.code === "ENOENT") {
|
|
126
|
-
return aliasGroup ? poisonAliasGroup(aliasGroup) : "removed";
|
|
127
|
-
}
|
|
128
|
-
throw error;
|
|
129
|
-
}
|
|
130
115
|
if (manifest.kind === "directory") {
|
|
131
|
-
|
|
116
|
+
let currentStat;
|
|
117
|
+
try {
|
|
118
|
+
currentStat = inspectFileIdentitySync(() => fsSync.lstatSync(sourcePath, { bigint: true }), manifest.directoryIdentity);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (error?.code === "ENOENT")
|
|
122
|
+
return "removed";
|
|
123
|
+
if (error instanceof FsSafeError && error.code === "path-mismatch")
|
|
124
|
+
return "stale";
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
if (!currentStat.isDirectory()) {
|
|
132
128
|
return "stale";
|
|
133
129
|
}
|
|
134
130
|
// A same-inode directory can gain unrelated children after commit. Still
|
|
@@ -137,7 +133,23 @@ export async function cleanupCopiedEntry(sourcePath, manifest, state, assertBefo
|
|
|
137
133
|
for (const child of manifest.children) {
|
|
138
134
|
result = mergeCleanupResults(result, await cleanupCopiedEntry(path.join(sourcePath, child.name), child.manifest, state, assertBeforeMutation));
|
|
139
135
|
}
|
|
136
|
+
// Child cleanup and the caller's authority check can replace the directory.
|
|
137
|
+
// Keep the final exact observation after both, immediately before removal.
|
|
140
138
|
assertBeforeMutation();
|
|
139
|
+
try {
|
|
140
|
+
currentStat = inspectFileIdentitySync(() => fsSync.lstatSync(sourcePath, { bigint: true }), manifest.directoryIdentity);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (error?.code === "ENOENT") {
|
|
144
|
+
return "stale";
|
|
145
|
+
}
|
|
146
|
+
if (error instanceof FsSafeError && error.code === "path-mismatch")
|
|
147
|
+
return "stale";
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
if (!currentStat.isDirectory()) {
|
|
151
|
+
return "stale";
|
|
152
|
+
}
|
|
141
153
|
try {
|
|
142
154
|
await fs.rmdir(sourcePath);
|
|
143
155
|
}
|
|
@@ -150,6 +162,20 @@ export async function cleanupCopiedEntry(sourcePath, manifest, state, assertBefo
|
|
|
150
162
|
}
|
|
151
163
|
return result;
|
|
152
164
|
}
|
|
165
|
+
const aliasGroup = state.aliasGroups.get(identityKey(manifest));
|
|
166
|
+
if (aliasGroup?.stale) {
|
|
167
|
+
return "stale";
|
|
168
|
+
}
|
|
169
|
+
let currentStat;
|
|
170
|
+
try {
|
|
171
|
+
currentStat = fsSync.lstatSync(sourcePath);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
if (error?.code === "ENOENT") {
|
|
175
|
+
return aliasGroup ? poisonAliasGroup(aliasGroup) : "removed";
|
|
176
|
+
}
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
153
179
|
const expected = aliasGroup?.expected ?? manifest;
|
|
154
180
|
if (!sameIdentity(expected, entryIdentity(currentStat))) {
|
|
155
181
|
return aliasGroup ? poisonAliasGroup(aliasGroup) : "stale";
|
package/dist/move-path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move-path.d.ts","sourceRoot":"","sources":["../src/move-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"move-path.d.ts","sourceRoot":"","sources":["../src/move-path.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,qFAAqF;IACrF,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,uFAAuF;IACvF,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,qFAAqF;IACrF,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,0BAA0B,KAAK,IAAI,CAAC;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,sBAAsB,GAAG,cAAc,GAAG,uBAAuB,CAAC;AAEvE,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,OAAO,EACd,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,sBAAsB,GAAG,SAAS,CASpC;AAoSD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAoHf"}
|
package/dist/move-path.js
CHANGED
|
@@ -2,14 +2,16 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import fsSync, { constants as fsConstants } from "node:fs";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { createAsyncDirectoryGuard } from "./directory-guard.js";
|
|
5
|
+
import { createAsyncDirectoryGuard, inspectDirectoryIdentitySync } from "./directory-guard.js";
|
|
6
6
|
import { FsSafeError } from "./errors.js";
|
|
7
7
|
import { guardedRename } from "./guarded-mutation.js";
|
|
8
8
|
import { assertSourceStillMatches, cleanupCopiedEntry, createCleanupCopiedEntryState, entryIdentity, sameIdentity, sourceChangedError, } from "./move-path-cleanup.js";
|
|
9
9
|
import { resolveReadOpenFlags } from "./read-open-flags.js";
|
|
10
|
+
import { realpathSync } from "./realpath.js";
|
|
10
11
|
import { cleanupPinnedFilePath } from "./replace-file-temp-owner.js";
|
|
11
12
|
import { createMoveStageOwner } from "./move-path-stage.js";
|
|
12
|
-
import {
|
|
13
|
+
import { admitStandalonePublicationPath } from "./standalone-publication-path.js";
|
|
14
|
+
import { assertNoWindowsPathAlias } from "./windows-path-alias.js";
|
|
13
15
|
export function moveCopyFallbackReasonForRenameError(error, platform = process.platform) {
|
|
14
16
|
const code = error?.code;
|
|
15
17
|
if (code === "EXDEV") {
|
|
@@ -176,6 +178,19 @@ async function copyRegularFilePinned(params) {
|
|
|
176
178
|
}
|
|
177
179
|
return openedIdentity;
|
|
178
180
|
}
|
|
181
|
+
function inspectSourceDirectory(sourcePath, expected) {
|
|
182
|
+
try {
|
|
183
|
+
return inspectDirectoryIdentitySync(sourcePath, expected);
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
const code = error?.code;
|
|
187
|
+
if (code === "ENOENT" || code === "ENOTDIR" ||
|
|
188
|
+
(error instanceof FsSafeError && (error.code === "path-mismatch" || error.code === "not-file"))) {
|
|
189
|
+
throw sourceChangedError(sourcePath);
|
|
190
|
+
}
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
179
194
|
async function copyEntryWithManifest(from, to, options, expectedIdentity) {
|
|
180
195
|
const sourceStat = fsSync.lstatSync(from);
|
|
181
196
|
const identity = entryIdentity(sourceStat);
|
|
@@ -193,6 +208,8 @@ async function copyEntryWithManifest(from, to, options, expectedIdentity) {
|
|
|
193
208
|
return { ...identity, kind: "leaf" };
|
|
194
209
|
}
|
|
195
210
|
if (sourceStat.isDirectory()) {
|
|
211
|
+
const directoryStat = inspectSourceDirectory(from);
|
|
212
|
+
const directoryIdentity = Object.freeze({ dev: directoryStat.dev, ino: directoryStat.ino });
|
|
196
213
|
await fs.mkdir(to, { mode: modeBits(sourceStat.mode) || 0o755 });
|
|
197
214
|
options.onCreated?.(fsSync.lstatSync(to, { bigint: true }));
|
|
198
215
|
const children = [];
|
|
@@ -215,10 +232,11 @@ async function copyEntryWithManifest(from, to, options, expectedIdentity) {
|
|
|
215
232
|
// Directory traversal is path-based in Node. Treat a changed parent as a
|
|
216
233
|
// stale move before committing so swapped-in outside trees are not imported.
|
|
217
234
|
await assertSourceStillMatches(from, identity);
|
|
235
|
+
inspectSourceDirectory(from, directoryIdentity);
|
|
218
236
|
// mkdir() honors process umask. Restore the source mode before commit so
|
|
219
237
|
// EXDEV fallback preserves directory permissions like fs.cp did.
|
|
220
238
|
await chmodDirectoryPinned(to, modeBits(sourceStat.mode));
|
|
221
|
-
return { ...identity, children, kind: "directory" };
|
|
239
|
+
return { ...identity, children, directoryIdentity, kind: "directory" };
|
|
222
240
|
}
|
|
223
241
|
if (!sourceStat.isFile()) {
|
|
224
242
|
throw new Error(`Refusing to move non-file path with copy fallback: ${from}`);
|
|
@@ -244,6 +262,13 @@ function assertSynchronousResult(returned, name) {
|
|
|
244
262
|
}
|
|
245
263
|
}
|
|
246
264
|
export async function movePathWithCopyFallback(options) {
|
|
265
|
+
const from = admitStandalonePublicationPath(options.from, "move source uses a Windows filesystem namespace alias");
|
|
266
|
+
const to = admitStandalonePublicationPath(options.to, "move destination uses a Windows filesystem namespace alias");
|
|
267
|
+
const sourcePath = path.resolve(from);
|
|
268
|
+
const targetPath = path.resolve(to);
|
|
269
|
+
assertNoWindowsPathAlias(sourcePath, "filesystem", "move source uses a Windows filesystem namespace alias");
|
|
270
|
+
assertNoWindowsPathAlias(targetPath, "filesystem", "move destination uses a Windows filesystem namespace alias");
|
|
271
|
+
const sourceHardlinks = options.sourceHardlinks;
|
|
247
272
|
// Keep the initiating owner's callbacks across preparation and copy fallback.
|
|
248
273
|
const callerRenameAssert = options.assertBeforeRename;
|
|
249
274
|
const callerMutationAssert = options.assertBeforeMutation;
|
|
@@ -279,9 +304,7 @@ export async function movePathWithCopyFallback(options) {
|
|
|
279
304
|
assertSynchronousResult(callerPublished?.(publicationReceipt), "onDestinationPublished");
|
|
280
305
|
}
|
|
281
306
|
};
|
|
282
|
-
const
|
|
283
|
-
const targetPath = path.resolve(options.to);
|
|
284
|
-
const rejectHardlinks = options.sourceHardlinks === "reject";
|
|
307
|
+
const rejectHardlinks = sourceHardlinks === "reject";
|
|
285
308
|
if (rejectHardlinks) {
|
|
286
309
|
await preflightSourceHardlinks(sourcePath);
|
|
287
310
|
}
|
|
@@ -320,6 +343,8 @@ export async function movePathWithCopyFallback(options) {
|
|
|
320
343
|
}, sourceIdentity);
|
|
321
344
|
const cleanupState = createCleanupCopiedEntryState(sourcePath, manifest);
|
|
322
345
|
await assertCopyDestinationOutsideSource(sourcePath, targetPath, manifest);
|
|
346
|
+
if (manifest.kind === "directory")
|
|
347
|
+
inspectSourceDirectory(sourcePath, manifest.directoryIdentity);
|
|
323
348
|
await guardedRename({
|
|
324
349
|
from: staged,
|
|
325
350
|
to: targetPath,
|
package/dist/native-binding.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface NativeFileIdentity {
|
|
|
15
15
|
isDirectory: boolean;
|
|
16
16
|
isSymbolicLink: boolean;
|
|
17
17
|
}
|
|
18
|
+
export interface NativeDirectoryObservation {
|
|
19
|
+
dev: bigint;
|
|
20
|
+
ino: bigint;
|
|
21
|
+
realPath: string;
|
|
22
|
+
}
|
|
18
23
|
export interface NativeArchiveEntry {
|
|
19
24
|
index: number;
|
|
20
25
|
path: string;
|
|
@@ -75,12 +80,24 @@ export interface NativeWindowsSecurityFacts {
|
|
|
75
80
|
unsupportedAceTypes: number[];
|
|
76
81
|
aces: NativeWindowsAccessControlEntry[];
|
|
77
82
|
}
|
|
83
|
+
export interface NativeWindowsDescriptorSecurityFacts {
|
|
84
|
+
/** Canonical lowercase 32-bit volume serial and 64-bit file-index projection used by Node. */
|
|
85
|
+
identity: string;
|
|
86
|
+
security: NativeWindowsSecurityFacts;
|
|
87
|
+
}
|
|
88
|
+
export interface NativeDarwinAclFacts {
|
|
89
|
+
state: "absent" | "empty" | "present";
|
|
90
|
+
}
|
|
78
91
|
export interface NativeBinding {
|
|
92
|
+
/** Internal Darwin-only synchronous inspection; the caller retains its fd. */
|
|
93
|
+
inspectDarwinAcl?(fd: number): NativeDarwinAclFacts;
|
|
79
94
|
/** POSIX system canonicalization; confinement and identity policy stay with callers. */
|
|
80
95
|
canonicalizePath?(path: string, ordinary: boolean): {
|
|
81
96
|
path?: string;
|
|
82
97
|
errno?: number;
|
|
83
98
|
};
|
|
99
|
+
/** Internal: exact directory identity and canonical path from one no-follow handle. */
|
|
100
|
+
observeDirectory?(path: string): NativeDirectoryObservation;
|
|
84
101
|
/** Linux/Windows byte transfer; callers retain both admitted descriptors until settlement. */
|
|
85
102
|
copyFileContents?(sourceFd: number, targetFd: number, signal?: AbortSignal): Promise<void>;
|
|
86
103
|
/** Internal: same private, immutable input ownership as the ZIP buffer reader. */
|
|
@@ -107,10 +124,14 @@ export interface NativeBinding {
|
|
|
107
124
|
fstatIdentity(fd: number): NativeFileIdentity;
|
|
108
125
|
inspectArchiveNative(path: string, kind: string, limits: TarMeterLimits, signal: AbortSignal): Promise<NativeArchiveEntry[]>;
|
|
109
126
|
linkBeneath(sourceRootFd: number, sourceRelPath: string, targetRootFd: number, targetRelPath: string): void;
|
|
127
|
+
/** Direct-child mkdir; true is receipt provenance only, never cleanup ownership. */
|
|
128
|
+
mkdirChildBeneath?(parentFd: number, basename: string, mode: number): boolean;
|
|
110
129
|
mkdirBeneath(rootFd: number, relPath: string, mode: number): void;
|
|
111
130
|
openBeneath(rootFd: number, relPath: string, flags: number): NativeOpenBeneathResult;
|
|
112
131
|
readArchiveEntryNative(path: string, kind: string, requested: string, maxBytes: number, limits: TarMeterLimits, signal: AbortSignal): Promise<Buffer>;
|
|
113
132
|
readOwnerAndDacl(path: string): NativeWindowsSecurityFacts;
|
|
133
|
+
/** Internal Windows-only inspection of the exact borrowed Node descriptor. */
|
|
134
|
+
inspectWindowsSecureFileHandle?(fd: number): NativeWindowsDescriptorSecurityFacts;
|
|
114
135
|
ownedTreeRemovalAvailable?(parentFd: number): boolean;
|
|
115
136
|
removeOwnedTree?(parentFd: number, basename: string, directoryFd: number): Promise<NativeOwnedTreeRemovalResult>;
|
|
116
137
|
removeOwnedTreeSync?(parentFd: number, basename: string, directoryFd: number): NativeOwnedTreeRemovalResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-binding.d.ts","sourceRoot":"","sources":["../src/native-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,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,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACzC,mBAAmB,CAAC,CAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,4BAA4B,CAAC;IAChC,eAAe,CACb,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,IAAI,CAAC;IACR,aAAa,CACX,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,IAAI,CAAC;IACR,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type NativeBinding } from "./native.js";
|
|
2
|
+
import type { NativeDirectoryObservation } from "./native-binding.js";
|
|
3
|
+
import type { ExactStatIdentity } from "./stat-observation.js";
|
|
4
|
+
export type NativeDirectoryObservationBackend = NativeBinding & {
|
|
5
|
+
observeDirectory(pathname: string): NativeDirectoryObservation;
|
|
6
|
+
};
|
|
7
|
+
export type NativeDirectoryObservationGuard = NativeDirectoryObservation & {
|
|
8
|
+
dir: string;
|
|
9
|
+
identity: ExactStatIdentity;
|
|
10
|
+
nativeDirectoryObservation: true;
|
|
11
|
+
};
|
|
12
|
+
export declare function getNativeDirectoryObservationBackend(enabled?: boolean): NativeDirectoryObservationBackend | undefined;
|
|
13
|
+
/** Exact identity, type, and canonical path captured from one retained handle. */
|
|
14
|
+
export declare function inspectNativeDirectoryObservation(backend: NativeDirectoryObservationBackend, pathname: string, expected?: ExactStatIdentity, platform?: NodeJS.Platform): NativeDirectoryObservation;
|
|
15
|
+
export declare function extendNativeDirectoryObservationGuard(observation: NativeDirectoryObservation, dir: string): NativeDirectoryObservationGuard;
|
|
16
|
+
export declare function isNativeDirectoryObservationGuard(guard: unknown): guard is NativeDirectoryObservationGuard;
|
|
17
|
+
//# sourceMappingURL=native-directory-observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-directory-observation.d.ts","sourceRoot":"","sources":["../src/native-directory-observation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,MAAM,iCAAiC,GAAG,aAAa,GAAG;IAC9D,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,0BAA0B,GAAG;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,0BAA0B,EAAE,IAAI,CAAC;CAClC,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,OAAO,UAAO,GACb,iCAAiC,GAAG,SAAS,CAM/C;AAeD,kFAAkF;AAClF,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,iCAAiC,EAC1C,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,0BAA0B,CAM5B;AAED,wBAAgB,qCAAqC,CACnD,WAAW,EAAE,0BAA0B,EACvC,GAAG,EAAE,MAAM,GACV,+BAA+B,CAMjC;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,+BAA+B,CAG1C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { FsSafeError } from "./errors.js";
|
|
3
|
+
import { getNativeBinding } from "./native.js";
|
|
4
|
+
import { inspectFileIdentitySync } from "./strict-file-identity.js";
|
|
5
|
+
export function getNativeDirectoryObservationBackend(enabled = true) {
|
|
6
|
+
if (!enabled)
|
|
7
|
+
return undefined;
|
|
8
|
+
const binding = getNativeBinding();
|
|
9
|
+
return binding && typeof binding.observeDirectory === "function"
|
|
10
|
+
? binding
|
|
11
|
+
: undefined;
|
|
12
|
+
}
|
|
13
|
+
function validateNativeDirectoryObservation(observation) {
|
|
14
|
+
if (!observation || typeof observation.dev !== "bigint" || observation.dev < 0n ||
|
|
15
|
+
typeof observation.ino !== "bigint" || observation.ino < 0n ||
|
|
16
|
+
typeof observation.realPath !== "string" ||
|
|
17
|
+
observation.realPath.includes("\0") ||
|
|
18
|
+
(!path.isAbsolute(observation.realPath) && !path.win32.isAbsolute(observation.realPath))) {
|
|
19
|
+
throw new FsSafeError("path-mismatch", "native directory observation is invalid");
|
|
20
|
+
}
|
|
21
|
+
return observation;
|
|
22
|
+
}
|
|
23
|
+
/** Exact identity, type, and canonical path captured from one retained handle. */
|
|
24
|
+
export function inspectNativeDirectoryObservation(backend, pathname, expected, platform = process.platform) {
|
|
25
|
+
return inspectFileIdentitySync(() => validateNativeDirectoryObservation(backend.observeDirectory(pathname)), expected, platform);
|
|
26
|
+
}
|
|
27
|
+
export function extendNativeDirectoryObservationGuard(observation, dir) {
|
|
28
|
+
const guard = observation;
|
|
29
|
+
guard.dir = dir;
|
|
30
|
+
guard.identity = guard;
|
|
31
|
+
guard.nativeDirectoryObservation = true;
|
|
32
|
+
return guard;
|
|
33
|
+
}
|
|
34
|
+
export function isNativeDirectoryObservationGuard(guard) {
|
|
35
|
+
return typeof guard === "object" && guard !== null &&
|
|
36
|
+
guard.nativeDirectoryObservation === true;
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type BigIntStats, type Stats } from "node:fs";
|
|
2
|
+
import type { FileHandle } from "node:fs/promises";
|
|
3
|
+
import type { FileIdentityStat } from "./file-identity.js";
|
|
4
|
+
import type { NativeBinding } from "./native.js";
|
|
5
|
+
import { describeStagedDirectory } from "./staged-directory.js";
|
|
6
|
+
type RootIdentity = Pick<FileIdentityStat, "dev" | "ino">;
|
|
7
|
+
export type NativeRootAdmission = {
|
|
8
|
+
exactRoot: boolean;
|
|
9
|
+
operation: string;
|
|
10
|
+
root: FileHandle;
|
|
11
|
+
rootPath: string;
|
|
12
|
+
};
|
|
13
|
+
export type NativeParentAdmission = {
|
|
14
|
+
fd: number;
|
|
15
|
+
guard: {
|
|
16
|
+
dir: string;
|
|
17
|
+
realPath: string;
|
|
18
|
+
stat: Stats | BigIntStats;
|
|
19
|
+
};
|
|
20
|
+
stagedDirectory?: ReturnType<typeof describeStagedDirectory>;
|
|
21
|
+
};
|
|
22
|
+
export declare function sameNativeIdentity(left: RootIdentity, right: RootIdentity): boolean;
|
|
23
|
+
export declare function openNativeRootAdmission(binding: NativeBinding, params: {
|
|
24
|
+
rootPath: string;
|
|
25
|
+
rootIdentity?: RootIdentity;
|
|
26
|
+
operation?: string;
|
|
27
|
+
}): Promise<NativeRootAdmission>;
|
|
28
|
+
export declare function openNativeParentAdmission(binding: NativeBinding, rootAdmission: NativeRootAdmission, relativeParentPath: string): Promise<NativeParentAdmission>;
|
|
29
|
+
export declare function closeNativeParentAdmission(admission: NativeParentAdmission | undefined): void;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=native-parent-admission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-parent-admission.d.ts","sourceRoot":"","sources":["../src/native-parent-admission.ts"],"names":[],"mappings":"AAAA,OAAe,EAAE,KAAK,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,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|
+
import { inspectDirectoryIdentity } from "./directory-guard.js";
|
|
5
|
+
import { FsSafeError } from "./errors.js";
|
|
6
|
+
import { realpathSync } from "./realpath.js";
|
|
7
|
+
import { describeStagedDirectory, exactIdentityMatches } from "./staged-directory.js";
|
|
8
|
+
import { inspectFileIdentitySync } from "./strict-file-identity.js";
|
|
9
|
+
import { createSuppressedError } from "./suppressed-error.js";
|
|
10
|
+
import { assertNoWindowsPathAlias, pathForWindowsFilesystem } from "./windows-path-alias.js";
|
|
11
|
+
export function sameNativeIdentity(left, right) {
|
|
12
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
13
|
+
}
|
|
14
|
+
function unavailable(message) {
|
|
15
|
+
return new FsSafeError("helper-unavailable", message);
|
|
16
|
+
}
|
|
17
|
+
function assertParentAdmissionAvailable(binding) {
|
|
18
|
+
if (typeof binding.openBeneath !== "function") {
|
|
19
|
+
throw unavailable("native parent directory admission is unavailable");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function openNativeRootAdmission(binding, params) {
|
|
23
|
+
assertParentAdmissionAvailable(binding);
|
|
24
|
+
const directoryFlags = fsSync.constants.O_RDONLY | (fsSync.constants.O_DIRECTORY ?? 0);
|
|
25
|
+
assertNoWindowsPathAlias(params.rootPath, "filesystem", "native root uses a Windows filesystem namespace alias");
|
|
26
|
+
const root = await fs.open(pathForWindowsFilesystem(params.rootPath), directoryFlags);
|
|
27
|
+
try {
|
|
28
|
+
const exactRoot = typeof params.rootIdentity?.dev === "bigint" &&
|
|
29
|
+
typeof params.rootIdentity.ino === "bigint";
|
|
30
|
+
let rootMatches;
|
|
31
|
+
if (exactRoot) {
|
|
32
|
+
inspectFileIdentitySync(() => fsSync.fstatSync(root.fd, { bigint: true }), params.rootIdentity);
|
|
33
|
+
rootMatches = true;
|
|
34
|
+
}
|
|
35
|
+
else if (process.platform === "win32") {
|
|
36
|
+
if (typeof binding.fstatIdentity !== "function") {
|
|
37
|
+
throw unavailable("native root directory identity checks are unavailable");
|
|
38
|
+
}
|
|
39
|
+
const identity = binding.fstatIdentity(root.fd);
|
|
40
|
+
rootMatches = !params.rootIdentity || sameNativeIdentity(params.rootIdentity, identity);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const identity = fsSync.fstatSync(root.fd, { bigint: true });
|
|
44
|
+
rootMatches = !params.rootIdentity || exactIdentityMatches(params.rootIdentity, identity);
|
|
45
|
+
}
|
|
46
|
+
if (!rootMatches) {
|
|
47
|
+
throw new FsSafeError("path-mismatch", `root path changed during ${params.operation ?? "native admission"}`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
exactRoot,
|
|
51
|
+
operation: params.operation ?? "native admission",
|
|
52
|
+
root,
|
|
53
|
+
rootPath: params.rootPath,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
try {
|
|
58
|
+
await root.close();
|
|
59
|
+
}
|
|
60
|
+
catch (closeError) {
|
|
61
|
+
// Windows admission keeps the typed boundary failure primary.
|
|
62
|
+
if (process.platform !== "win32") {
|
|
63
|
+
throw createSuppressedError(closeError, error, "native root admission and close failed");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export async function openNativeParentAdmission(binding, rootAdmission, relativeParentPath) {
|
|
70
|
+
assertParentAdmissionAvailable(binding);
|
|
71
|
+
const directoryFlags = fsSync.constants.O_RDONLY | (fsSync.constants.O_DIRECTORY ?? 0);
|
|
72
|
+
assertNoWindowsPathAlias(relativeParentPath, "relative", "native parent uses a Windows filesystem namespace alias");
|
|
73
|
+
const opened = binding.openBeneath(rootAdmission.root.fd, relativeParentPath, directoryFlags);
|
|
74
|
+
if (!opened || !Number.isInteger(opened.fd) || opened.fd < 0) {
|
|
75
|
+
throw unavailable("native parent directory admission did not provide a descriptor");
|
|
76
|
+
}
|
|
77
|
+
const parentFd = opened.fd;
|
|
78
|
+
try {
|
|
79
|
+
const parentInput = relativeParentPath
|
|
80
|
+
? path.join(rootAdmission.rootPath, ...relativeParentPath.split("/"))
|
|
81
|
+
: rootAdmission.rootPath;
|
|
82
|
+
const parentPath = realpathSync.native(pathForWindowsFilesystem(parentInput));
|
|
83
|
+
assertNoWindowsPathAlias(parentPath, "filesystem", "native parent uses a Windows filesystem namespace alias");
|
|
84
|
+
const stagedDirectory = process.platform === "win32"
|
|
85
|
+
? undefined
|
|
86
|
+
: describeStagedDirectory(parentFd, parentPath);
|
|
87
|
+
const parentPathStat = rootAdmission.exactRoot
|
|
88
|
+
? await inspectDirectoryIdentity(parentPath, inspectFileIdentitySync(() => fsSync.fstatSync(parentFd, { bigint: true })))
|
|
89
|
+
: fsSync.lstatSync(pathForWindowsFilesystem(parentPath));
|
|
90
|
+
if (process.platform === "win32" && !rootAdmission.exactRoot) {
|
|
91
|
+
if (typeof binding.fstatIdentity !== "function") {
|
|
92
|
+
throw unavailable("native parent directory identity checks are unavailable");
|
|
93
|
+
}
|
|
94
|
+
const parentIdentity = binding.fstatIdentity(parentFd);
|
|
95
|
+
if (parentPathStat.isSymbolicLink() || !sameNativeIdentity(parentPathStat, parentIdentity)) {
|
|
96
|
+
throw new FsSafeError("path-mismatch", `${rootAdmission.operation} parent changed during resolution`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (process.platform !== "win32" &&
|
|
100
|
+
(parentPathStat.isSymbolicLink() || !exactIdentityMatches(parentPathStat, stagedDirectory.identity))) {
|
|
101
|
+
throw new FsSafeError("path-mismatch", `${rootAdmission.operation} parent changed during resolution`);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
fd: parentFd,
|
|
105
|
+
guard: { dir: parentPath, realPath: parentPath, stat: parentPathStat },
|
|
106
|
+
stagedDirectory,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
try {
|
|
111
|
+
fsSync.closeSync(parentFd);
|
|
112
|
+
}
|
|
113
|
+
catch (closeError) {
|
|
114
|
+
if (process.platform !== "win32") {
|
|
115
|
+
throw createSuppressedError(closeError, error, "native parent admission and close failed");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export function closeNativeParentAdmission(admission) {
|
|
122
|
+
if (admission)
|
|
123
|
+
fsSync.closeSync(admission.fd);
|
|
124
|
+
}
|
|
@@ -3,6 +3,5 @@ import type { AnyAsyncDirectoryGuard } from "./directory-guard.js";
|
|
|
3
3
|
import type { FileIdentityStat } from "./file-identity.js";
|
|
4
4
|
import type { NativeBinding } from "./native.js";
|
|
5
5
|
import type { PinnedWriteParams } from "./pinned-write.js";
|
|
6
|
-
export declare function sameNativeIdentity(left: Pick<FileIdentityStat, "dev" | "ino">, right: Pick<FileIdentityStat, "dev" | "ino">): boolean;
|
|
7
6
|
export declare function runPinnedWriteWindows(binding: NativeBinding, params: PinnedWriteParams, root: FileHandle, parentFd: number, parentGuard: AnyAsyncDirectoryGuard): Promise<FileIdentityStat>;
|
|
8
7
|
//# sourceMappingURL=native-pinned-write-windows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-pinned-write-windows.d.ts","sourceRoot":"","sources":["../src/native-pinned-write-windows.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"native-pinned-write-windows.d.ts","sourceRoot":"","sources":["../src/native-pinned-write-windows.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAa3D,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAAC,gBAAgB,CAAC,CA0F3B"}
|