@procedures/fs 0.7.0 → 0.8.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 +19 -0
- package/README.md +18 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/confine.d.ts +64 -0
- package/dist/confine.d.ts.map +1 -0
- package/dist/confine.js +213 -0
- package/dist/confine.js.map +1 -0
- package/dist/module.d.ts +22 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +50 -11
- package/dist/module.js.map +1 -1
- package/dist/root.d.ts +12 -6
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +14 -8
- package/dist/root.js.map +1 -1
- package/package.json +6 -2
- package/src/confine.ts +246 -0
- package/src/module.ts +51 -11
- package/src/root.ts +14 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @procedures/fs
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 90ea741: `confineToRoot(registry, root)` confines each procedure of a registry to a root (roadmap R33). The `fs.*` procedures get the handlers of `createFsModule({ root })`. Each other procedure gets the decision of `rootDecisionOf()`: the root examines the path inputs of its `metadata.fsRoot`, or it refuses the procedure with `FORBIDDEN` and the reason `outside-root`. A procedure without rules is refused when its effects are not known, name `fs`, or write `process`.
|
|
8
|
+
|
|
9
|
+
The new entry `@procedures/fs/root` has the rules of the root without the procedures. `inRoot()` takes an optional base folder, and `resolveRoot()` an optional name for its error. `confineFsProcedures()` does not change.
|
|
10
|
+
- Updated dependencies [4b09a03]
|
|
11
|
+
- Updated dependencies [4b09a03]
|
|
12
|
+
- Updated dependencies [aa6e3aa]
|
|
13
|
+
- Updated dependencies [698e24d]
|
|
14
|
+
- Updated dependencies [4b09a03]
|
|
15
|
+
- Updated dependencies [600c497]
|
|
16
|
+
- Updated dependencies [7c2e7f7]
|
|
17
|
+
- Updated dependencies [90ea741]
|
|
18
|
+
- Updated dependencies [c4cfa34]
|
|
19
|
+
- Updated dependencies [d25805a]
|
|
20
|
+
- @procedures/client@0.8.0
|
|
21
|
+
|
|
3
22
|
## 0.7.0
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -117,19 +117,30 @@ const registry = createRegistry(createFsModule({ root: "/work/project" }), bundl
|
|
|
117
117
|
|
|
118
118
|
`registerFsProcedures(registry, { root })` registers the procedures with the root in one registry.
|
|
119
119
|
|
|
120
|
-
A host that has a registry already starts `
|
|
120
|
+
A host that has a registry already starts `confineToRoot(registry, root)`. The function confines each procedure of the registry, and it adds no procedure:
|
|
121
121
|
|
|
122
122
|
```ts
|
|
123
|
-
import {
|
|
123
|
+
import { confineToRoot } from "@procedures/fs/module";
|
|
124
124
|
|
|
125
|
-
const { root,
|
|
125
|
+
const { root, fs, confined, programs, refused, unchanged } = confineToRoot(registry, "/work/project");
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
- Each `fs.*` procedure gets the handler of `createFsModule({ root })`.
|
|
129
|
+
- Each other procedure gets the decision of `rootDecisionOf(procedure)`. The decision reads the rules of `metadata.fsRoot`, or the effects of a procedure without rules.
|
|
130
|
+
- A confined procedure gets each path of its rules in the root. A procedure that the root cannot confine gives `FORBIDDEN` with the reason `outside-root`, as a path outside the root does.
|
|
128
131
|
- A nested call of another procedure finds the new handler in the registry. Thus `lib.scan`, which calls `fs.readdir`, reads only the folders in the root.
|
|
129
132
|
- The root must be a folder that exists. Otherwise the function throws, and the host does not start.
|
|
130
|
-
- An `fs.*` procedure of another package is an error, because the root cannot confine it.
|
|
133
|
+
- An `fs.*` procedure of another package is an error, because the root cannot confine it. Rules that are not correct are an error too. The function changes nothing when it throws.
|
|
131
134
|
- The hosts use this function: `mark --fs-root <folder>`, `procedure-server --fs-root <folder>` and `MCP_FS_ROOT` of the MCP server.
|
|
132
135
|
|
|
136
|
+
`confineFsProcedures(registry, root)` changes only the `fs.*` procedures, as before 0.8.0.
|
|
137
|
+
|
|
138
|
+
The rules, the default for a procedure without rules, and the table of the procedures of this repository are in [CAPABILITIES-2026-10.md](../documentation/CAPABILITIES-2026-10.md#the-root-of-the-files-roadmap-r33).
|
|
139
|
+
|
|
140
|
+
### The rules for other packages
|
|
141
|
+
|
|
142
|
+
The entry `@procedures/fs/root` has the rules of the root without the procedures: `inRoot()`, `resolveRoot()`, `realPathOf()`, `isInside()`, `outsideRoot()` and `isOutsideRoot()`. A package that confines its own paths imports them. `@procedures/archive` uses them for `createArchiveModule({ root })`.
|
|
143
|
+
|
|
133
144
|
### Rules
|
|
134
145
|
|
|
135
146
|
- A relative path starts at the root, not at the working folder of the process.
|
|
@@ -151,7 +162,7 @@ const { root, procedures } = confineFsProcedures(registry, "/work/project");
|
|
|
151
162
|
### Limits
|
|
152
163
|
|
|
153
164
|
- The check and the operation are two steps. The check does not see a symlink that a process changes between the two steps.
|
|
154
|
-
-
|
|
165
|
+
- `createFsModule({ root })` and `confineFsProcedures()` confine only the `fs.*` procedures and their nested calls. `confineToRoot()` also confines or refuses the other procedures.
|
|
155
166
|
- The root does not replace the permissions of the operating system.
|
|
156
167
|
|
|
157
168
|
## API Reference
|
|
@@ -928,8 +939,9 @@ client-fs/
|
|
|
928
939
|
│ ├── register.ts # Auto-registration
|
|
929
940
|
│ ├── index.ts # Main entry point
|
|
930
941
|
│ ├── module.ts # fsModule, createFsModule({ root })
|
|
931
|
-
│ ├── root.ts # The check of a path against the root
|
|
942
|
+
│ ├── root.ts # The check of a path against the root (the ./root entry)
|
|
932
943
|
│ ├── handlers.ts # The handlers with a root
|
|
944
|
+
│ ├── confine.ts # The root for the other procedures of a registry
|
|
933
945
|
│ ├── procedures/
|
|
934
946
|
│ │ ├── fs.ts # Barrel export
|
|
935
947
|
│ │ └── fs/
|