@fuzdev/fuz_app 0.170.0 → 0.172.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/dist/actions/CLAUDE.md +3 -3
- package/dist/actions/action_codegen.d.ts +5 -3
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +11 -27
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +5 -6
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +3 -2
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +2 -1
- package/dist/auth/middleware.d.ts +6 -2
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +14 -2
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +5 -7
- package/dist/http/CLAUDE.md +5 -3
- package/dist/http/error_schemas.d.ts +3 -4
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +4 -5
- package/dist/http/host.d.ts +137 -0
- package/dist/http/host.d.ts.map +1 -0
- package/dist/http/host.js +203 -0
- package/dist/http/json_text.d.ts +53 -0
- package/dist/http/json_text.d.ts.map +1 -0
- package/dist/http/json_text.js +152 -0
- package/dist/http/origin.d.ts +9 -0
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +6 -2
- package/dist/http/origin_wildcard.d.ts +20 -5
- package/dist/http/origin_wildcard.d.ts.map +1 -1
- package/dist/http/origin_wildcard.js +22 -10
- package/dist/http/route_result.d.ts +2 -1
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +1 -1
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +10 -9
- package/dist/http/schema_helpers.d.ts +10 -9
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/server/app_server.d.ts +10 -0
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +14 -3
- package/dist/testing/CLAUDE.md +6 -7
- package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
- package/dist/testing/adversarial_input_cases.js +2 -4
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +7 -2
- package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +2 -1
- package/dist/testing/cross_backend/origin_conformance.d.ts +62 -1
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_conformance.js +19 -3
- package/dist/testing/cross_backend/origin_conformance.json +330 -0
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -6
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -15
- package/dist/testing/cross_backend/testing_origin_check.d.ts +16 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +12 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +2 -2
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +3 -3
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.js +8 -0
- package/dist/testing/rpc_envelope_cases.d.ts +7 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +21 -0
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +8 -18
- package/dist/testing/stubs.d.ts +11 -4
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -5
- package/package.json +1 -1
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -141,7 +141,7 @@ and options on each function's TSDoc.
|
|
|
141
141
|
- `generate_action_method_enums` — up to nine `@fuzdev/fuz_schema` `one_of` + `Infer` pairs, importing `{one_of, type Infer}` from `@fuzdev/fuz_schema/schema.ts`; a const's `def` is its method array.
|
|
142
142
|
- `generate_typed_action_event_alias` — fixed-shape `TypedActionEvent<TMethod, TPhase, TStep>` alias.
|
|
143
143
|
- `generate_action_specs_record` — `ActionSpecs` runtime const + type + `action_specs` array. The const is annotated with the type (`readonly` members), so a consumer's declaration emit names the type instead of writing every spec's schema types out, which past enough specs is TS7056. The type is an alias, not an interface: an alias has an implicit index signature, so `Object.values(ActionSpecs)` stays typed and `action_specs` checks each spec against `ActionSpecUnion` (over an interface it is `any[]`).
|
|
144
|
-
- `generate_action_inputs_outputs` — `ActionInputs`
|
|
144
|
+
- `generate_action_inputs_outputs` — the `ActionInputs`, `ActionCallInputs` and `ActionOutputs` interfaces, types only (a const's inferred type would be written out whole in a declaration file, TS7056 past enough specs; the schemas are read off `ActionSpecs`), importing `Infer` and `InferInput`; a value that is no schema throws naming the method. The two sides of a call see one input schema differently, so its types split by side: `ActionInputs` is each input's output type (`Infer<typeof …>`) — the parsed value a handler, an action event (`ActionEventDatas`) or a notification receiver reads, defaults filled and transforms applied; `ActionCallInputs` is its input type (`InferInput<typeof …>`) — what a caller passes, which the call surfaces (`FrontendActionsApi`, `BackendActionsApi`) take, so a `with_default` field is optional there and required in `ActionInputs`. `ActionOutputs` is each output's output type, what a caller receives.
|
|
145
145
|
- `generate_action_event_datas` — `ActionEventDatas` interface; per-spec variants.
|
|
146
146
|
- `generate_frontend_action_handlers` — `FrontendActionHandlers` interface (Tier 2 only).
|
|
147
147
|
- `generate_backend_actions_api` — `BackendActionsApi` interface + `broadcast_action_specs` array.
|
|
@@ -205,7 +205,7 @@ spines, and an authorized one is `invalid_params`.
|
|
|
205
205
|
|
|
206
206
|
Shim responsibilities (per-request):
|
|
207
207
|
|
|
208
|
-
1. Parse envelope (POST body / GET query string); parse errors → `parse_error` 400
|
|
208
|
+
1. Parse envelope (POST body / GET query string, each through `parse_json_text`, `http/json_text.ts`, so JSON the Rust spine refuses is refused here too); parse errors → `parse_error` 400, a `GET` `params` that is no JSON `invalid_params`. GET reads `method` / `id` / `params` via Hono's `c.req.query()` — first occurrence wins on a duplicated key, unknown keys are ignored, and an empty value counts as missing. This is the cross-impl contract (the Rust GET dispatch mirrors it via `fuz_http`'s `query_first`, including the id numeric-vs-string normalization), pinned by the `query_shape` cross suite.
|
|
209
209
|
2. Lookup method in the `compile_action_registry`-built map; unknown → `method_not_found`.
|
|
210
210
|
3. GET read restriction — GET rejected for `side_effects: true` actions. Every response the GET handler writes, its refusals included, carries `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`; a pre-handler middleware refusal, like the origin 403, does not): a read answers one caller at one moment.
|
|
211
211
|
4. Build `PerformActionInput` from `get_resolved_auth(c)` + `get_client_ip` + `c.req.raw.signal`. Test-preset escape hatch reads `has_test_context_preset(c)` + `REQUEST_CONTEXT_KEY`.
|
|
@@ -868,7 +868,7 @@ the duplicate-id and overflow wire strings, and the `on_socket_open` /
|
|
|
868
868
|
Per-message dispatch delegates to `perform_action` — the shared core that
|
|
869
869
|
HTTP RPC also calls. The socket session owns only WS-specific concerns:
|
|
870
870
|
|
|
871
|
-
- **Wire envelope parsing** —
|
|
871
|
+
- **Wire envelope parsing** — `parse_json_text` (`http/json_text.ts`: what the Rust spine's `serde_json` refuses is a `parse_error` here too) → batch rejection → `classify_jsonrpc_message` (`http/jsonrpc_helpers.ts`, the twin of the Rust `fuz_http::classify`, the same classifier the HTTP POST path runs) → per-arm handling: an `invalid` answers its error on its id; a `response` routes to the socket's pending peer request; a `notification` routes `cancel` and is otherwise dropped; a `request` goes on to the duplicate-id and in-flight checks and dispatch. The classifier runs the twin's order — version, then the `method` axis, then `id`, then the `JsonrpcRequest` envelope — so `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` answer `invalid_request` rather than being dropped as notifications; a response is the twin's shape exactly (no string `method`, a string/number `id`, exactly one of `result` / `error`), so a hybrid like `{method, id, result}` stays a dispatchable request; and `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. Notifications stay unvalidated (they carry no id to echo). A non-object frame answers `id: null`. POST answers a notification or a response `invalid_request` on `id: null`, as the Rust spine does.
|
|
872
872
|
- **Cancel-notification interception** — `{request_id → AbortController}` map; aborts the matching pending controller before the cancel bubbles past the dispatcher
|
|
873
873
|
- **Duplicate live ids refused** — a request whose id names a request still running on the socket is answered `invalid_request` with `data.reason` `ERROR_DUPLICATE_REQUEST_ID` and not dispatched; the running request keeps its controller, its cancel entry, and its reply id. An id is free again once its request is answered. Same refusal on the Rust spine
|
|
874
874
|
- **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-ws` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`
|
|
@@ -198,9 +198,11 @@ export declare const generate_action_specs_record: (specs: ReadonlyArray<ActionS
|
|
|
198
198
|
include_protocol_actions?: boolean;
|
|
199
199
|
}) => string;
|
|
200
200
|
/**
|
|
201
|
-
* Emit `ActionInputs`
|
|
202
|
-
* interfaces,
|
|
203
|
-
*
|
|
201
|
+
* Emit the `ActionInputs`, `ActionCallInputs` and `ActionOutputs`
|
|
202
|
+
* interfaces, each member a type over `specs.{method}_action_spec.input` /
|
|
203
|
+
* `.output`. Types only: the schemas are read off the specs themselves
|
|
204
|
+
* (`ActionSpecs`), and a type reference stays a reference in a declaration
|
|
205
|
+
* file, where an unannotated const's inferred type is written out whole.
|
|
204
206
|
*
|
|
205
207
|
* The two sides of a call see different types for one input schema, so the
|
|
206
208
|
* interfaces split by side:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG1E;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,+CAAgD,CAAC;AAErF,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAI5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI,oBACrC,CAAC;AAEjC,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAa;IAE1D;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQrC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAOrD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IA6BtD;;;;OAIG;IACH,KAAK,IAAI,MAAM;IAIf,WAAW,IAAI,OAAO;IAItB,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,0FAA0F;IAC1F,OAAO,IAA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AAC;IAChD,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CAiC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B,KAAG,MAYH,CAAC"}
|
|
@@ -650,9 +650,11 @@ ${type_lines}
|
|
|
650
650
|
export const action_specs: Array<ActionSpecUnion> = Object.values(ActionSpecs);`;
|
|
651
651
|
};
|
|
652
652
|
/**
|
|
653
|
-
* Emit `ActionInputs`
|
|
654
|
-
* interfaces,
|
|
655
|
-
*
|
|
653
|
+
* Emit the `ActionInputs`, `ActionCallInputs` and `ActionOutputs`
|
|
654
|
+
* interfaces, each member a type over `specs.{method}_action_spec.input` /
|
|
655
|
+
* `.output`. Types only: the schemas are read off the specs themselves
|
|
656
|
+
* (`ActionSpecs`), and a type reference stays a reference in a declaration
|
|
657
|
+
* file, where an unannotated const's inferred type is written out whole.
|
|
656
658
|
*
|
|
657
659
|
* The two sides of a call see different types for one input schema, so the
|
|
658
660
|
* interfaces split by side:
|
|
@@ -683,11 +685,9 @@ export const generate_action_inputs_outputs = (specs, imports, options) => {
|
|
|
683
685
|
// Empty spec list — emit minimal valid output and skip the `Infer` /
|
|
684
686
|
// `* as specs` imports that would have nothing to reference.
|
|
685
687
|
return `/**
|
|
686
|
-
* Action
|
|
687
|
-
*
|
|
688
|
-
* e.g. JSON-RPC request/notification params and local call arguments.
|
|
688
|
+
* Action inputs indexed by method name, as parsed: each input schema's output
|
|
689
|
+
* type, e.g. JSON-RPC request/notification params and local call arguments.
|
|
689
690
|
*/
|
|
690
|
-
export const ActionInputs = {} as const;
|
|
691
691
|
export interface ActionInputs {}
|
|
692
692
|
|
|
693
693
|
/**
|
|
@@ -697,11 +697,9 @@ export interface ActionInputs {}
|
|
|
697
697
|
export interface ActionCallInputs {}
|
|
698
698
|
|
|
699
699
|
/**
|
|
700
|
-
* Action
|
|
701
|
-
* These represent the output data for each action,
|
|
700
|
+
* Action outputs indexed by method name: each output schema's output type,
|
|
702
701
|
* e.g. JSON-RPC response results and local call return values.
|
|
703
702
|
*/
|
|
704
|
-
export const ActionOutputs = {} as const;
|
|
705
703
|
export interface ActionOutputs {}`;
|
|
706
704
|
}
|
|
707
705
|
for (const s of filtered) {
|
|
@@ -710,29 +708,19 @@ export interface ActionOutputs {}`;
|
|
|
710
708
|
}
|
|
711
709
|
imports.add_types('@fuzdev/fuz_schema/schema.ts', 'Infer', 'InferInput');
|
|
712
710
|
const qualify = resolve_spec_qualifier(imports, options);
|
|
713
|
-
const inputs_value = filtered
|
|
714
|
-
.map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.input,`)
|
|
715
|
-
.join('\n');
|
|
716
711
|
const inputs_type = filtered
|
|
717
712
|
.map((s) => `\t${to_action_property_key(s.method)}: Infer<typeof ${qualify(s)}.input>;`)
|
|
718
713
|
.join('\n');
|
|
719
714
|
const call_inputs_type = filtered
|
|
720
715
|
.map((s) => `\t${to_action_property_key(s.method)}: InferInput<typeof ${qualify(s)}.input>;`)
|
|
721
716
|
.join('\n');
|
|
722
|
-
const outputs_value = filtered
|
|
723
|
-
.map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)}.output,`)
|
|
724
|
-
.join('\n');
|
|
725
717
|
const outputs_type = filtered
|
|
726
718
|
.map((s) => `\t${to_action_property_key(s.method)}: Infer<typeof ${qualify(s)}.output>;`)
|
|
727
719
|
.join('\n');
|
|
728
720
|
return `/**
|
|
729
|
-
* Action
|
|
730
|
-
*
|
|
731
|
-
* e.g. JSON-RPC request/notification params and local call arguments.
|
|
721
|
+
* Action inputs indexed by method name, as parsed: each input schema's output
|
|
722
|
+
* type, e.g. JSON-RPC request/notification params and local call arguments.
|
|
732
723
|
*/
|
|
733
|
-
export const ActionInputs = {
|
|
734
|
-
${inputs_value}
|
|
735
|
-
} as const;
|
|
736
724
|
export interface ActionInputs {
|
|
737
725
|
${inputs_type}
|
|
738
726
|
}
|
|
@@ -746,13 +734,9 @@ ${call_inputs_type}
|
|
|
746
734
|
}
|
|
747
735
|
|
|
748
736
|
/**
|
|
749
|
-
* Action
|
|
750
|
-
* These represent the output data for each action,
|
|
737
|
+
* Action outputs indexed by method name: each output schema's output type,
|
|
751
738
|
* e.g. JSON-RPC response results and local call return values.
|
|
752
739
|
*/
|
|
753
|
-
export const ActionOutputs = {
|
|
754
|
-
${outputs_value}
|
|
755
|
-
} as const;
|
|
756
740
|
export interface ActionOutputs {
|
|
757
741
|
${outputs_type}
|
|
758
742
|
}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;;OAOG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,wBAAwB,KAAG,KAAK,CAAC,SAAS,CAmOtF,CAAC"}
|
|
@@ -25,6 +25,7 @@ import { compile_action_registry } from './compile_action_registry.js';
|
|
|
25
25
|
import { jsonrpc_error_messages, jsonrpc_error_code_to_http_status, JSONRPC_ERROR_CODES } from '../http/jsonrpc_errors.js';
|
|
26
26
|
import { classify_jsonrpc_message, create_jsonrpc_error_response } from '../http/jsonrpc_helpers.js';
|
|
27
27
|
import { perform_action, serialize_action_result } from './perform_action.js';
|
|
28
|
+
import { parse_json_text, read_json_body } from '../http/json_text.js';
|
|
28
29
|
/**
|
|
29
30
|
* The `Cache-Control` every response of the RPC endpoint's `GET` route carries
|
|
30
31
|
* — a read is per caller and per moment, so nothing may store it.
|
|
@@ -153,14 +154,12 @@ export const create_rpc_endpoint = (options) => {
|
|
|
153
154
|
// POST handler — parse JSON-RPC envelope from body
|
|
154
155
|
const post_handler = async (c, route) => {
|
|
155
156
|
// step 1: parse envelope
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
body = await c.req.json();
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
157
|
+
const read = await read_json_body(c.req);
|
|
158
|
+
if (!read.ok) {
|
|
161
159
|
const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.parse_error());
|
|
162
160
|
return envelope_response(c, error, 400);
|
|
163
161
|
}
|
|
162
|
+
const body = read.value;
|
|
164
163
|
// the classifier the WS path runs; HTTP issues no server-initiated
|
|
165
164
|
// requests and has no notification semantics, so a response or a
|
|
166
165
|
// notification answers `invalid_request` on `id: null`, as on the Rust spine
|
|
@@ -205,7 +204,7 @@ export const create_rpc_endpoint = (options) => {
|
|
|
205
204
|
let params;
|
|
206
205
|
if (params_raw !== undefined) {
|
|
207
206
|
try {
|
|
208
|
-
params =
|
|
207
|
+
params = parse_json_text(params_raw);
|
|
209
208
|
}
|
|
210
209
|
catch {
|
|
211
210
|
const error = create_jsonrpc_error_response(id, jsonrpc_error_messages.invalid_params('params query parameter is not valid JSON'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer_ping.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/peer_ping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGlE,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAIvC,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,iDAAiD;AACjD,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,iHAAiH;AACjH,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAC5D,sEAAsE;AACtE,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AACxE,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AACxE,qFAAqF;AACrF,eAAO,MAAM,+BAA+B,6BAA6B,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;
|
|
1
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;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,OAAO,eAAe,EACtB,KAAK,aAAa,KAChB,OAAO,CAAC,YAAY,CAsCtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,OAAO,KAAG,YAGrD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAG9B,CAAC"}
|
|
@@ -74,8 +74,9 @@ export const PingActionInput = with_default(object({
|
|
|
74
74
|
// optional, so an empty invocation is valid (server-issued nonce, default
|
|
75
75
|
// timeout). The server reads absent `params` as `{}` before the schema; the
|
|
76
76
|
// client's pre-send parse of `app.api['peer/ping']()` reaches the default.
|
|
77
|
-
//
|
|
78
|
-
|
|
77
|
+
// `with_default` hands out one shared value, so it is frozen: a write to
|
|
78
|
+
// it throws rather than leaking into every later call
|
|
79
|
+
Object.freeze({}));
|
|
79
80
|
/** Params of the server→client `peer/ping` request frame. Twin of the Rust `PingRequest`. */
|
|
80
81
|
export const PingRequestParams = object({
|
|
81
82
|
nonce: pipe(number, safe_integer)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_socket_session.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/ws_socket_session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ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cancel_action_spec, CancelNotificationParams } from './cancel.js';
|
|
|
118
118
|
import { WS_CLOSE_CONNECTION_UNREGISTERED_REASON, WS_CLOSE_GOING_AWAY, WS_CLOSE_INTERNAL_ERROR, WS_CLOSE_INTERNAL_ERROR_REASON, WS_CLOSE_MESSAGE_TOO_BIG, WS_CLOSE_MESSAGE_TOO_BIG_REASON, WS_CLOSE_PERMISSION_REVOKED, WS_CLOSE_PERMISSION_REVOKED_REASON, WS_CLOSE_POLICY_VIOLATION, WS_CLOSE_PRE_ADMISSION_OVERFLOW_REASON, WS_CLOSE_CREDENTIAL_EXPIRED_REASON, WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT, WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT_REASON, WS_CLOSE_SESSION_REVOKED, WS_CLOSE_SOCKET_OPEN_FAILED_REASON, WS_CLOSE_SESSION_REVOKED_REASON, utf8_length, utf8_length_over } from './transports.js';
|
|
119
119
|
import { audit_unmatched_peer_response } from './peer_request.js';
|
|
120
120
|
import { perform_action, serialize_action_result } from './perform_action.js';
|
|
121
|
+
import { parse_json_text } from '../http/json_text.js';
|
|
121
122
|
/**
|
|
122
123
|
* Max inbound frames one socket may have queued while it is still opening —
|
|
123
124
|
* between the handshake and the end of the credential re-check plus
|
|
@@ -501,7 +502,7 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
|
|
|
501
502
|
const send_error = (id, error) => send_error_response(registry, connection_id, id, error);
|
|
502
503
|
let json;
|
|
503
504
|
try {
|
|
504
|
-
json =
|
|
505
|
+
json = parse_json_text(String(data));
|
|
505
506
|
}
|
|
506
507
|
catch (error) {
|
|
507
508
|
log.error('JSON parse error:', error);
|
|
@@ -75,7 +75,11 @@ export declare const assert_credential_routes_in_auth_scope: (route_specs: Reado
|
|
|
75
75
|
/**
|
|
76
76
|
* Throw unless every origin carve-out names a path and a reason, and stays
|
|
77
77
|
* off the auth middleware's scope: a path that starts with `/` (a Hono pattern
|
|
78
|
-
* like `/hooks/*` or `/health`)
|
|
78
|
+
* like `/hooks/*` or `/health`) and is no route template — a carve-out matches
|
|
79
|
+
* a request path exactly or by a trailing `/*` prefix (`middleware_applies`),
|
|
80
|
+
* so a `:param`, a `{pattern}`, or an inner `*` would match only its own
|
|
81
|
+
* literal text at runtime while the surface reads it as the template — a
|
|
82
|
+
* non-blank reason — a carve-out is an
|
|
79
83
|
* argument someone wrote down, never an empty placeholder — and a pattern that
|
|
80
84
|
* matches nothing under `auth_path` (`middleware_paths_overlap`).
|
|
81
85
|
*
|
|
@@ -93,7 +97,7 @@ export declare const assert_credential_routes_in_auth_scope: (route_specs: Reado
|
|
|
93
97
|
*
|
|
94
98
|
* @param carve_outs - the carve-outs to check
|
|
95
99
|
* @param auth_path - the auth middleware's path pattern (default `AUTH_MIDDLEWARE_PATH`)
|
|
96
|
-
* @throws Error naming the first carve-out with no path, no reason, or a pattern overlapping `auth_path`
|
|
100
|
+
* @throws Error naming the first carve-out with no path, a route template, no reason, or a pattern overlapping `auth_path`
|
|
97
101
|
*/
|
|
98
102
|
export declare const assert_origin_carve_outs_valid: (carve_outs: ReadonlyArray<MiddlewareCarveOut>, auth_path?: string) => void;
|
|
99
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;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AkCF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GACpC,YAAY,aAAa,CAAC,kBAAkB,CAAC,KAC3C,aAAa,CAAC,kBAAkB,CACkD,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,+BAA+B,GAC3C,aAAa,aAAa,CAAC,cAAc,CAAC,EAC1C,kBAAkB,aAAa,CAAC,cAAc,CAAC,KAC7C,IA+BF,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACtD,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAqF/B,CAAC"}
|
package/dist/auth/middleware.js
CHANGED
|
@@ -92,7 +92,11 @@ export const assert_credential_routes_in_auth_scope = (route_specs) => {
|
|
|
92
92
|
/**
|
|
93
93
|
* Throw unless every origin carve-out names a path and a reason, and stays
|
|
94
94
|
* off the auth middleware's scope: a path that starts with `/` (a Hono pattern
|
|
95
|
-
* like `/hooks/*` or `/health`)
|
|
95
|
+
* like `/hooks/*` or `/health`) and is no route template — a carve-out matches
|
|
96
|
+
* a request path exactly or by a trailing `/*` prefix (`middleware_applies`),
|
|
97
|
+
* so a `:param`, a `{pattern}`, or an inner `*` would match only its own
|
|
98
|
+
* literal text at runtime while the surface reads it as the template — a
|
|
99
|
+
* non-blank reason — a carve-out is an
|
|
96
100
|
* argument someone wrote down, never an empty placeholder — and a pattern that
|
|
97
101
|
* matches nothing under `auth_path` (`middleware_paths_overlap`).
|
|
98
102
|
*
|
|
@@ -110,7 +114,7 @@ export const assert_credential_routes_in_auth_scope = (route_specs) => {
|
|
|
110
114
|
*
|
|
111
115
|
* @param carve_outs - the carve-outs to check
|
|
112
116
|
* @param auth_path - the auth middleware's path pattern (default `AUTH_MIDDLEWARE_PATH`)
|
|
113
|
-
* @throws Error naming the first carve-out with no path, no reason, or a pattern overlapping `auth_path`
|
|
117
|
+
* @throws Error naming the first carve-out with no path, a route template, no reason, or a pattern overlapping `auth_path`
|
|
114
118
|
*/
|
|
115
119
|
export const assert_origin_carve_outs_valid = (carve_outs, auth_path = AUTH_MIDDLEWARE_PATH) => {
|
|
116
120
|
for (const carve_out of carve_outs) {
|
|
@@ -118,6 +122,14 @@ export const assert_origin_carve_outs_valid = (carve_outs, auth_path = AUTH_MIDD
|
|
|
118
122
|
throw new Error(`origin carve-out path ${JSON.stringify(carve_out.path)} must start with / ` +
|
|
119
123
|
'(a Hono pattern like /hooks/* or /health)');
|
|
120
124
|
}
|
|
125
|
+
const wildcard_at = carve_out.path.indexOf('*');
|
|
126
|
+
if (/[:{]/.test(carve_out.path) ||
|
|
127
|
+
(wildcard_at !== -1 &&
|
|
128
|
+
!(wildcard_at === carve_out.path.length - 1 && carve_out.path.endsWith('/*')))) {
|
|
129
|
+
throw new Error(`origin carve-out ${carve_out.path} is a route template — a carve-out matches a ` +
|
|
130
|
+
'request path exactly or by a trailing /* prefix, so a :param, {pattern} or inner * ' +
|
|
131
|
+
'would match only its own literal text; carve out the literal path or its /* prefix');
|
|
132
|
+
}
|
|
121
133
|
if (carve_out.reason.trim() === '') {
|
|
122
134
|
throw new Error(`origin carve-out ${carve_out.path} needs a reason — say why the paths are safe ` +
|
|
123
135
|
'without the origin check');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_context.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAerD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAIN,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"request_context.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAerD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAIN,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,MAAM,0BAA0B,CAAC;AAGlC;;;;;;;;;;;;;G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;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,GACnC,GAAG,OAAO,EACV,MAAM,SAAS,EACf,MAAM,SAAS,EACf,QAAQ,MAAM,GAAG,SAAS,KACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAYzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,SAAS,KACb,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAO5D,CAAC"}
|
|
@@ -47,6 +47,7 @@ import { is_route_scope_capability, token_scope_admits_non_rpc, token_scope_deni
|
|
|
47
47
|
import { is_public_auth, needs_actor, parse_acting } from '../http/auth_shape.js';
|
|
48
48
|
import { is_null_schema } from '../http/schema_helpers.js';
|
|
49
49
|
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT, ERROR_ACCOUNT_VANISHED } from '../http/error_schemas.js';
|
|
50
|
+
import { read_json_body } from '../http/json_text.js';
|
|
50
51
|
/** Hono context variable name for the request context. */
|
|
51
52
|
export const REQUEST_CONTEXT_KEY = 'request_context';
|
|
52
53
|
/**
|
|
@@ -675,14 +676,11 @@ const read_route_acting = async (c, spec) => {
|
|
|
675
676
|
return validated_query.acting;
|
|
676
677
|
if (spec.method === 'GET' || is_null_schema(spec.input))
|
|
677
678
|
return undefined;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
catch {
|
|
683
|
-
// Malformed body — input validation answers with the 400.
|
|
679
|
+
const read = await read_json_body(c.req);
|
|
680
|
+
// Malformed body — input validation answers with the 400.
|
|
681
|
+
if (!read.ok)
|
|
684
682
|
return undefined;
|
|
685
|
-
|
|
683
|
+
const body = read.value;
|
|
686
684
|
if (typeof body !== 'object' || body === null)
|
|
687
685
|
return undefined;
|
|
688
686
|
return parse_acting(body.acting);
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -22,6 +22,7 @@ effects, see ../../../docs/architecture.md.
|
|
|
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
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`.
|
|
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.
|
|
25
26
|
- `http/middleware_spec.ts` — `MiddlewareSpec` interface.
|
|
26
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).
|
|
27
28
|
- `http/surface.ts` — `AppSurface`, `AppSurfaceSpec`, `generate_app_surface`, diagnostics.
|
|
@@ -30,6 +31,7 @@ effects, see ../../../docs/architecture.md.
|
|
|
30
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.
|
|
31
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).
|
|
32
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).
|
|
33
35
|
- `http/jsonrpc.ts` — JSON-RPC 2.0 envelope schemas (MCP superset, fuz_schema), `JsonrpcErrorCode`.
|
|
34
36
|
- `http/jsonrpc_errors.ts` — `ThrownJsonrpcError`, `jsonrpc_errors` throwers, HTTP-status mappings.
|
|
35
37
|
- `http/jsonrpc_helpers.ts` — message builders, type guards, input/result normalizers, and `classify_jsonrpc_message`, the one envelope classifier both transports run.
|
|
@@ -162,7 +164,7 @@ wrapper). See `auth/signup_routes.ts`.
|
|
|
162
164
|
3. **Pre-authorization auth guards** — every gate that reads only what the auth middleware set, in coarse-to-fine order: `require_auth` (401 `ERROR_AUTHENTICATION_REQUIRED`) when `auth.account === 'required'` or `auth.actor === 'required'`; `require_credential_types(types)` (403 `ERROR_CREDENTIAL_TYPE_REQUIRED` with `required_credential_types: ReadonlyArray<string>`) when `auth.credential_types?.length`; `require_token_scope(capability)` (403 `ERROR_TOKEN_SCOPE_REQUIRED` with `required_scope`, the token-scope refusal) when `auth.required_scope` names a capability. All fire before any body parsing — so a caller they refuse never sees route-shape information from input parse failures — and before actor resolution, so a wrong channel costs no DB work and never learns account state (e.g. that the account is multi-actor). The `AuthGuardResolver` (e.g. `fuz_auth_guard_resolver` from `auth/auth_guard_resolver.ts`) returns this set as `pre_authorization: Array<MiddlewareHandler>`.
|
|
163
165
|
4. **Authorization phase** — when `spec.auth.actor !== 'none'`, resolves the acting actor against the resolved credential's account (`get_resolved_auth`, set by the auth middleware) plus the `acting` selector (`validated_query.acting` on GETs; read off the raw body on mutations, since body validation now runs after the gates), builds `RequestContext` via `build_request_context`, and sets `REQUEST_CONTEXT_KEY`. When `auth.account !== 'none' && auth.actor === 'none'`, an account-only context is built. Resolution failures return 400 `ERROR_ACTOR_REQUIRED` (with `available[]`) or `ERROR_ACTOR_NOT_ON_ACCOUNT` (or 500 `ERROR_NO_ACTORS_ON_ACCOUNT` on signup-invariant violation, 500 `ERROR_ACCOUNT_VANISHED` on torn account/actor reads after a successful resolve). Public routes (`account: 'none' && actor: 'none'`) skip this phase entirely.
|
|
164
166
|
5. **Post-authorization auth guards** — `require_role(roles)` (403 `ERROR_INSUFFICIENT_PERMISSIONS` with `required_roles: ReadonlyArray<string>`) when `auth.roles?.length`. The only gate in this phase, because it is the only one that reads `REQUEST_CONTEXT_KEY` (populated by step 4) rather than the auth middleware's own context vars. Multi-role specs admit any-of via `has_any_scoped_role(ctx, roles, null)`.
|
|
165
|
-
6. **Input validation** — JSON body parsed + validated; mismatch returns 400 `ERROR_INVALID_JSON_BODY` (not JSON) or `ERROR_INVALID_REQUEST_BODY` (schema failure with `issues`). Every schema refusal's `issues` are `WireIssue`s (`to_wire_issues`, `schema_issues.ts`), sent under DEV only (`dev_only`). Skipped on GET and on a null input (`is_null_schema`: `literal(null)`). The validated input lands on `c.var.validated_input`.
|
|
167
|
+
6. **Input validation** — JSON body parsed (`read_json_body`) + validated; mismatch returns 400 `ERROR_INVALID_JSON_BODY` (not JSON, or JSON the Rust spine refuses — `parse_json_text`) or `ERROR_INVALID_REQUEST_BODY` (schema failure with `issues`). Every schema refusal's `issues` are `WireIssue`s (`to_wire_issues`, `schema_issues.ts`), sent under DEV only (`dev_only`). Skipped on GET and on a null input (`is_null_schema`: `literal(null)`). The validated input lands on `c.var.validated_input`.
|
|
166
168
|
7. **Handler** — wrapped in transaction when `use_transaction` (see above), receives `RouteContext`; its result becomes the response (`to_route_response`)
|
|
167
169
|
8. **Error catch** — catches a thrown JSON-RPC error (`ThrownJsonrpcError`, recognized by brand through `to_thrown_jsonrpc_error`, so one from a second fuz_app copy maps too; a foreign error class carrying a JSON-RPC `code` falls to the generic path) → maps to HTTP status + the flat REST error body (`{error: <reason>, message?, ...rest_data}`); catches generic `Error` → 500 `{error: 'internal_error', message?}` (message only in DEV). The reason string comes from `err.data.reason` when set (consumer-supplied canonical reason override) or from `jsonrpc_error_code_to_name(err.code)` (e.g. `-32003 → 'not_found'`). The flat shape matches what middleware and direct handlers emit — REST callers see one envelope across every emit site, while the JSON-RPC dispatcher keeps its own `{jsonrpc, id, error: {code, message, data}}` envelope on the RPC mount.
|
|
168
170
|
9. **DEV-only output validation** — a 2xx JSON body against `spec.output` (see below); error responses are the outer DEV error check's
|
|
@@ -213,7 +215,7 @@ action-handler surfaces (REST, RPC, WS); see ../../../docs/architecture.md
|
|
|
213
215
|
|
|
214
216
|
`http/error_schemas.ts` is the **declarative** error surface:
|
|
215
217
|
|
|
216
|
-
- `ERROR_*` `snake_case` string constants (`ERROR_FORBIDDEN_HOST` / `REST_FORBIDDEN_HOST` the
|
|
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
|
|
217
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`)
|
|
218
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
|
|
219
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
|
|
@@ -327,7 +329,7 @@ Key helpers:
|
|
|
327
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
|
|
328
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)
|
|
329
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
|
|
330
|
-
- `SchemaFieldInfo` — one field of an object schema (`name`, `base_type`, `required`, `has_default`, `nullable`), what the testing generators' `to_object_schema_view` produces
|
|
332
|
+
- `SchemaFieldInfo` — one field of an object schema (`name`, `base_type` — a `SchemaFieldBaseType`, the innermost fuz_schema kind —, `required`, `has_default`, `nullable`), what the testing generators' `to_object_schema_view` produces
|
|
331
333
|
- `middleware_applies(mw_path, route_path)` — Hono pattern matching: `'*'`, exact, `'/api/*'` prefix (handles `prefix.slice(0, -1)` so `/api/*` also matches the bare `/api`)
|
|
332
334
|
- `middleware_carves_out(spec, route_path)` — one of the layer's `carve_outs` applies to the route; the carve-out half of `middleware_spec_applies`, which `assert_full_middleware_stack` reads to relax a carved-out route's expected stack
|
|
333
335
|
- `middleware_spec_applies(spec, route_path)` — the layer runs on the route: its `path` applies and none of its `carve_outs` does; what the route error map takes middleware definitions by
|
|
@@ -76,10 +76,9 @@ export declare const ERROR_INVALID_CONTENT_LENGTH: "invalid_content_length";
|
|
|
76
76
|
/** Request origin not in allowlist. */
|
|
77
77
|
export declare const ERROR_FORBIDDEN_ORIGIN: "forbidden_origin";
|
|
78
78
|
/**
|
|
79
|
-
* The request's `Host` names a host the server doesn't answer to — the
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* one declares it.
|
|
79
|
+
* The request's `Host` names a host the server doesn't answer to — the
|
|
80
|
+
* DNS-rebinding gate (`http/host.ts`, the Rust spine's `host_gate`, its
|
|
81
|
+
* `FORBIDDEN_HOST_REASON`).
|
|
83
82
|
*/
|
|
84
83
|
export declare const ERROR_FORBIDDEN_HOST: "forbidden_host";
|
|
85
84
|
/**
|
|
@@ -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,EAA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,10 +79,9 @@ export const ERROR_INVALID_CONTENT_LENGTH = 'invalid_content_length';
|
|
|
79
79
|
/** Request origin not in allowlist. */
|
|
80
80
|
export const ERROR_FORBIDDEN_ORIGIN = 'forbidden_origin';
|
|
81
81
|
/**
|
|
82
|
-
* The request's `Host` names a host the server doesn't answer to — the
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* one declares it.
|
|
82
|
+
* The request's `Host` names a host the server doesn't answer to — the
|
|
83
|
+
* DNS-rebinding gate (`http/host.ts`, the Rust spine's `host_gate`, its
|
|
84
|
+
* `FORBIDDEN_HOST_REASON`).
|
|
86
85
|
*/
|
|
87
86
|
export const ERROR_FORBIDDEN_HOST = 'forbidden_host';
|
|
88
87
|
/**
|
|
@@ -363,7 +362,7 @@ export const REST_TOKEN_SCOPE_REQUIRED = rest_error(403, ERROR_TOKEN_SCOPE_REQUI
|
|
|
363
362
|
});
|
|
364
363
|
// 403: the origin check, bootstrap, signup
|
|
365
364
|
export const REST_FORBIDDEN_ORIGIN = rest_error(403, ERROR_FORBIDDEN_ORIGIN);
|
|
366
|
-
// 403: the
|
|
365
|
+
// 403: the host gate
|
|
367
366
|
export const REST_FORBIDDEN_HOST = rest_error(403, ERROR_FORBIDDEN_HOST);
|
|
368
367
|
export const REST_ALREADY_BOOTSTRAPPED = rest_error(403, ERROR_ALREADY_BOOTSTRAPPED);
|
|
369
368
|
export const REST_NO_MATCHING_INVITE = rest_error(403, ERROR_NO_MATCHING_INVITE);
|