@procedures/http 0.28.0 → 0.29.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 +49 -0
- package/README.md +17 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/host-fetch.d.ts +45 -0
- package/dist/host-fetch.d.ts.map +1 -0
- package/dist/host-fetch.js +51 -0
- package/dist/host-fetch.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +3 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +7 -2
- package/dist/module.js.map +1 -1
- package/package.json +2 -2
- package/src/host-fetch.ts +77 -0
- package/src/index.ts +2 -0
- package/src/module.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @procedures/http
|
|
2
2
|
|
|
3
|
+
## 0.29.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fa26063: The default modules refuse a loopback, private or link-local host through the host policy (audit pass 2, roadmap O55, findings 12 and 32, decision D35).
|
|
8
|
+
|
|
9
|
+
MINOR: a break. Before, `weather.forecast` and the `mcpHostModules` of `geo` and `ics` sent a request to such a host with the global `fetch`. Version 0.28 gave a `DeprecationWarning` for it. Now the request gets `FORBIDDEN` with the reason `host-not-allowed`, and the host gets no request.
|
|
10
|
+
|
|
11
|
+
- `weather.forecast` of the default `weatherModule` refuses a `baseUrl` on a loopback, private or link-local address. The warning `PROCEDURES_WEATHER_PRIVATE_HOST` goes away.
|
|
12
|
+
- The `mcpHostModules` of `@procedures/bundle-assistant` refuse such a `baseUrl` of `geo.geocode` and `geo.route`, and such a feed of `ics.fetch`. The warnings `PROCEDURES_GEO_PRIVATE_HOST` and `PROCEDURES_ICS_PRIVATE_HOST` go away. The dev-tools server uses these modules.
|
|
13
|
+
- `createHostFetch()` of `@procedures/http` loses the deprecated option `warnOnRefusal`. A refused host always throws.
|
|
14
|
+
- The default modules of `geo` and `ics` do not change. They keep the global `fetch`, because their roots run in a browser.
|
|
15
|
+
|
|
16
|
+
Migration:
|
|
17
|
+
|
|
18
|
+
- A host that sends `weather.forecast` to its own Open-Meteo server on such an address gives a `fetch` that allows it: `createRegistry(createWeatherModule({ fetch: createHostFetch({ allow: ["10.0.0.5:8080"] }) }))`.
|
|
19
|
+
- A host with a private Nominatim, OSRM or calendar server gives `createGeoModule({ fetch: createHostFetch({ allow: [...] }) })` or `createIcsModule({ fetch: createHostFetch({ allow: [...] }) })` to `createRegistry()` before the bundle.
|
|
20
|
+
- A host that gave `warnOnRefusal` to `createHostFetch()` removes it, and puts the host in `allow`.
|
|
21
|
+
- The site: no change. It does not call `weather.forecast`, `geo.*` or `ics.fetch` through a registry of Node.
|
|
22
|
+
- MiniMongo and Graph: no change. They do not use these procedures.
|
|
23
|
+
- jarvis: no change. `packages/pipeline` calls the function `geocode()` of `@procedures/geo`, not the procedure, so the host policy does not apply.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- @procedures/client@0.29.0
|
|
28
|
+
|
|
29
|
+
## 0.28.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- 21dc858: Fixes for the security findings of the second code audit (roadmap O55).
|
|
34
|
+
|
|
35
|
+
PATCH: bug fixes and additive options. Each fix refuses only an input that the documentation does not give. A caller that uses the documented behavior sees no change. A request to a loopback, private or link-local host still works, with a deprecation notice. Version 0.29.0 refuses it (decision D35).
|
|
36
|
+
|
|
37
|
+
- `procedure.delete` and `procedure.define` of `@procedures/client` obey the expose rule of the host, as `procedure.get` does (R17). `procedure.delete` does not find a hidden procedure, and `procedure.define` refuses to replace one with `NOT_EXPOSED`. A new procedure at a free path stays possible, as before. Before, a caller could remove or replace a hidden procedure that the host defined.
|
|
38
|
+
- The task store of `@procedures/mcp-server` keeps a task without a session (stdio, an SDK transport) apart from the HTTP sessions, both ways. Before, each HTTP session could list, read and cancel such a task.
|
|
39
|
+
- `restic.run` of `@procedures/restic` refuses each input that lets the caller choose a program for restic to start: `--from-password-command`, `--password-command2`, an extended option that sets `sftp.command`, `sftp.args`, `rclone.program` or `rclone.args` (each spelling), an sftp or rclone repository whose host or remote starts with `-`, and a positional argument that starts with `-` after a last flag without a value. Before, only `--password-command` was refused.
|
|
40
|
+
- `@procedures/http` exports `createHostFetch(options)`: a `fetch` for GET requests through the host policy, with the options of `createHttpModule()`. It also exports `httpSettings(options)`. The deprecated option `warnOnRefusal` keeps a refused host working: the process gets one `DeprecationWarning`, and the request goes through the global `fetch`.
|
|
41
|
+
- `weather.forecast` of `@procedures/weather` sends its request through `createHostFetch()` with `warnOnRefusal`. A `baseUrl` on a loopback, private or link-local address still works, with the warning `PROCEDURES_WEATHER_PRIVATE_HOST`. `createWeatherModule({ fetch })` gives another `fetch`, for a server of the host on such an address.
|
|
42
|
+
- `@procedures/geo` and `@procedures/ics` add `createGeoModule({ fetch })` and `createIcsModule({ fetch })`. Their default stays the global `fetch`, because their roots run in a browser. A refusal of the host policy keeps its code and its reason. The refusal of `ics.fetch` does not name the feed address.
|
|
43
|
+
- `@procedures/bundle-assistant` exports `mcpHostModules`: the modules of `geo` and `ics` with `createHostFetch()` and `warnOnRefusal`. A refused host gets the warning `PROCEDURES_GEO_PRIVATE_HOST` or `PROCEDURES_ICS_PRIVATE_HOST`. The bundle keeps the default modules, so `mark` and the site load it next to `geo` and `ics` as before.
|
|
44
|
+
- The dev-tools server of `@procedures/mcp-dev-tools` gives the `mcpHostModules` of each bundle to `createRegistry()` before the bundles. In one call, the first module of a name counts. Thus `geo.geocode`, `geo.route`, `weather.forecast` and `ics.fetch` of the dev-tools server go through the default host policy.
|
|
45
|
+
|
|
46
|
+
A host that sends `weather.forecast`, or the bundle's `geo` tools, to a server on a private address can remove the warning now. It gives a `fetch` that allows the server: `createWeatherModule({ fetch: createHostFetch({ allow: ["10.0.0.5:8080"] }) })`. This `fetch` refuses each other private host now, as 0.29.0 does by default.
|
|
47
|
+
- Updated dependencies [345c740]
|
|
48
|
+
- Updated dependencies [984c13b]
|
|
49
|
+
- Updated dependencies [21dc858]
|
|
50
|
+
- @procedures/client@0.28.1
|
|
51
|
+
|
|
3
52
|
## 0.28.0
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -90,6 +90,23 @@ const registry = createRegistry(createHttpModule({ allow: ["localhost:11434", "1
|
|
|
90
90
|
- A bad entry of `allow` makes `createHttpModule()` throw.
|
|
91
91
|
- A host gives `createHttpModule()` to `createRegistry()` before its bundles. Then it replaces the `httpModule` in the modules of a bundle.
|
|
92
92
|
|
|
93
|
+
### The host policy in other packages
|
|
94
|
+
|
|
95
|
+
`createHostFetch(options)` gives a `fetch` for GET requests through the same checks. Its options are the options of `createHttpModule()`. A procedure of another package uses it for a URL of its caller:
|
|
96
|
+
|
|
97
|
+
- `weather.forecast` uses it by default.
|
|
98
|
+
- `createGeoModule({ fetch })` and `createIcsModule({ fetch })` take it. Their default stays the global `fetch`, because their roots run in a browser.
|
|
99
|
+
- `mcpHostModules` of `@procedures/bundle-assistant` gives it to the modules of `geo` and `ics`. The dev-tools server puts them before its bundles.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { createHostFetch } from "@procedures/http";
|
|
103
|
+
import { createGeoModule } from "@procedures/geo/module";
|
|
104
|
+
|
|
105
|
+
const registry = createRegistry(createGeoModule({ fetch: createHostFetch({ allow: ["osrm.lan:5000"] }) }));
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A refusal is `FORBIDDEN` with the reason `host-not-allowed`. When the signal of the caller aborts, the function throws the reason of the signal, as `fetch` does.
|
|
109
|
+
|
|
93
110
|
## Limits and time
|
|
94
111
|
|
|
95
112
|
- Each input of `http.request` and `http.json` has `timeoutMs`. The default is 30 seconds.
|