@fuzdev/fuz_app 0.171.0 → 0.173.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.
Files changed (53) hide show
  1. package/dist/actions/CLAUDE.md +1 -1
  2. package/dist/actions/perform_action.d.ts +4 -3
  3. package/dist/actions/perform_action.d.ts.map +1 -1
  4. package/dist/actions/perform_action.js +21 -16
  5. package/dist/http/CLAUDE.md +5 -4
  6. package/dist/http/error_schemas.d.ts +11 -5
  7. package/dist/http/error_schemas.d.ts.map +1 -1
  8. package/dist/http/error_schemas.js +12 -6
  9. package/dist/http/host.d.ts +137 -0
  10. package/dist/http/host.d.ts.map +1 -0
  11. package/dist/http/host.js +203 -0
  12. package/dist/http/json_text.d.ts +4 -0
  13. package/dist/http/json_text.d.ts.map +1 -1
  14. package/dist/http/json_text.js +4 -0
  15. package/dist/http/origin.d.ts +9 -0
  16. package/dist/http/origin.d.ts.map +1 -1
  17. package/dist/http/origin.js +6 -2
  18. package/dist/http/origin_wildcard.d.ts +20 -5
  19. package/dist/http/origin_wildcard.d.ts.map +1 -1
  20. package/dist/http/origin_wildcard.js +22 -10
  21. package/dist/http/route_spec.d.ts.map +1 -1
  22. package/dist/http/route_spec.js +8 -2
  23. package/dist/http/schema_helpers.d.ts +21 -7
  24. package/dist/http/schema_helpers.d.ts.map +1 -1
  25. package/dist/http/schema_helpers.js +31 -13
  26. package/dist/server/app_server.d.ts +10 -0
  27. package/dist/server/app_server.d.ts.map +1 -1
  28. package/dist/server/app_server.js +14 -3
  29. package/dist/testing/CLAUDE.md +5 -6
  30. package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
  31. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  32. package/dist/testing/cross_backend/in_process_setup.js +2 -1
  33. package/dist/testing/cross_backend/origin_conformance.d.ts +62 -1
  34. package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
  35. package/dist/testing/cross_backend/origin_conformance.js +34 -5
  36. package/dist/testing/cross_backend/origin_conformance.json +330 -0
  37. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -6
  38. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  39. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -15
  40. package/dist/testing/cross_backend/testing_origin_check.d.ts +16 -1
  41. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  42. package/dist/testing/cross_backend/testing_origin_check.js +12 -4
  43. package/dist/testing/cross_backend/testing_server_core.d.ts +2 -2
  44. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  45. package/dist/testing/cross_backend/testing_server_core.js +3 -3
  46. package/dist/testing/stubs.d.ts +11 -4
  47. package/dist/testing/stubs.d.ts.map +1 -1
  48. package/dist/testing/stubs.js +10 -5
  49. package/dist/ui/AppShell.svelte +1 -1
  50. package/dist/ui/PopoverButton.svelte +1 -1
  51. package/dist/ui/popover.svelte.d.ts +1 -1
  52. package/dist/ui/popover.svelte.js +1 -1
  53. package/package.json +8 -4
@@ -292,7 +292,7 @@ Pipeline (401 → authz → 403 → 429 → 400 → handler):
292
292
  2. Authorization phase — `apply_authorization_phase` against `account_id` + `read_acting(auth, raw_params)`, which takes the selector off the raw params (malformed reads as omitted) since validation runs later. Test escape hatch via `preset.request_context`
293
293
  3. Post-authorization auth (403) — credential-type gate, then token scope, then role
294
294
  4. Rate limit (429) — throttle-requests semantics, ahead of validation so malformed params charge the budget and a throttled caller pays no schema work
295
- 5. Validate params (400) — first, object params holding an own `__proto__` key at any depth are refused on every input with `data.reason` `params_proto_key` (`json_has_own_proto_key` in `http/schema_helpers.ts`, an iterative walk; `ERROR_PARAMS_PROTO_KEY`; the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal); then `spec.input` parses them (`parse`) with void / `?? {}` rules; a void input (`is_void_schema`: `s.void`) reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `meta` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the issues DEV-only, as `WireIssue`s (`to_wire_issues`)
295
+ 5. Validate params (400) — first, one walk of object params (`scan_json_value` in `http/schema_helpers.ts`, iterative) refuses, on every input, an own `__proto__` key at any depth with `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), then U+0000 in any string or key with `params_nul` (`ERROR_PARAMS_NUL` — Postgres refuses it in `text` and `jsonb`); the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal; then `spec.input` parses them (`parse`) with void / `?? {}` rules; a void input (`is_void_schema`: `s.void`) reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `meta` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the issues DEV-only, as `WireIssue`s (`to_wire_issues`)
296
296
  6. Dispatch + DEV output validation + error normalization — `spec.side_effects` picks transaction vs pool. `ThrownJsonrpcError` preserves code + data; generic throws become `internal_error`
297
297
 
298
298
  `PerformActionInput` carries `auth` (the request's `ResolvedAuth`, `null` for
@@ -27,9 +27,10 @@
27
27
  * (`request_context.account.id`), settled by authentication, so the gate
28
28
  * sits behind the authority gates by choice rather than necessity: a
29
29
  * caller those gates refuse is answered 403, not 429.
30
- * 5. **Validate params (400)** — first, object `params` holding an own
31
- * `__proto__` key at any depth (`json_has_own_proto_key`) are refused
32
- * with `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), on
30
+ * 5. **Validate params (400)** — first, one walk of object `params`
31
+ * (`scan_json_value`) refuses an own `__proto__` key at any depth, with
32
+ * `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), then
33
+ * U+0000 in any string or key, with `params_nul` (`ERROR_PARAMS_NUL`), on
33
34
  * every input schema, before it runs; then
34
35
  * `spec.input` parses the params (`parse`) with
35
36
  * void / `?? {}` rules (`to_input_params`). A refusal is the generic
@@ -1 +1 @@
1
- {"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAS,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAGvB,MAAM,oBAAoB,CAAC;AAiB5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,kEAAkE;IAClE,MAAM,EAAE,SAAS,CAAC;IAClB,qGAAqG;IACrG,UAAU,E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GAKG;AACH,MAAM,MAAM,mBAAmB,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAC1B,OAAO,kBAAkB,EACzB,MAAM,iBAAiB,KACrB,OAAO,CAAC,mBAAmB,CA2L7B,CAAC;AA8BF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GACnC,OAAO,SAAS,EAChB,QAAQ,aAAa,CAAC,WAAW,CAAC,EAClC,QAAQ,OAAO,KACb,kBAOF,CAAC;AA6DF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAC1C,2BAA2B,aAAa,CAAC,MAAM,CAAC,KAC9C,kBAIA,CAAC;AAqEJ,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,mBAAmB,EAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,KACT,sBAkBF,CAAC"}
@@ -27,9 +27,10 @@
27
27
  * (`request_context.account.id`), settled by authentication, so the gate
28
28
  * sits behind the authority gates by choice rather than necessity: a
29
29
  * caller those gates refuse is answered 403, not 429.
30
- * 5. **Validate params (400)** — first, object `params` holding an own
31
- * `__proto__` key at any depth (`json_has_own_proto_key`) are refused
32
- * with `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), on
30
+ * 5. **Validate params (400)** — first, one walk of object `params`
31
+ * (`scan_json_value`) refuses an own `__proto__` key at any depth, with
32
+ * `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), then
33
+ * U+0000 in any string or key, with `params_nul` (`ERROR_PARAMS_NUL`), on
33
34
  * every input schema, before it runs; then
34
35
  * `spec.input` parses the params (`parse`) with
35
36
  * void / `?? {}` rules (`to_input_params`). A refusal is the generic
@@ -67,13 +68,13 @@ import { resolved_auth_scope, resolved_auth_session_hash } from '../auth/resolve
67
68
  import { is_db_checkout_error } from '../db/db_checkout_error.js';
68
69
  import { resolve_issues_invalid_reason } from '../schema_meta.js';
69
70
  import { to_wire_issues } from '../schema_issues.js';
70
- import { json_has_own_proto_key, to_input_params } from '../http/schema_helpers.js';
71
+ import { scan_json_value, to_input_params } from '../http/schema_helpers.js';
71
72
  import { rate_limit_ip_key } from '../http/ip_canonical.js';
72
73
  import { dispatch_with_post_commit_rollback } from '../http/pending_effects.js';
73
74
  import {} from '../http/jsonrpc.js';
74
75
  import { create_jsonrpc_error_response, create_jsonrpc_response } from '../http/jsonrpc_helpers.js';
75
76
  import { jsonrpc_error_messages, jsonrpc_error_code_to_http_status, http_status_to_jsonrpc_error_code, JSONRPC_ERROR_CODES, dev_only, to_thrown_jsonrpc_error } from '../http/jsonrpc_errors.js';
76
- import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_PARAMS_PROTO_KEY, ERROR_TOKEN_SCOPE_REQUIRED } from '../http/error_schemas.js';
77
+ import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_PARAMS_NUL, ERROR_PARAMS_PROTO_KEY, ERROR_TOKEN_SCOPE_REQUIRED } from '../http/error_schemas.js';
77
78
  import { is_public_auth, needs_actor, parse_acting } from '../http/auth_shape.js';
78
79
  import { token_scope_admits_method, token_scope_method_capability } from '../auth/token_scope.js';
79
80
  /**
@@ -173,17 +174,21 @@ export const perform_action = async (input, deps) => {
173
174
  // a void input reads every empty shape as the no-arg call — see
174
175
  // `to_input_params`.
175
176
  //
176
- // An own `__proto__` key anywhere in object params is refused first, on
177
- // every input: a loose schema passes it through, so a schema alone would
178
- // store it — a sink for
179
- // any client that copies the value back with plain assignment. Only an
180
- // object is walked, so a non-object `params` is the schema's refusal, as
181
- // the Rust twin's shape check answers it ahead of its walk.
182
- if (typeof raw_params === 'object' &&
183
- raw_params !== null &&
184
- !Array.isArray(raw_params) &&
185
- json_has_own_proto_key(raw_params)) {
186
- return error_result(jsonrpc_error_messages.invalid_params('invalid params', { reason: ERROR_PARAMS_PROTO_KEY }));
177
+ // One walk of object params refuses, on every input and ahead of the
178
+ // schema, an own `__proto__` key anywhere (a loose schema passes it
179
+ // through, so a schema alone would store it — a sink for any client that
180
+ // copies the value back with plain assignment), then U+0000 in any string
181
+ // or key (Postgres refuses it in `text` and `jsonb`, so the write would
182
+ // 500). Only an object is walked, so a non-object `params` is the schema's
183
+ // refusal, as the Rust twin's shape check answers it ahead of its walk.
184
+ if (typeof raw_params === 'object' && raw_params !== null && !Array.isArray(raw_params)) {
185
+ const scan = scan_json_value(raw_params);
186
+ if (scan.proto_key) {
187
+ return error_result(jsonrpc_error_messages.invalid_params('invalid params', { reason: ERROR_PARAMS_PROTO_KEY }));
188
+ }
189
+ if (scan.nul) {
190
+ return error_result(jsonrpc_error_messages.invalid_params('invalid params', { reason: ERROR_PARAMS_NUL }));
191
+ }
187
192
  }
188
193
  const params = to_input_params(spec.input, raw_params);
189
194
  const parse_result = parse(spec.input, params);
@@ -21,7 +21,7 @@ effects, see ../../../docs/architecture.md.
21
21
  - `http/route_errors.ts` — the route error map: `RouteErrorMap`, `resolve_route_error_map`, `resolve_app_route_error_maps`, `get_route_error_map`.
22
22
  - `http/route_error_check.ts` — `check_route_error` (whether an error response is one its route's map declares, the rule the DEV error check and `assert_response_matches_spec` share; `ALWAYS_ACCEPTED_ERRORS`, `is_error_status`, `format_route_error_check`) `is_json_response`, and the test helpers' hono-free route lookup (`split_route_template` and `parse_route_param`, a template read segment by segment as Hono's `getPattern` reads it; `compile_route_path`; `compile_route_param_pattern`, a `{re}` grouped and anchored as `compile_route_path` reads it — Hono's RegExpRouter reading, stricter than TrieRouter's ungrouped `^re$`; `decode_route_path`, a path as Hono's router decodes it; `to_mounted_routes`; `find_mounted_route`), whose reading `resolve_valid_path` also fills params by. Hono-free and `esm-env`-free.
23
23
  - `http/dev_route_error_check.ts` — `create_dev_route_error_check({route_specs, route_error_maps, log})`: the DEV-only outer error check, `null` outside DEV; `create_route_lookup`, its lookup by Hono's own router.
24
- - `http/schema_helpers.ts` — shared schema introspection (null/void/strict/surface/middleware-applies), and `to_void_params` / `to_input_params` / `json_has_own_proto_key` / `safe_parse_dropping_unknown_keys`.
24
+ - `http/schema_helpers.ts` — shared schema introspection (null/void/strict/surface/middleware-applies), and `to_void_params` / `to_input_params` / `scan_json_value` / `safe_parse_dropping_unknown_keys`.
25
25
  - `http/json_text.ts` — `parse_json_text`: JSON text read as the Rust spine's `serde_json` reads it, refusing what `JSON.parse` accepts and serde refuses (an escaped lone surrogate in a string or key, a number out of `f64` range, nesting `JSON_DEPTH_LIMIT` (128) deep); one linear scan of the text after `JSON.parse` accepts it (`is_serde_json_text`), so a refused value under a duplicated key is seen and the cost stays a few milliseconds a MiB. `read_json_body(c.req)` reads a request body through it once per request (the authorization phase's `acting` read and input validation share it), as text, never `c.req.json()`. Every body and frame parse runs it: route input, the RPC POST body and `GET` `params`, WS frames. Hono-free, imports nothing.
26
26
  - `http/middleware_spec.ts` — `MiddlewareSpec` interface.
27
27
  - `http/body_limit.ts` — `create_body_limit_middleware(max_size)`: the `413` body cap `create_app_server` mounts, as `create_body_limit_middleware_spec(max_size)`, a `MiddlewareSpec` at `'*'` ahead of the other middleware, absent with `max_body_size: null`. Its hono-free shape, `body_limit_middleware_shape` (`http/body_limit_schema.ts`), declares its `413` `payload_too_large` and `400` `invalid_content_length`, so every route's error map carries both; `create_test_app_surface_spec` lists the same shape with a stub handler. Refuses on `Content-Length` without reading `c.req.raw.body` and answers `Connection: close` — `413` past the cap, `400` `ERROR_INVALID_CONTENT_LENGTH` when the value is not a plain run of ASCII digits (a length the cap cannot read, which Hono's `bodyLimit` would pass uncounted) — else falls through to Hono's `bodyLimit` (no `Content-Length`, or one beside `Transfer-Encoding`), which reads the body into memory up to the cap before the next middleware runs, so its `413` — no `Connection: close` — also precedes origin and auth. After the header `413` Node and Bun close at once (the header is what makes them — Bun 1.4.3 is the tested floor, an older Bun kept the connection and served the next request) and Deno closes once the declared body has arrived (../../../docs/security.md §Body Size Limiting).
@@ -31,6 +31,7 @@ effects, see ../../../docs/architecture.md.
31
31
  - `http/client_ip.ts` — `get_client_ip(c)` — reads the resolved IP off the context (set by `proxy.ts`'s middleware). Split out of `proxy.ts` so it's hono-free: dispatch + route modules that only _read_ the IP don't pull `hono/utils/ipaddr`, keeping cross-process test surfaces free of the optional `hono` peer.
32
32
  - `http/ip_canonical.ts` — RFC 5952 IPv6 canonicalization + IPv4-mapped collapse, `rate_limit_ip_key` (an IPv6 client's `/64`), and its own `parse_ipv4_bits` / `parse_ipv6_bits` (the grammar of Rust's `IpAddr::from_str`); `IP_LITERAL_CHARS` regex. Imports nothing — the dispatcher keys its IP limiter through it, so it must stay hono-free (`src/test/hono_free_modules.test.ts` walks every `src/lib` module's graph).
33
33
  - `http/origin.ts` — origin allowlist: the strict pattern grammar shared with the Rust spine, typed refusals, and the Origin-only middleware.
34
+ - `http/host.ts` — the host gate (DNS rebinding): `is_loopback_host`, `allows_host` / `allows_request_hosts` over the origin matchers, `create_host_gate_middleware_spec` (`'*'`, 403 `forbidden_host`, on by default in `create_app_server`) and its rate-limited refusal warning (`format_host_refusal_warning`). Twin of the Rust `fuz_http::host`; verdicts pinned by the host rows of `testing/cross_backend/origin_conformance.json` (../../../docs/security.md §DNS Rebinding).
34
35
  - `http/jsonrpc.ts` — JSON-RPC 2.0 envelope schemas (MCP superset, fuz_schema), `JsonrpcErrorCode`.
35
36
  - `http/jsonrpc_errors.ts` — `ThrownJsonrpcError`, `jsonrpc_errors` throwers, HTTP-status mappings.
36
37
  - `http/jsonrpc_helpers.ts` — message builders, type guards, input/result normalizers, and `classify_jsonrpc_message`, the one envelope classifier both transports run.
@@ -214,7 +215,7 @@ action-handler surfaces (REST, RPC, WS); see ../../../docs/architecture.md
214
215
 
215
216
  `http/error_schemas.ts` is the **declarative** error surface:
216
217
 
217
- - `ERROR_*` `snake_case` string constants (`ERROR_FORBIDDEN_HOST` / `REST_FORBIDDEN_HOST` the Rust spine's host gate, which the TS spine lacks) — single source of truth for codes; they double as JSON-RPC `data.reason`s, so they carry no HTTP status
218
+ - `ERROR_*` `snake_case` string constants (`ERROR_FORBIDDEN_HOST` / `REST_FORBIDDEN_HOST` the host gate's) — single source of truth for codes; they double as JSON-RPC `data.reason`s, so they carry no HTTP status
218
219
  - `rest_error(status, code, fields?, headers?)` → `RestErrorDef<S, C, F>` — one code at one status; the code must be a code, `REST_ERROR_CODE_PATTERN` (`^[a-z][a-z0-9_]*$`, `is_rest_error_code`) — a throw at definition, and a literal plainly off it (prose, uppercase, a leading digit) a type error — so prose goes in `message`; its body `loose_object({error: literal(code), ...fields})` as `.schema`; `headers` derives response headers from a body (`Retry-After`). Status and code must be literals. One `REST_*` definition per code a route or middleware answers (`REST_TABLE_NOT_FOUND`, `REST_RATE_LIMIT_EXCEEDED`, …); a code with a second body shape gets a second definition (`REST_AUTHENTICATION_REQUIRED_BOOTSTRAP`, `/account/status`'s 401 with `bootstrap_available`)
219
220
  - `to_error_schemas(defs)` — a status map from definitions: one schema at a status maps to it, more to a `union` in list order
220
221
  - `ErrorSchemas = Record<number, AnySchema>` — a status map, what `to_error_schemas` groups definitions into: one schema at a status, or a `union` of them
@@ -298,7 +299,7 @@ confirmation.
298
299
 
299
300
  ### `ERROR_*` constants by category
300
301
 
301
- - **Validation**: `ERROR_INVALID_REQUEST_BODY`, `ERROR_INVALID_JSON_BODY`, `ERROR_INVALID_ROUTE_PARAMS`, `ERROR_INVALID_QUERY_PARAMS`, `ERROR_PARAMS_PROTO_KEY` (RPC params)
302
+ - **Validation**: `ERROR_INVALID_REQUEST_BODY`, `ERROR_INVALID_JSON_BODY`, `ERROR_INVALID_ROUTE_PARAMS`, `ERROR_INVALID_QUERY_PARAMS`, `ERROR_PARAMS_PROTO_KEY` + `ERROR_PARAMS_NUL` (RPC params)
302
303
  - **Auth**: `ERROR_AUTHENTICATION_REQUIRED`, `ERROR_INSUFFICIENT_PERMISSIONS`, `ERROR_CREDENTIAL_TYPE_REQUIRED`, `ERROR_RATE_LIMIT_EXCEEDED`, `ERROR_INVALID_CREDENTIALS`, `ERROR_PAYLOAD_TOO_LARGE`, `ERROR_INVALID_CONTENT_LENGTH`
303
304
  - **Origin + bearer**: `ERROR_FORBIDDEN_ORIGIN`, `ERROR_INVALID_TOKEN`, `ERROR_ACCOUNT_NOT_FOUND`
304
305
  - **Keeper/daemon**: `ERROR_KEEPER_ACCOUNT_NOT_FOUND`
@@ -324,7 +325,7 @@ Key helpers:
324
325
  - `is_void_schema(schema)` — a `literal(undefined)` (what `s.void` is, a `meta` copy included; a kind check like `is_null_schema`, so an optional schema is not void); a void input declares a parameterless RPC method
325
326
  - `to_void_params(raw_params)` — reads absent, `null`, and `{}` params of a void input as the no-arg call (`undefined`), passing any other shape through for the void schema to refuse — the twin of the Rust spine's `require_void_params`
326
327
  - `to_input_params(input, raw_params)` — the one params normalizer every receiving end runs before the input parse (`parse`): `to_void_params` for a void input, else absent/`null` → `{}`; used by both the server dispatch core (`perform_action`) and the peer receive path (`ActionDispatcher`)
327
- - `json_has_own_proto_key(value)` — whether any object in a parsed JSON value has an own `__proto__` key, by an iterative walk (no recursion — `JSON.parse` nests deeper than the call stack); the dispatcher refuses such params with `ERROR_PARAMS_PROTO_KEY`. Twin of the Rust `fuz_http::json_has_own_proto_key`
328
+ - `scan_json_value(value)` → `JsonValueScan` (`{proto_key, nul}`) — one iterative walk (no recursion — `JSON.parse` nests deeper than the call stack) of a parsed JSON value for an own `__proto__` key in any object and U+0000 in any string or key; the dispatcher refuses such params with `ERROR_PARAMS_PROTO_KEY`, then `ERROR_PARAMS_NUL`, and route input validation a NUL body with `invalid_request_body`. Reads the parsed value, so of duplicate keys only the kept one counts. Twin of the Rust `fuz_http::scan_json_value`
328
329
  - `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload, returning `parse`'s `{ok, value}` / `{ok: false, issues}`: while every issue is an unknown key (`unknown_key_targets`), strips them from a copy and reparses — after the first parse that reports unknown keys, one schema-guided pass deletes every key a strict `object` doesn't name anywhere the schema reaches (entries, array items, record values, the `variant` option), as a parse reports at most a hundred issues; a key under a `union` is never stripped (the union fails as one issue of its own), and a later `pipe` stage is stripped only as reported — until nothing is left to strip, capped at `UNKNOWN_KEY_PASSES_MAX` passes (the last failure returned past it); any other issue still fails. Used for response `result`s (`ActionEvent`) and peer replies (`peer/ping`); matches serde's ignore-unknown-fields default on the Rust spine
329
330
  - `is_strict_object_schema(schema)` — detects an `object` (not `strip_object` / `loose_object`); a `pipe` is read through to its first schema when no stage is a `transform` (so a refined `object` reads strict)
330
331
  - `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — throws first on a value that is no schema (`assert_validation_schema`, naming `source`, so an assembled app's slot holding none fails boot as registration would refuse it, not as an unwritable JSON Schema); a schema → JSON Schema (`to_json_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `unknown`) or one the emitter refuses outright throws, prefixed with `source` — so a root-level transform output fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
@@ -30,9 +30,16 @@ export declare const ERROR_INVALID_QUERY_PARAMS: "invalid_query_params";
30
30
  /**
31
31
  * An RPC call's `params` hold an own `__proto__` key, at any depth — refused
32
32
  * by the dispatcher (`invalid_params`) before the input schema runs. See
33
- * `json_has_own_proto_key`.
33
+ * `scan_json_value`.
34
34
  */
35
35
  export declare const ERROR_PARAMS_PROTO_KEY: "params_proto_key";
36
+ /**
37
+ * An RPC call's `params` hold U+0000 in a string or a key, at any depth, which
38
+ * Postgres refuses to store — refused by the dispatcher (`invalid_params`)
39
+ * before the input schema runs, after the proto-key check. See
40
+ * `scan_json_value`; a route body holding one is `invalid_request_body`.
41
+ */
42
+ export declare const ERROR_PARAMS_NUL: "params_nul";
36
43
  /** No valid session or bearer token. */
37
44
  export declare const ERROR_AUTHENTICATION_REQUIRED: "authentication_required";
38
45
  /** Authenticated but missing required role. */
@@ -76,10 +83,9 @@ export declare const ERROR_INVALID_CONTENT_LENGTH: "invalid_content_length";
76
83
  /** Request origin not in allowlist. */
77
84
  export declare const ERROR_FORBIDDEN_ORIGIN: "forbidden_origin";
78
85
  /**
79
- * The request's `Host` names a host the server doesn't answer to — the Rust
80
- * spine's DNS-rebinding gate (`host_gate`), its `FORBIDDEN_HOST_REASON`. The
81
- * TS spine has no host gate; a surface describing a Rust server that mounts
82
- * one declares it.
86
+ * The request's `Host` names a host the server doesn't answer to — the
87
+ * DNS-rebinding gate (`http/host.ts`, the Rust spine's `host_gate`, its
88
+ * `FORBIDDEN_HOST_REASON`).
83
89
  */
84
90
  export declare const ERROR_FORBIDDEN_HOST: "forbidden_host";
85
91
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"error_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAYN,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;A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ERROR_INVALID_QUERY_PARAMS = 'invalid_query_params';
31
31
  /**
32
32
  * An RPC call's `params` hold an own `__proto__` key, at any depth — refused
33
33
  * by the dispatcher (`invalid_params`) before the input schema runs. See
34
- * `json_has_own_proto_key`.
34
+ * `scan_json_value`.
35
35
  */
36
36
  export const ERROR_PARAMS_PROTO_KEY = 'params_proto_key';
37
+ /**
38
+ * An RPC call's `params` hold U+0000 in a string or a key, at any depth, which
39
+ * Postgres refuses to store — refused by the dispatcher (`invalid_params`)
40
+ * before the input schema runs, after the proto-key check. See
41
+ * `scan_json_value`; a route body holding one is `invalid_request_body`.
42
+ */
43
+ export const ERROR_PARAMS_NUL = 'params_nul';
37
44
  // --- Core: Authentication & authorization (auto-derived by auth middleware) ---
38
45
  /** No valid session or bearer token. */
39
46
  export const ERROR_AUTHENTICATION_REQUIRED = 'authentication_required';
@@ -79,10 +86,9 @@ export const ERROR_INVALID_CONTENT_LENGTH = 'invalid_content_length';
79
86
  /** Request origin not in allowlist. */
80
87
  export const ERROR_FORBIDDEN_ORIGIN = 'forbidden_origin';
81
88
  /**
82
- * The request's `Host` names a host the server doesn't answer to — the Rust
83
- * spine's DNS-rebinding gate (`host_gate`), its `FORBIDDEN_HOST_REASON`. The
84
- * TS spine has no host gate; a surface describing a Rust server that mounts
85
- * one declares it.
89
+ * The request's `Host` names a host the server doesn't answer to — the
90
+ * DNS-rebinding gate (`http/host.ts`, the Rust spine's `host_gate`, its
91
+ * `FORBIDDEN_HOST_REASON`).
86
92
  */
87
93
  export const ERROR_FORBIDDEN_HOST = 'forbidden_host';
88
94
  /**
@@ -363,7 +369,7 @@ export const REST_TOKEN_SCOPE_REQUIRED = rest_error(403, ERROR_TOKEN_SCOPE_REQUI
363
369
  });
364
370
  // 403: the origin check, bootstrap, signup
365
371
  export const REST_FORBIDDEN_ORIGIN = rest_error(403, ERROR_FORBIDDEN_ORIGIN);
366
- // 403: the Rust spine's host gate
372
+ // 403: the host gate
367
373
  export const REST_FORBIDDEN_HOST = rest_error(403, ERROR_FORBIDDEN_HOST);
368
374
  export const REST_ALREADY_BOOTSTRAPPED = rest_error(403, ERROR_ALREADY_BOOTSTRAPPED);
369
375
  export const REST_NO_MATCHING_INVITE = rest_error(403, ERROR_NO_MATCHING_INVITE);
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Host verification — refusing requests addressed to a name the server
3
+ * doesn't answer to, which is how DNS rebinding reaches a loopback server.
4
+ *
5
+ * In a rebinding attack, a page on an attacker's domain re-resolves that
6
+ * domain to `127.0.0.1` and talks to the local server **same-origin**: its
7
+ * GETs carry no `Origin` header, so the origin allowlist (`http/origin.ts`)
8
+ * doesn't apply. The `Host` header gives it away — the browser sets it from
9
+ * the URL, so it names the attacker's domain, never `localhost`.
10
+ *
11
+ * A host is allowed when its name is loopback (`localhost`, `127.0.0.0/8`,
12
+ * `[::1]`), at any port — a rebinding page can't put one of those in `Host`
13
+ * — or when an allowed origin names it (the allowlist is where the server's
14
+ * UI is served from, so its hosts are the server's own names). Matching
15
+ * reuses the origin matchers, so `http://localhost:*` or `https://*.fuz.dev`
16
+ * admit the hosts they'd admit as origins.
17
+ *
18
+ * A request without a `Host` header passes: browsers always send one, so its
19
+ * absence means a non-browser client, which the auth stack governs. A request
20
+ * with more than one `Host` is refused (RFC 9112 §3.2) — the runtimes join a
21
+ * repeated header into one value (`a, b`), which names no host.
22
+ *
23
+ * The gate is on by default (`AppServerOptions.host_gate`). A refusal is said
24
+ * in the log as well as answered: the first in each
25
+ * `HOST_REFUSAL_WARN_INTERVAL_MS` is a warning naming the refused `Host`
26
+ * (quoted ASCII-only and truncated, since the client wrote it) and the env var
27
+ * that lists the server's names, with a count of the refusals the interval
28
+ * held back. The response says neither, so a client learns nothing about the
29
+ * allowlist.
30
+ *
31
+ * Twin of the Rust spine's `fuz_http::host`.
32
+ *
33
+ * @module
34
+ */
35
+ import type { Logger } from '@fuzdev/fuz_util/log.ts';
36
+ import type { MiddlewareHandler } from 'hono';
37
+ import type { MiddlewareSpec } from './middleware_spec.js';
38
+ /** Where the host gate mounts — every path, as the Rust stack mounts it in every group. */
39
+ export declare const HOST_MIDDLEWARE_PATH = "*";
40
+ /**
41
+ * The shortest gap between two refusal warnings, in milliseconds; the
42
+ * refusals between are counted and reported with the next one.
43
+ */
44
+ export declare const HOST_REFUSAL_WARN_INTERVAL_MS = 60000;
45
+ /**
46
+ * True when `host` (a `Host` header value, `name[:port]`) names a loopback
47
+ * address: `localhost`, an IPv4 address in `127.0.0.0/8`, or `[::1]`.
48
+ *
49
+ * Anything after the name but a `:` and a port (decimal digits, at most 65535)
50
+ * makes it not loopback: `[::1]junk`, `localhost:abc`, and `localhost: 1` are
51
+ * refused. Twin of the Rust `is_loopback_host`.
52
+ *
53
+ * @param host - one `Host` header value
54
+ * @returns whether it names a loopback address
55
+ */
56
+ export declare const is_loopback_host: (host: string) => boolean;
57
+ /**
58
+ * Check one `Host` value: loopback, or named by an allowed origin on either
59
+ * scheme. Twin of the Rust `AllowedOrigins::allows_host`.
60
+ *
61
+ * @param host - one `Host` header value
62
+ * @param allowed_patterns - the matchers `parse_allowed_origins` built
63
+ * @returns whether the server answers to it
64
+ */
65
+ export declare const allows_host: (host: string, allowed_patterns: ReadonlyArray<RegExp>) => boolean;
66
+ /**
67
+ * Host check for a request's `Host` header values — true when there are none
68
+ * or one that passes `allows_host`. A value that isn't visible ASCII (a tab
69
+ * and the space allowed, as in a header value) is refused, and so is more than
70
+ * one `Host` (RFC 9112 §3.2). Twin of the Rust
71
+ * `AllowedOrigins::allows_request_hosts`.
72
+ *
73
+ * @param hosts - the request's `Host` values, `[]` for none
74
+ * @param allowed_patterns - the matchers `parse_allowed_origins` built
75
+ * @returns whether the request passes the host gate
76
+ */
77
+ export declare const allows_request_hosts: (hosts: ReadonlyArray<string>, allowed_patterns: ReadonlyArray<RegExp>) => boolean;
78
+ /**
79
+ * The refusal warning's text. Twin of the Rust `format_host_refusal_warning`.
80
+ *
81
+ * @param host - the refused `Host` as the request carried it
82
+ * @param allowed_origins_var - the env var the allowlist was read from
83
+ * @param held_back - the refusals held back since the last warning
84
+ * @returns one log line
85
+ */
86
+ export declare const format_host_refusal_warning: (host: string, allowed_origins_var: string, held_back: number) => string;
87
+ /**
88
+ * Counts refusals between warnings, so a flood of foreign `Host`s writes one
89
+ * line per `HOST_REFUSAL_WARN_INTERVAL_MS` and holds no per-host state.
90
+ */
91
+ export interface HostRefusalWarnings {
92
+ /**
93
+ * Record a refusal at `now_ms`: the refusals held back since the last
94
+ * warning when this one is warned, `null` when it is held back itself.
95
+ */
96
+ note: (now_ms: number) => number | null;
97
+ }
98
+ /** Create the refusal warning's rate limit. */
99
+ export declare const create_host_refusal_warnings: () => HostRefusalWarnings;
100
+ /** Options for `create_host_gate_middleware`. */
101
+ export interface HostGateOptions {
102
+ /** The matchers `parse_allowed_origins` built — the server's allowlist. */
103
+ allowed_origins: ReadonlyArray<RegExp>;
104
+ /** Where the refusal warning goes. */
105
+ log: Logger;
106
+ /** The env var the allowlist was read from, named in the warning. Defaults to `ALLOWED_ORIGINS_VAR`. */
107
+ allowed_origins_var?: string;
108
+ /** The clock the warning's rate limit reads, in milliseconds. Defaults to `Date.now`. */
109
+ now?: () => number;
110
+ }
111
+ /**
112
+ * Middleware enforcing `allows_request_hosts`, refusing with `403`
113
+ * `{"error": "forbidden_host"}` and warning (rate-limited, module doc).
114
+ *
115
+ * @param options - the allowlist, the log, and the warning's clock
116
+ * @returns the Hono middleware
117
+ */
118
+ export declare const create_host_gate_middleware: (options: HostGateOptions) => MiddlewareHandler;
119
+ /**
120
+ * The host gate's spec without its handler — what the surface and each
121
+ * route's error map read, so a stub surface (`create_test_app_surface_spec`)
122
+ * lists the same layer.
123
+ */
124
+ export declare const host_gate_middleware_shape: {
125
+ readonly name: "host";
126
+ readonly path: "*";
127
+ readonly errors: readonly [import("./error_schemas.js").RestErrorDef<403, "forbidden_host", Record<never, never>>];
128
+ };
129
+ /**
130
+ * The host gate as a middleware spec on every path (`HOST_MIDDLEWARE_PATH`),
131
+ * declaring its `403`, so the surface and each route's error map carry it.
132
+ *
133
+ * @param options - the allowlist, the log, and the warning's clock
134
+ * @returns the spec
135
+ */
136
+ export declare const create_host_gate_middleware_spec: (options: HostGateOptions) => MiddlewareSpec;
137
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAI9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI3D,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAQpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,OAsB/C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,kBAAkB,aAAa,CAAC,MAAM,CAAC,KAAG,OAQnF,CAAC;AAKF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAChC,OAAO,aAAa,CAAC,MAAM,CAAC,EAC5B,kBAAkB,aAAa,CAAC,MAAM,CAAC,KACrC,OAKF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,MAAM,EACZ,qBAAqB,MAAM,EAC3B,WAAW,MAAM,KACf,MAQF,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACxC;AAED,+CAA+C;AAC/C,eAAO,MAAM,4BAA4B,QAAO,mBAe/C,CAAC;AAEF,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC/B,2EAA2E;IAC3E,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,wGAAwG;IACxG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yFAAyF;IACzF,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GAAI,SAAS,eAAe,KAAG,iBAgBtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;CAIa,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAAI,SAAS,eAAe,KAAG,cAG1E,CAAC"}
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Host verification — refusing requests addressed to a name the server
3
+ * doesn't answer to, which is how DNS rebinding reaches a loopback server.
4
+ *
5
+ * In a rebinding attack, a page on an attacker's domain re-resolves that
6
+ * domain to `127.0.0.1` and talks to the local server **same-origin**: its
7
+ * GETs carry no `Origin` header, so the origin allowlist (`http/origin.ts`)
8
+ * doesn't apply. The `Host` header gives it away — the browser sets it from
9
+ * the URL, so it names the attacker's domain, never `localhost`.
10
+ *
11
+ * A host is allowed when its name is loopback (`localhost`, `127.0.0.0/8`,
12
+ * `[::1]`), at any port — a rebinding page can't put one of those in `Host`
13
+ * — or when an allowed origin names it (the allowlist is where the server's
14
+ * UI is served from, so its hosts are the server's own names). Matching
15
+ * reuses the origin matchers, so `http://localhost:*` or `https://*.fuz.dev`
16
+ * admit the hosts they'd admit as origins.
17
+ *
18
+ * A request without a `Host` header passes: browsers always send one, so its
19
+ * absence means a non-browser client, which the auth stack governs. A request
20
+ * with more than one `Host` is refused (RFC 9112 §3.2) — the runtimes join a
21
+ * repeated header into one value (`a, b`), which names no host.
22
+ *
23
+ * The gate is on by default (`AppServerOptions.host_gate`). A refusal is said
24
+ * in the log as well as answered: the first in each
25
+ * `HOST_REFUSAL_WARN_INTERVAL_MS` is a warning naming the refused `Host`
26
+ * (quoted ASCII-only and truncated, since the client wrote it) and the env var
27
+ * that lists the server's names, with a count of the refusals the interval
28
+ * held back. The response says neither, so a client learns nothing about the
29
+ * allowlist.
30
+ *
31
+ * Twin of the Rust spine's `fuz_http::host`.
32
+ *
33
+ * @module
34
+ */
35
+ import { ERROR_FORBIDDEN_HOST, REST_FORBIDDEN_HOST } from './error_schemas.js';
36
+ import { parse_ipv4_bits, parse_ipv6_bits } from './ip_canonical.js';
37
+ import { quote_ascii, should_allow_origin } from './origin.js';
38
+ import { ALLOWED_ORIGINS_VAR } from './origin_wildcard.js';
39
+ /** Where the host gate mounts — every path, as the Rust stack mounts it in every group. */
40
+ export const HOST_MIDDLEWARE_PATH = '*';
41
+ /**
42
+ * The shortest gap between two refusal warnings, in milliseconds; the
43
+ * refusals between are counted and reported with the next one.
44
+ */
45
+ export const HOST_REFUSAL_WARN_INTERVAL_MS = 60_000;
46
+ /** The longest excerpt of a refused `Host` a warning quotes. */
47
+ const HOST_EXCERPT_MAX = 200;
48
+ /** A port: decimal digits, at most 65535. */
49
+ const PORT_DIGITS = /^[0-9]+$/;
50
+ /**
51
+ * True when `host` (a `Host` header value, `name[:port]`) names a loopback
52
+ * address: `localhost`, an IPv4 address in `127.0.0.0/8`, or `[::1]`.
53
+ *
54
+ * Anything after the name but a `:` and a port (decimal digits, at most 65535)
55
+ * makes it not loopback: `[::1]junk`, `localhost:abc`, and `localhost: 1` are
56
+ * refused. Twin of the Rust `is_loopback_host`.
57
+ *
58
+ * @param host - one `Host` header value
59
+ * @returns whether it names a loopback address
60
+ */
61
+ export const is_loopback_host = (host) => {
62
+ let name;
63
+ let rest;
64
+ if (host.startsWith('[')) {
65
+ const end = host.indexOf(']');
66
+ if (end === -1)
67
+ return false;
68
+ name = host.slice(0, end + 1);
69
+ rest = host.slice(end + 1);
70
+ }
71
+ else {
72
+ const colon = host.lastIndexOf(':');
73
+ name = colon === -1 ? host : host.slice(0, colon);
74
+ rest = colon === -1 ? '' : host.slice(colon);
75
+ }
76
+ if (rest !== '') {
77
+ const port = rest.slice(1);
78
+ if (!rest.startsWith(':') || !PORT_DIGITS.test(port) || Number(port) > 65535)
79
+ return false;
80
+ }
81
+ if (name.toLowerCase() === 'localhost')
82
+ return true;
83
+ const ip = name.startsWith('[') && name.endsWith(']') ? name.slice(1, -1) : name;
84
+ const v4 = parse_ipv4_bits(ip);
85
+ if (v4 !== null)
86
+ return v4 >>> 24 === 127;
87
+ return parse_ipv6_bits(ip) === 1n;
88
+ };
89
+ /**
90
+ * Check one `Host` value: loopback, or named by an allowed origin on either
91
+ * scheme. Twin of the Rust `AllowedOrigins::allows_host`.
92
+ *
93
+ * @param host - one `Host` header value
94
+ * @param allowed_patterns - the matchers `parse_allowed_origins` built
95
+ * @returns whether the server answers to it
96
+ */
97
+ export const allows_host = (host, allowed_patterns) => {
98
+ if (is_loopback_host(host))
99
+ return true;
100
+ // a `Host` can't hold these, and they'd change how the origin parses
101
+ if (host === '' || /[/?#@]/.test(host))
102
+ return false;
103
+ return (should_allow_origin(`http://${host}`, allowed_patterns) ||
104
+ should_allow_origin(`https://${host}`, allowed_patterns));
105
+ };
106
+ /** Visible ASCII, the space, and a tab — what a header value holds. */
107
+ const HEADER_TEXT = /^[\t\x20-\x7e]*$/;
108
+ /**
109
+ * Host check for a request's `Host` header values — true when there are none
110
+ * or one that passes `allows_host`. A value that isn't visible ASCII (a tab
111
+ * and the space allowed, as in a header value) is refused, and so is more than
112
+ * one `Host` (RFC 9112 §3.2). Twin of the Rust
113
+ * `AllowedOrigins::allows_request_hosts`.
114
+ *
115
+ * @param hosts - the request's `Host` values, `[]` for none
116
+ * @param allowed_patterns - the matchers `parse_allowed_origins` built
117
+ * @returns whether the request passes the host gate
118
+ */
119
+ export const allows_request_hosts = (hosts, allowed_patterns) => {
120
+ if (hosts.length === 0)
121
+ return true;
122
+ if (hosts.length > 1)
123
+ return false;
124
+ const host = hosts[0];
125
+ return HEADER_TEXT.test(host) && allows_host(host, allowed_patterns);
126
+ };
127
+ /**
128
+ * The refusal warning's text. Twin of the Rust `format_host_refusal_warning`.
129
+ *
130
+ * @param host - the refused `Host` as the request carried it
131
+ * @param allowed_origins_var - the env var the allowlist was read from
132
+ * @param held_back - the refusals held back since the last warning
133
+ * @returns one log line
134
+ */
135
+ export const format_host_refusal_warning = (host, allowed_origins_var, held_back) => {
136
+ const excerpt = host.length > HOST_EXCERPT_MAX ? host.slice(0, HOST_EXCERPT_MAX) + '...' : host;
137
+ const held = held_back === 0 ? '' : ` (${held_back} more refused since the last warning)`;
138
+ return (`host gate refused a request for Host ${quote_ascii(excerpt)}${held}: the server answers ` +
139
+ `only to loopback names and the hosts ${allowed_origins_var} names. If it should answer to ` +
140
+ `this name, add the origin it is served from to ${allowed_origins_var}`);
141
+ };
142
+ /** Create the refusal warning's rate limit. */
143
+ export const create_host_refusal_warnings = () => {
144
+ let last_warned = null;
145
+ let held_back = 0;
146
+ return {
147
+ note: (now_ms) => {
148
+ if (last_warned === null || now_ms - last_warned >= HOST_REFUSAL_WARN_INTERVAL_MS) {
149
+ last_warned = now_ms;
150
+ const count = held_back;
151
+ held_back = 0;
152
+ return count;
153
+ }
154
+ held_back++;
155
+ return null;
156
+ }
157
+ };
158
+ };
159
+ /**
160
+ * Middleware enforcing `allows_request_hosts`, refusing with `403`
161
+ * `{"error": "forbidden_host"}` and warning (rate-limited, module doc).
162
+ *
163
+ * @param options - the allowlist, the log, and the warning's clock
164
+ * @returns the Hono middleware
165
+ */
166
+ export const create_host_gate_middleware = (options) => {
167
+ const { allowed_origins, log, allowed_origins_var = ALLOWED_ORIGINS_VAR } = options;
168
+ const now = options.now ?? Date.now;
169
+ const warnings = create_host_refusal_warnings();
170
+ return async (c, next) => {
171
+ const host = c.req.header('host');
172
+ const hosts = host === undefined ? [] : [host];
173
+ if (!allows_request_hosts(hosts, allowed_origins)) {
174
+ const held_back = warnings.note(now());
175
+ if (held_back !== null) {
176
+ log.warn(format_host_refusal_warning(host ?? '', allowed_origins_var, held_back));
177
+ }
178
+ return c.json({ error: ERROR_FORBIDDEN_HOST }, 403);
179
+ }
180
+ return next();
181
+ };
182
+ };
183
+ /**
184
+ * The host gate's spec without its handler — what the surface and each
185
+ * route's error map read, so a stub surface (`create_test_app_surface_spec`)
186
+ * lists the same layer.
187
+ */
188
+ export const host_gate_middleware_shape = {
189
+ name: 'host',
190
+ path: HOST_MIDDLEWARE_PATH,
191
+ errors: [REST_FORBIDDEN_HOST]
192
+ };
193
+ /**
194
+ * The host gate as a middleware spec on every path (`HOST_MIDDLEWARE_PATH`),
195
+ * declaring its `403`, so the surface and each route's error map carry it.
196
+ *
197
+ * @param options - the allowlist, the log, and the warning's clock
198
+ * @returns the spec
199
+ */
200
+ export const create_host_gate_middleware_spec = (options) => ({
201
+ ...host_gate_middleware_shape,
202
+ handler: create_host_gate_middleware(options)
203
+ });
@@ -14,6 +14,10 @@
14
14
  * The check is one linear pass over the text after `JSON.parse` accepts it
15
15
  * (`is_serde_json_text`): a few milliseconds a MiB, whatever the text holds.
16
16
  *
17
+ * `"\u0000"` is not refused here: both parsers accept it. Postgres refuses it,
18
+ * so the input steps do, as an invalid value rather than invalid JSON
19
+ * (`scan_json_value` in `http/schema_helpers.ts`).
20
+ *
17
21
  * @module
18
22
  */
19
23
  /** The nesting depth `serde_json` refuses: a value nested this deep or deeper fails. */