Throwaway prototypes for Sausage v3. Plan and decisions: ~/research/sausage-v3/PLAN.md. Results and evidence: the spike READMEs.
39 lines
1.7 KiB
Markdown
39 lines
1.7 KiB
Markdown
# S5: HTTP hook proof
|
|
|
|
The brief in `.board/T5.brief.md` defines this spike's contract.
|
|
|
|
The host assigns an identity to each WASI store. Its HTTP hook answers
|
|
`http://host.sausage/whoami` directly. This path never calls the network transport.
|
|
|
|
Items match a scheme, exact hosts or `*.suffix` hosts, path prefixes, and optional
|
|
methods. One match requires a grant or free use. The host then injects an
|
|
Authorization header through a Rust closure. No match preserves the request.
|
|
No grant returns a 403 that names the item. Multiple matches return an HTTP error.
|
|
The hook consumes the outgoing body before it returns an in-process response or error.
|
|
It also collects forwarded bodies before transport, with their data and trailers intact.
|
|
This prevents Hyper from closing an unknown-length GET body before the guest finishes its WASI stream.
|
|
The spike buffers forwarded bodies. It does not prove streaming forwarding.
|
|
|
|
The test server consumes the complete HTTP request body before it answers and closes the connection.
|
|
It validates the token but returns only its presence and correctness.
|
|
The guest prints its environment, files, request headers, and response.
|
|
The host checks that none contain its fresh token.
|
|
|
|
Run all cases from the repository root:
|
|
|
|
```sh
|
|
nu spikes/s5-http/verify.nu
|
|
```
|
|
|
|
Repeat the direct host run 20 times:
|
|
|
|
```sh
|
|
nu spikes/s5-http/repeat.nu after-body
|
|
```
|
|
|
|
The loop preserves each run's stdout and stderr separately under `/tmp/s5-http/`.
|
|
|
|
The spike does not implement durable approval requests, conversation ancestry,
|
|
JavaScript transforms, or a real credentials vault. Grants are a per-store boolean.
|
|
The filesystem contains one public fixture. The token remains in host memory.
|