@fuzdev/fuz_app 0.179.0 → 0.181.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 +14 -14
- package/dist/actions/action_rpc.d.ts +14 -5
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +53 -46
- package/dist/actions/action_types.d.ts +15 -12
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/perform_action.d.ts +4 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +6 -6
- package/dist/actions/register_action_ws.d.ts +6 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +14 -3
- package/dist/actions/ws_socket_session.js +1 -1
- package/dist/auth/CLAUDE.md +36 -30
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +18 -1
- package/dist/auth/account_queries.d.ts +69 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +82 -0
- package/dist/auth/account_route_schema.d.ts +26 -16
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +10 -24
- package/dist/auth/account_routes.d.ts +4 -6
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +86 -66
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +63 -14
- package/dist/auth/api_token_queries.d.ts +16 -7
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +18 -18
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +10 -12
- package/dist/auth/audit_log_schema.js +4 -4
- package/dist/auth/bearer_auth.d.ts +4 -3
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +35 -31
- package/dist/auth/bootstrap_account.d.ts +65 -37
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +115 -66
- package/dist/auth/bootstrap_route_schema.d.ts +6 -2
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +7 -2
- package/dist/auth/bootstrap_routes.d.ts +50 -33
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +109 -87
- package/dist/auth/bootstrap_token_store.d.ts +60 -0
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
- package/dist/auth/bootstrap_token_store.js +39 -0
- package/dist/auth/credential_headers.d.ts +71 -0
- package/dist/auth/credential_headers.d.ts.map +1 -0
- package/dist/auth/credential_headers.js +100 -0
- package/dist/auth/daemon_token.d.ts +13 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +14 -2
- package/dist/auth/daemon_token_middleware.d.ts +10 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +27 -29
- package/dist/auth/deps.d.ts +0 -11
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +18 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +24 -0
- package/dist/auth/request_context.d.ts +26 -5
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +17 -10
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +3 -2
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +37 -14
- package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +9 -2
- package/dist/auth/role_grant_offer_queries.d.ts +56 -3
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +93 -8
- package/dist/auth/role_grant_queries.d.ts +7 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +8 -0
- package/dist/auth/session_cookie.d.ts +105 -25
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +124 -15
- package/dist/auth/session_middleware.d.ts +83 -54
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +92 -66
- package/dist/auth/session_queries.d.ts +64 -4
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +53 -4
- package/dist/auth/signup_route_schema.d.ts +5 -5
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +4 -4
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +17 -14
- package/dist/auth/token_scope.d.ts +5 -7
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +5 -8
- package/dist/dev/setup.d.ts +6 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -34
- package/dist/hono_context.d.ts +21 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +17 -0
- package/dist/http/CLAUDE.md +150 -43
- package/dist/http/auth_shape.d.ts +3 -3
- package/dist/http/common_routes.js +1 -1
- package/dist/http/db_routes.d.ts +4 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +14 -14
- package/dist/http/dev_route_error_check.d.ts +6 -3
- package/dist/http/dev_route_error_check.d.ts.map +1 -1
- package/dist/http/dev_route_error_check.js +6 -3
- package/dist/http/dev_set_cookie_check.d.ts +53 -0
- package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
- package/dist/http/dev_set_cookie_check.js +80 -0
- package/dist/http/error_schemas.d.ts +36 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +39 -2
- package/dist/http/header_lines.d.ts +42 -0
- package/dist/http/header_lines.d.ts.map +1 -0
- package/dist/http/header_lines.js +80 -0
- package/dist/http/host.d.ts +12 -9
- package/dist/http/host.d.ts.map +1 -1
- package/dist/http/host.js +25 -20
- package/dist/http/origin.d.ts +7 -22
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +11 -25
- package/dist/http/proxy.d.ts +1 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/request_headers.d.ts +95 -0
- package/dist/http/request_headers.d.ts.map +1 -0
- package/dist/http/request_headers.js +110 -0
- package/dist/http/request_target.d.ts +134 -0
- package/dist/http/request_target.d.ts.map +1 -0
- package/dist/http/request_target.js +193 -0
- package/dist/http/route_error_check.d.ts +4 -11
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +4 -21
- package/dist/http/route_result.d.ts +127 -23
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_result.js +97 -19
- package/dist/http/route_spec.d.ts +298 -82
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +548 -71
- package/dist/http/simple_request.d.ts +19 -14
- package/dist/http/simple_request.d.ts.map +1 -1
- package/dist/http/simple_request.js +17 -29
- package/dist/http/surface.d.ts +2 -0
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +4 -1
- package/dist/realtime/outbound_budget.d.ts +1 -2
- package/dist/realtime/outbound_budget.d.ts.map +1 -1
- package/dist/realtime/outbound_budget.js +1 -2
- package/dist/realtime/sse.d.ts +47 -17
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +115 -93
- package/dist/realtime/sse_constants.d.ts +7 -1
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +12 -1
- package/dist/realtime/sse_registry.d.ts +3 -3
- package/dist/realtime/sse_registry.js +3 -3
- package/dist/runtime/deps.d.ts +20 -4
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +7 -1
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +33 -3
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +2 -1
- package/dist/runtime/secure_file.d.ts +71 -10
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +91 -11
- package/dist/server/app_backend.d.ts +0 -8
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -3
- package/dist/server/app_server.d.ts +28 -17
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -34
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +49 -45
- package/dist/server/static.d.ts +20 -0
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +56 -8
- package/dist/server/unmatched_route.d.ts +42 -0
- package/dist/server/unmatched_route.d.ts.map +1 -0
- package/dist/server/unmatched_route.js +64 -0
- package/dist/testing/CLAUDE.md +404 -1200
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +4 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +277 -6
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +68 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +20 -4
- package/dist/testing/cross_backend/cell_gated_create.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +179 -23
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
- package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
- package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance.js +296 -0
- package/dist/testing/cross_backend/credential_conformance.json +1284 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
- package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
- package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
- package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_wire.js +188 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +22 -2
- package/dist/testing/cross_backend/default_spine_surface.js +1 -1
- package/dist/testing/cross_backend/differential.d.ts +1 -1
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +3 -2
- package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +11 -5
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +7 -0
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +4 -0
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +78 -4
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +13 -10
- package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
- package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
- package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance.js +196 -0
- package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance.js +186 -0
- package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +2 -1
- package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
- package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
- 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 -5
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +56 -29
- package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
- package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
- package/dist/testing/cross_backend/session_login.d.ts +24 -0
- package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_login.js +31 -0
- package/dist/testing/cross_backend/setup.d.ts +117 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +193 -9
- package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
- package/dist/testing/cross_backend/simple_request.js +5 -0
- package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +88 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +205 -64
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +5 -2
- package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_credential_read.js +175 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +58 -2
- package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +13 -10
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_endpoint.js +19 -2
- package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_role_gated.js +2 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +28 -12
- package/dist/testing/cross_backend/xfail.d.ts +44 -11
- package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
- package/dist/testing/cross_backend/xfail.js +68 -23
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +4 -3
- package/dist/testing/integration.d.ts +1 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +14 -8
- package/dist/testing/integration_helpers.d.ts +50 -3
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +87 -9
- package/dist/testing/middleware.d.ts +2 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +9 -2
- package/dist/testing/round_trip.d.ts +6 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +17 -6
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +7 -0
- package/dist/testing/rpc_helpers.d.ts +4 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +6 -1
- package/dist/testing/rpc_round_trip.d.ts +13 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +25 -6
- package/dist/testing/schema_generators.d.ts +2 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +4 -4
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +8 -8
- package/dist/testing/transports/fetch_transport.d.ts +6 -3
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +31 -19
- package/dist/testing/transports/raw_http.d.ts +61 -1
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +61 -1
- package/dist/testing/transports/ws_raw_client.d.ts +20 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +10 -4
- package/dist/testing/transports/ws_transport.d.ts +21 -1
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +58 -20
- package/package.json +5 -5
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
import { Hono, type Context } from 'hono';
|
|
11
11
|
import type { UpgradeWebSocket } from 'hono/ws';
|
|
12
12
|
import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
13
|
-
import { type SessionOptions
|
|
14
|
-
import type {
|
|
15
|
-
import type
|
|
13
|
+
import { type SessionOptions } from '../auth/session_cookie.js';
|
|
14
|
+
import type { BootstrapTokenStore } from '../auth/bootstrap_token_store.js';
|
|
15
|
+
import { type EventSpec } from '../realtime/sse.js';
|
|
16
16
|
import { type AuditLogSse } from '../realtime/audit_log_sse.js';
|
|
17
17
|
import { RateLimiter, type RateLimiterMode, type RateLimiterOptions } from '../rate_limiter.js';
|
|
18
18
|
import type { DaemonTokenState } from '../auth/daemon_token.js';
|
|
@@ -24,7 +24,7 @@ import { type ServeStaticFactory } from './static.js';
|
|
|
24
24
|
import { type AppSurfaceSpec, type AppSurfaceDiagnostic, type RpcEndpointSpec } from '../http/surface.js';
|
|
25
25
|
import { type RouteSpec } from '../http/route_spec.js';
|
|
26
26
|
import type { MiddlewareCarveOut, MiddlewareSpec } from '../http/middleware_spec.js';
|
|
27
|
-
import { type BootstrapStatus } from '../auth/bootstrap_routes.js';
|
|
27
|
+
import { type BootstrapStatus, type OnBootstrap } from '../auth/bootstrap_routes.js';
|
|
28
28
|
import { type EffectErrorContext } from '../http/pending_effects.js';
|
|
29
29
|
import { type WsEndpointSpec } from '../actions/ws_endpoint_spec.js';
|
|
30
30
|
import type { ConnectionRegistry } from '../actions/connection_registry.js';
|
|
@@ -47,7 +47,7 @@ import { type AuthCleanupScheduleOptions } from '../auth/cleanup.js';
|
|
|
47
47
|
* `check_bootstrap_status`. For tests asserting on the
|
|
48
48
|
* disabled-but-present wire shape.
|
|
49
49
|
* - `live` — route mounted, real token verification. Success path
|
|
50
|
-
* reachable. `
|
|
50
|
+
* reachable. `token_store` is required.
|
|
51
51
|
*/
|
|
52
52
|
export type BootstrapServerOptions = BootstrapDisabledOptions | BootstrapSurfaceOnlyOptions | BootstrapLiveOptions;
|
|
53
53
|
export interface BootstrapDisabledOptions {
|
|
@@ -60,14 +60,16 @@ export interface BootstrapSurfaceOnlyOptions {
|
|
|
60
60
|
}
|
|
61
61
|
export interface BootstrapLiveOptions {
|
|
62
62
|
mode: 'live';
|
|
63
|
-
token_path: string;
|
|
64
|
-
/** Route prefix for bootstrap routes. Default `'/api/account'`; must sit under `/api/`. */
|
|
65
|
-
route_prefix?: string;
|
|
66
63
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
64
|
+
* The one-shot token — production passes
|
|
65
|
+
* `create_file_bootstrap_token_store(runtime, path)` over
|
|
66
|
+
* `FUZ_BOOTSTRAP_TOKEN_PATH`.
|
|
69
67
|
*/
|
|
70
|
-
|
|
68
|
+
token_store: BootstrapTokenStore;
|
|
69
|
+
/** Route prefix for bootstrap routes. Default `'/api/account'`; must sit under `/api/`. */
|
|
70
|
+
route_prefix?: string;
|
|
71
|
+
/** Called after a successful bootstrap commits (see `OnBootstrap`). */
|
|
72
|
+
on_bootstrap?: OnBootstrap;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* Configuration for `create_app_server()`.
|
|
@@ -78,7 +80,12 @@ export interface BootstrapLiveOptions {
|
|
|
78
80
|
export interface AppServerOptions {
|
|
79
81
|
/** Pre-initialized backend from `create_app_backend()`. */
|
|
80
82
|
backend: AppBackend;
|
|
81
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Session options for cookie-based auth. Assembly throws on options that
|
|
85
|
+
* cannot write the cookie: a `cookie_name` that is no RFC 6265 cookie-name,
|
|
86
|
+
* or — found by minting a sample cookie — an `encode_identity` or `max_age`
|
|
87
|
+
* the `Set-Cookie` grammar cannot carry.
|
|
88
|
+
*/
|
|
82
89
|
session_options: SessionOptions<string>;
|
|
83
90
|
/**
|
|
84
91
|
* Parsed allowed origin patterns, as `parse_allowed_origins` returns them
|
|
@@ -592,8 +599,6 @@ export declare const resolve_rate_limiters: (options: Pick<AppServerOptions, App
|
|
|
592
599
|
* @internal
|
|
593
600
|
*/
|
|
594
601
|
export interface ConfigDiagnosticsInput {
|
|
595
|
-
/** The session cookie overrides, from `AppServerOptions.session_options`. */
|
|
596
|
-
cookie_options: Partial<SessionCookieOptions> | undefined;
|
|
597
602
|
/** The `rate_limiters` mode, defaulted. */
|
|
598
603
|
rate_limiter_mode: RateLimiterMode;
|
|
599
604
|
/** The resolved limiters, from `resolve_rate_limiters`. */
|
|
@@ -603,7 +608,7 @@ export interface ConfigDiagnosticsInput {
|
|
|
603
608
|
}
|
|
604
609
|
/**
|
|
605
610
|
* The config-level diagnostics `create_app_server` appends to the surface's
|
|
606
|
-
* spec-level ones:
|
|
611
|
+
* spec-level ones: an open rate-limited
|
|
607
612
|
* surface — one warning for `'disabled_for_testing'`, otherwise one per
|
|
608
613
|
* explicitly-null limiter, so a deployment that disables login's limiter but
|
|
609
614
|
* keeps signup's reads differently from one that disables both — and a
|
|
@@ -619,8 +624,14 @@ export declare const collect_config_diagnostics: (input: ConfigDiagnosticsInput)
|
|
|
619
624
|
* middleware → auth middleware → bootstrap status → route specs (consumer,
|
|
620
625
|
* bootstrap, RPC endpoints, surface) → surface generation → Hono app assembly
|
|
621
626
|
* (routes, then WS endpoints) → post-route middleware → static serving → the
|
|
622
|
-
* auth cleanup schedule. Database migrations
|
|
623
|
-
* pass `migration_namespaces` to
|
|
627
|
+
* unmatched-route handler → the auth cleanup schedule. Database migrations
|
|
628
|
+
* belong to the backend lifecycle — pass `migration_namespaces` to
|
|
629
|
+
* `create_app_backend`.
|
|
630
|
+
*
|
|
631
|
+
* The app routes on the raw request path (`get_request_path`), as the Rust
|
|
632
|
+
* spine's router does, and answers a request no route serves from
|
|
633
|
+
* `create_unmatched_route_handler`: a method its path doesn't serve is a 405
|
|
634
|
+
* with `Allow`, a path no route serves a 404, JSON under the auth scope.
|
|
624
635
|
*
|
|
625
636
|
* When `audit_log_sse` is set, the SSE registry's listener is registered via
|
|
626
637
|
* `backend.deps.audit.add_listener` — no shallow-copy of `AppDeps`. That
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,
|
|
1
|
+
{"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib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Ae,CAAC,KACxE,oBAkBF,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,2CAA2C;IAC3C,iBAAiB,EAAE,eAAe,CAAC;IACnC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IACnE,uFAAuF;IACvF,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACtC,OAAO,sBAAsB,KAC3B,KAAK,CAAC,oBAAoB,CAgC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Hono } from 'hono';
|
|
11
11
|
import { logger } from 'hono/logger';
|
|
12
|
-
import {
|
|
12
|
+
import { SESSION_AGE_MAX, create_session_cookie_value, format_session_set_cookie, is_cookie_name } from '../auth/session_cookie.js';
|
|
13
|
+
import { generate_session_token } from '../auth/session_queries.js';
|
|
14
|
+
import { create_sse_stream } from '../realtime/sse.js';
|
|
13
15
|
import { create_audit_log_sse, create_sse_connection_closer, audit_log_event_specs } from '../realtime/audit_log_sse.js';
|
|
14
16
|
import { BaseServerEnv } from './env.js';
|
|
15
17
|
import { RateLimiter, announce_rate_limiters_disabled, default_login_ip_rate_limit, default_login_account_rate_limit, default_action_account_rate_limit, default_action_ip_rate_limit } from '../rate_limiter.js';
|
|
@@ -18,10 +20,13 @@ import { RateLimiter, announce_rate_limiters_disabled, default_login_ip_rate_lim
|
|
|
18
20
|
import '../hono_context.js';
|
|
19
21
|
import { create_proxy_middleware_spec } from '../http/proxy.js';
|
|
20
22
|
import { create_static_middleware } from './static.js';
|
|
23
|
+
import { create_unmatched_route_handler } from './unmatched_route.js';
|
|
24
|
+
import { get_request_path } from '../http/request_target.js';
|
|
21
25
|
import { log_startup_summary } from './startup.js';
|
|
22
26
|
import { create_app_error_handler } from './app_error_handler.js';
|
|
23
27
|
import { create_app_surface_spec } from '../http/surface.js';
|
|
24
28
|
import { create_dev_route_error_check } from '../http/dev_route_error_check.js';
|
|
29
|
+
import { create_dev_set_cookie_check } from '../http/dev_set_cookie_check.js';
|
|
25
30
|
import { apply_middleware_specs, apply_route_specs, prefix_route_specs } from '../http/route_spec.js';
|
|
26
31
|
import { check_bootstrap_status, create_bootstrap_route_specs } from '../auth/bootstrap_routes.js';
|
|
27
32
|
import { create_surface_route_spec } from './surface_route.js';
|
|
@@ -129,7 +134,7 @@ export const resolve_rate_limiters = (options) => {
|
|
|
129
134
|
};
|
|
130
135
|
/**
|
|
131
136
|
* The config-level diagnostics `create_app_server` appends to the surface's
|
|
132
|
-
* spec-level ones:
|
|
137
|
+
* spec-level ones: an open rate-limited
|
|
133
138
|
* surface — one warning for `'disabled_for_testing'`, otherwise one per
|
|
134
139
|
* explicitly-null limiter, so a deployment that disables login's limiter but
|
|
135
140
|
* keeps signup's reads differently from one that disables both — and a
|
|
@@ -139,30 +144,6 @@ export const resolve_rate_limiters = (options) => {
|
|
|
139
144
|
*/
|
|
140
145
|
export const collect_config_diagnostics = (input) => {
|
|
141
146
|
const diagnostics = [];
|
|
142
|
-
const { cookie_options } = input;
|
|
143
|
-
if (cookie_options) {
|
|
144
|
-
if (cookie_options.secure === false) {
|
|
145
|
-
diagnostics.push({
|
|
146
|
-
level: 'warning',
|
|
147
|
-
category: 'security',
|
|
148
|
-
message: 'Session cookie secure=false — cookies sent over HTTP'
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (cookie_options.sameSite && cookie_options.sameSite !== session_cookie_options.sameSite) {
|
|
152
|
-
diagnostics.push({
|
|
153
|
-
level: 'warning',
|
|
154
|
-
category: 'security',
|
|
155
|
-
message: `Session cookie sameSite='${cookie_options.sameSite}' — weakened from default '${session_cookie_options.sameSite}'`
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (cookie_options.httpOnly === false) {
|
|
159
|
-
diagnostics.push({
|
|
160
|
-
level: 'warning',
|
|
161
|
-
category: 'security',
|
|
162
|
-
message: 'Session cookie httpOnly=false — cookie accessible to JS'
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
147
|
if (input.rate_limiter_mode === 'disabled_for_testing') {
|
|
167
148
|
// one warning for the mode rather than one per limiter it nulled
|
|
168
149
|
diagnostics.push({
|
|
@@ -200,8 +181,14 @@ export const collect_config_diagnostics = (input) => {
|
|
|
200
181
|
* middleware → auth middleware → bootstrap status → route specs (consumer,
|
|
201
182
|
* bootstrap, RPC endpoints, surface) → surface generation → Hono app assembly
|
|
202
183
|
* (routes, then WS endpoints) → post-route middleware → static serving → the
|
|
203
|
-
* auth cleanup schedule. Database migrations
|
|
204
|
-
* pass `migration_namespaces` to
|
|
184
|
+
* unmatched-route handler → the auth cleanup schedule. Database migrations
|
|
185
|
+
* belong to the backend lifecycle — pass `migration_namespaces` to
|
|
186
|
+
* `create_app_backend`.
|
|
187
|
+
*
|
|
188
|
+
* The app routes on the raw request path (`get_request_path`), as the Rust
|
|
189
|
+
* spine's router does, and answers a request no route serves from
|
|
190
|
+
* `create_unmatched_route_handler`: a method its path doesn't serve is a 405
|
|
191
|
+
* with `Allow`, a path no route serves a 404, JSON under the auth scope.
|
|
205
192
|
*
|
|
206
193
|
* When `audit_log_sse` is set, the SSE registry's listener is registered via
|
|
207
194
|
* `backend.deps.audit.add_listener` — no shallow-copy of `AppDeps`. That
|
|
@@ -268,6 +255,23 @@ const assemble_app_server = async (options, releases) => {
|
|
|
268
255
|
const { deps } = backend;
|
|
269
256
|
const { log } = deps;
|
|
270
257
|
// option checks first, before anything is acquired
|
|
258
|
+
if (!is_cookie_name(options.session_options.cookie_name)) {
|
|
259
|
+
// a name the `Cookie` grammar cannot carry would be written as a header
|
|
260
|
+
// that reads back differently — refused here rather than at the first login
|
|
261
|
+
throw new Error(`create_app_server: session cookie name ${JSON.stringify(options.session_options.cookie_name)} is not an RFC 6265 cookie-name`);
|
|
262
|
+
}
|
|
263
|
+
// Mint a sample cookie the way a login does. Options that cannot write one
|
|
264
|
+
// — an `encode_identity` emitting a character outside the cookie grammar, a
|
|
265
|
+
// `max_age` that is no whole number of seconds — would otherwise throw at
|
|
266
|
+
// the first mint, which for bootstrap comes after its one-shot token is
|
|
267
|
+
// spent.
|
|
268
|
+
try {
|
|
269
|
+
format_session_set_cookie(options.session_options.cookie_name, await create_session_cookie_value(deps.keyring, generate_session_token(), options.session_options), options.session_options.max_age ?? SESSION_AGE_MAX);
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
throw new Error('create_app_server: session_options cannot mint a session cookie — ' +
|
|
273
|
+
(error instanceof Error ? error.message : String(error)), { cause: error });
|
|
274
|
+
}
|
|
271
275
|
if (options.allowed_origins.length === 0) {
|
|
272
276
|
throw new Error('create_app_server: allowed_origins is empty — list at least one origin pattern ' +
|
|
273
277
|
'(an empty list refuses every browser request)');
|
|
@@ -341,8 +345,8 @@ const assemble_app_server = async (options, releases) => {
|
|
|
341
345
|
// - 'surface_only': route mounted but permanently unavailable; status placeholder.
|
|
342
346
|
// - 'live': real disk + lock check via `check_bootstrap_status`.
|
|
343
347
|
const bootstrap_status = options.bootstrap?.mode === 'live'
|
|
344
|
-
? await check_bootstrap_status(deps, {
|
|
345
|
-
: { available: false
|
|
348
|
+
? await check_bootstrap_status(deps, { token_store: options.bootstrap.token_store })
|
|
349
|
+
: { available: false };
|
|
346
350
|
// Surface route ref — factory manages the circular ref
|
|
347
351
|
const surface_ref = {
|
|
348
352
|
surface: {
|
|
@@ -375,6 +379,7 @@ const assemble_app_server = async (options, releases) => {
|
|
|
375
379
|
const bootstrap_routes = create_bootstrap_route_specs(deps, {
|
|
376
380
|
session_options: options.session_options,
|
|
377
381
|
bootstrap_status,
|
|
382
|
+
token_store: options.bootstrap.mode === 'live' ? options.bootstrap.token_store : null,
|
|
378
383
|
on_bootstrap: options.bootstrap.mode === 'live' ? options.bootstrap.on_bootstrap : undefined,
|
|
379
384
|
bootstrap_ip_rate_limiter
|
|
380
385
|
});
|
|
@@ -505,7 +510,6 @@ const assemble_app_server = async (options, releases) => {
|
|
|
505
510
|
});
|
|
506
511
|
// Config-level diagnostics (concatenated after spec-level from generate_app_surface)
|
|
507
512
|
const config_diagnostics = collect_config_diagnostics({
|
|
508
|
-
cookie_options: options.session_options.cookie_options,
|
|
509
513
|
rate_limiter_mode,
|
|
510
514
|
rate_limiters,
|
|
511
515
|
max_body_size: options.max_body_size
|
|
@@ -516,8 +520,9 @@ const assemble_app_server = async (options, releases) => {
|
|
|
516
520
|
// Backfill the surface ref — factory owns this lifecycle
|
|
517
521
|
surface_ref.surface = surface_spec.surface;
|
|
518
522
|
log_startup_summary(surface_spec.surface, log, options.env_values);
|
|
519
|
-
// Hono app assembly
|
|
520
|
-
|
|
523
|
+
// Hono app assembly, routing on the raw path: nothing is percent-decoded
|
|
524
|
+
// before the router, so every path-keyed layer reads the spelling it matched
|
|
525
|
+
const app = new Hono({ getPath: get_request_path });
|
|
521
526
|
// A throw that escapes every route catch — a credential leg's failed read
|
|
522
527
|
// above all — answers here: 503 for a failed pool checkout, Hono's default
|
|
523
528
|
// 500 for anything else.
|
|
@@ -531,6 +536,12 @@ const assemble_app_server = async (options, releases) => {
|
|
|
531
536
|
});
|
|
532
537
|
if (dev_route_error_check)
|
|
533
538
|
app.use('*', dev_route_error_check);
|
|
539
|
+
// DEV only, beside it: logs a response that does not lead with the
|
|
540
|
+
// `Set-Cookie` line the session middleware put on the context — one built
|
|
541
|
+
// past the context, by a layer the route system doesn't own
|
|
542
|
+
const dev_set_cookie_check = create_dev_set_cookie_check({ log });
|
|
543
|
+
if (dev_set_cookie_check)
|
|
544
|
+
app.use('*', dev_set_cookie_check);
|
|
534
545
|
// Two-queue side-effect flush. `pending_effects` collects eager
|
|
535
546
|
// fire-and-forget promises (audit emits, api-token usage). `post_commit_effects` collects deferred thunks pushed via
|
|
536
547
|
// `emit_after_commit` (WS notifications, anything that must observe a
|
|
@@ -575,7 +586,10 @@ const assemble_app_server = async (options, releases) => {
|
|
|
575
586
|
}
|
|
576
587
|
apply_middleware_specs(app, middleware_specs);
|
|
577
588
|
const authorize = create_fuz_authorization_handler({ db: deps.db });
|
|
578
|
-
apply_route_specs(app, route_specs, fuz_auth_guard_resolver, log, deps.db,
|
|
589
|
+
apply_route_specs(app, route_specs, fuz_auth_guard_resolver, log, deps.db, {
|
|
590
|
+
authorize,
|
|
591
|
+
open_sse: create_sse_stream
|
|
592
|
+
});
|
|
579
593
|
// WS endpoint auto-mount — must run after `app` exists and
|
|
580
594
|
// `apply_route_specs` has registered the request routes. Each spec
|
|
581
595
|
// becomes a `register_action_ws` call. `post_route_middleware` and static
|
|
@@ -625,6 +639,10 @@ const assemble_app_server = async (options, releases) => {
|
|
|
625
639
|
app.use('/*', mw);
|
|
626
640
|
}
|
|
627
641
|
}
|
|
642
|
+
// What no route answers: a 405 where the path serves another method, else
|
|
643
|
+
// the 404 — read from the app's own router, so every route registered on
|
|
644
|
+
// it counts, one added after assembly included
|
|
645
|
+
app.notFound(create_unmatched_route_handler(app.router));
|
|
628
646
|
// Auth cleanup — opt-in, and last: nothing after it can throw, so a failed
|
|
629
647
|
// assembly never leaves a schedule running. Its own throw (an invalid
|
|
630
648
|
// `interval_ms`) comes before any pass starts, and unwinds `releases` like
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;
|
|
1
|
+
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmIG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAatD,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAUxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkBjD,MAAM,WAAW,+BAA+B;IAC/C,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAoJD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS,+BAA+B,KACtC,SAyDF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,SA8CF,CAAC"}
|
|
@@ -135,10 +135,10 @@ import { Readable } from 'node:stream';
|
|
|
135
135
|
import { join } from 'node:path';
|
|
136
136
|
import { ActingActor, FactHashSchema, Uuid } from '../primitive_schemas.js';
|
|
137
137
|
import { literal, object } from '@fuzdev/fuz_schema/schema.ts';
|
|
138
|
-
import { build_request_context, get_public_account_id,
|
|
138
|
+
import { build_request_context, get_public_account_id, has_scoped_role } from '../auth/request_context.js';
|
|
139
139
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
140
140
|
import { query_active_actors_by_account } from '../auth/account_queries.js';
|
|
141
|
-
import { define_route
|
|
141
|
+
import { define_route } from '../http/route_spec.js';
|
|
142
142
|
import { route_fail, route_raw } from '../http/route_result.js';
|
|
143
143
|
import { REST_INTERNAL_ERROR } from '../http/error_schemas.js';
|
|
144
144
|
import { query_get_fact, query_get_fact_meta } from '../db/fact_queries.js';
|
|
@@ -173,15 +173,16 @@ const cell_fact_params_schema = object({ cell_id: Uuid, hash: FactHashSchema });
|
|
|
173
173
|
* Returns 404 when the fact's metadata is missing, its embedded bytes have
|
|
174
174
|
* vanished (a race), or its disk file is missing, so the response shape is
|
|
175
175
|
* identical whether the fact is genuinely absent or merely unviewable; any
|
|
176
|
-
* other failure to open the disk file answers a logged 500.
|
|
177
|
-
*
|
|
178
|
-
*
|
|
176
|
+
* other failure to open the disk file answers a logged 500. A disk fact's body
|
|
177
|
+
* is a stream over the open file, whose cancel closes it: a `HEAD`, which
|
|
178
|
+
* opens the file and so answers the same statuses, is answered with the
|
|
179
|
+
* headers alone and the stream cancelled by the spine (`emit_route_response`).
|
|
179
180
|
*/
|
|
180
|
-
const serve_fact_bytes = async (
|
|
181
|
+
const serve_fact_bytes = async (route, hash, config) => {
|
|
181
182
|
const { facts_dir, x_accel, log } = config;
|
|
182
183
|
const meta = await query_get_fact_meta({ db: route.db }, hash);
|
|
183
184
|
if (!meta) {
|
|
184
|
-
return route_raw(
|
|
185
|
+
return route_raw({ status: 404 });
|
|
185
186
|
}
|
|
186
187
|
const content_type = meta.content_type ?? 'application/octet-stream';
|
|
187
188
|
const size = String(meta.size);
|
|
@@ -191,39 +192,46 @@ const serve_fact_bytes = async (c, route, hash, config) => {
|
|
|
191
192
|
if (!row || row.bytes === null) {
|
|
192
193
|
// Race: meta said embedded but bytes vanished. Treat as not-found.
|
|
193
194
|
log.warn(`serve_fact: embedded bytes missing for ${hash} (meta said embedded, row=${row ? 'present' : 'null'})`);
|
|
194
|
-
return route_raw(
|
|
195
|
+
return route_raw({ status: 404 });
|
|
195
196
|
}
|
|
196
197
|
const bytes = to_uint8(row.bytes);
|
|
197
|
-
return route_raw(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
return route_raw({
|
|
199
|
+
status: 200,
|
|
200
|
+
headers: {
|
|
201
|
+
'Content-Type': content_type,
|
|
202
|
+
'Content-Length': size,
|
|
203
|
+
'Cache-Control': FACT_CACHE_CONTROL,
|
|
204
|
+
...FACT_SECURITY_HEADERS
|
|
205
|
+
},
|
|
206
|
+
body: bytes
|
|
207
|
+
});
|
|
203
208
|
}
|
|
204
209
|
// External — defense-in-depth re-validate the URL before trusting it
|
|
205
210
|
// to address the filesystem: its shape, then that it is this hash's file
|
|
206
211
|
const parsed = parse_file_fact_url(meta.external_url);
|
|
207
212
|
if (!parsed) {
|
|
208
213
|
log.error(`serve_fact: external_url for ${hash} is not a file:<shard>/<rest> URL; answering 404`);
|
|
209
|
-
return route_raw(
|
|
214
|
+
return route_raw({ status: 404 });
|
|
210
215
|
}
|
|
211
216
|
if (!file_fact_url_addresses(parsed, hash)) {
|
|
212
217
|
log.error(`serve_fact: external_url for ${hash} addresses another fact's file; answering 404`);
|
|
213
|
-
return route_raw(
|
|
218
|
+
return route_raw({ status: 404 });
|
|
214
219
|
}
|
|
215
220
|
const { shard, rest } = parsed;
|
|
216
221
|
if (x_accel !== undefined) {
|
|
217
222
|
// Production: hand off to nginx via the validated `internal;` facts location.
|
|
218
223
|
// nginx answers with that location's own `add_header` set, not these
|
|
219
224
|
// headers, which is why the validator requires the fact pair there.
|
|
220
|
-
return route_raw(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
return route_raw({
|
|
226
|
+
status: 200,
|
|
227
|
+
headers: {
|
|
228
|
+
'Content-Type': content_type,
|
|
229
|
+
'Content-Length': size,
|
|
230
|
+
'Cache-Control': FACT_CACHE_CONTROL,
|
|
231
|
+
'X-Accel-Redirect': `${x_accel.redirect_prefix}${shard}/${rest}`,
|
|
232
|
+
...FACT_SECURITY_HEADERS
|
|
233
|
+
}
|
|
234
|
+
});
|
|
227
235
|
}
|
|
228
236
|
// Dev / tests: stream from disk. Open before committing the 200 so a
|
|
229
237
|
// missing file answers 404 and any other open failure a logged 500, as the
|
|
@@ -236,7 +244,7 @@ const serve_fact_bytes = async (c, route, hash, config) => {
|
|
|
236
244
|
catch (err) {
|
|
237
245
|
if (err.code === 'ENOENT') {
|
|
238
246
|
log.warn(`serve_fact: disk file for ${hash} is missing; answering 404`);
|
|
239
|
-
return route_raw(
|
|
247
|
+
return route_raw({ status: 404 });
|
|
240
248
|
}
|
|
241
249
|
log.error(`serve_fact: disk open for ${hash} failed`, err);
|
|
242
250
|
return route_fail(REST_INTERNAL_ERROR);
|
|
@@ -247,14 +255,10 @@ const serve_fact_bytes = async (c, route, hash, config) => {
|
|
|
247
255
|
'Cache-Control': FACT_CACHE_CONTROL,
|
|
248
256
|
...FACT_SECURITY_HEADERS
|
|
249
257
|
};
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
if (c.req.method === 'HEAD') {
|
|
253
|
-
await handle.close();
|
|
254
|
-
return route_raw(c.body(null, 200, headers));
|
|
255
|
-
}
|
|
258
|
+
// the stream's cancel closes the handle — what releases it on a `HEAD`, a
|
|
259
|
+
// refused answer, or a rolled-back one
|
|
256
260
|
const web_stream = Readable.toWeb(handle.createReadStream());
|
|
257
|
-
return route_raw(
|
|
261
|
+
return route_raw({ status: 200, headers, body: web_stream });
|
|
258
262
|
};
|
|
259
263
|
/**
|
|
260
264
|
* Resolve the caller's `RequestContext` on a pure-public route from the
|
|
@@ -270,9 +274,9 @@ const serve_fact_bytes = async (c, route, hash, config) => {
|
|
|
270
274
|
* count (`query_active_actors_by_account`), matching the acting-actor
|
|
271
275
|
* resolution path — a tombstoned actor is never resolvable here.
|
|
272
276
|
*/
|
|
273
|
-
const build_public_request_context = async (
|
|
277
|
+
const build_public_request_context = async (route) => {
|
|
274
278
|
// a narrowed token is the anonymous caller here, never a refusal
|
|
275
|
-
const account_id = get_public_account_id(
|
|
279
|
+
const account_id = get_public_account_id(route);
|
|
276
280
|
if (!account_id)
|
|
277
281
|
return null;
|
|
278
282
|
const actors = await query_active_actors_by_account({ db: route.db }, account_id);
|
|
@@ -309,18 +313,18 @@ export const create_serve_cell_fact_route_spec = (options) => {
|
|
|
309
313
|
input: literal(null),
|
|
310
314
|
// The body is a binary stream; no JSON output schema applies.
|
|
311
315
|
output: literal(null),
|
|
312
|
-
handler: async (
|
|
313
|
-
const { cell_id, hash } =
|
|
316
|
+
handler: async (route) => {
|
|
317
|
+
const { cell_id, hash } = route.params;
|
|
314
318
|
// Resolve the named cell. Missing / soft-deleted → 404 (masked).
|
|
315
319
|
const cell = await query_cell_get({ db: route.db }, cell_id);
|
|
316
320
|
if (!cell) {
|
|
317
|
-
return route_raw(
|
|
321
|
+
return route_raw({ status: 404 });
|
|
318
322
|
}
|
|
319
323
|
// Per-reference view check — scoped to *this* cell only. It runs
|
|
320
324
|
// before the edge check, so a cell the caller can't view does the
|
|
321
325
|
// same work, and answers the same 404, whether or not it references
|
|
322
326
|
// the hash — the edge stays unobservable to a non-viewer.
|
|
323
|
-
const req_ctx = await build_public_request_context(
|
|
327
|
+
const req_ctx = await build_public_request_context(route);
|
|
324
328
|
// Unauthenticated callers skip the grant fetch entirely — no grant
|
|
325
329
|
// can admit a null req_ctx (the only admit path is the
|
|
326
330
|
// public-visibility branch in `can_view_cell`, which doesn't read
|
|
@@ -334,16 +338,16 @@ export const create_serve_cell_fact_route_spec = (options) => {
|
|
|
334
338
|
if (!can_view_cell(req_ctx, cell, grants) &&
|
|
335
339
|
!(await cell_steward_admits({ db: route.db }, req_ctx, cell))) {
|
|
336
340
|
// 404 (not 403) so an unviewable cell→fact edge doesn't leak.
|
|
337
|
-
return route_raw(
|
|
341
|
+
return route_raw({ status: 404 });
|
|
338
342
|
}
|
|
339
343
|
// The cell→fact edge: the cell must actually reference the hash.
|
|
340
344
|
// `cell.refs` is auto-derived from `data` on every write, so this is
|
|
341
345
|
// the authoritative "does this cell reference these bytes" check.
|
|
342
346
|
// Missing edge → 404 (masked), never "exists elsewhere".
|
|
343
347
|
if (!cell.refs?.includes(hash)) {
|
|
344
|
-
return route_raw(
|
|
348
|
+
return route_raw({ status: 404 });
|
|
345
349
|
}
|
|
346
|
-
return serve_fact_bytes(
|
|
350
|
+
return serve_fact_bytes(route, hash, config);
|
|
347
351
|
}
|
|
348
352
|
});
|
|
349
353
|
};
|
|
@@ -392,18 +396,18 @@ export const create_serve_fact_route_spec = (options) => {
|
|
|
392
396
|
input: literal(null),
|
|
393
397
|
// The body is a binary stream; no JSON output schema applies.
|
|
394
398
|
output: literal(null),
|
|
395
|
-
handler: async (
|
|
396
|
-
const { hash } =
|
|
399
|
+
handler: async (route) => {
|
|
400
|
+
const { hash } = route.params;
|
|
397
401
|
// Defense-in-depth: the auth phase already gated this on the admin
|
|
398
402
|
// role, but re-check the resolved context so a mounting/auth-shape
|
|
399
403
|
// regression fails closed instead of serving by bare hash. Global
|
|
400
404
|
// grant only — a scoped `admin` row must not read every fact. It
|
|
401
405
|
// fires only on such a regression, so it fails loud as well.
|
|
402
|
-
if (!has_scoped_role(
|
|
406
|
+
if (!has_scoped_role(route.auth, ROLE_ADMIN, null)) {
|
|
403
407
|
log.error('bare-hash fact read reached the handler without a global admin grant — the auth gate did not run');
|
|
404
|
-
return route_raw(
|
|
408
|
+
return route_raw({ status: 404 });
|
|
405
409
|
}
|
|
406
|
-
return serve_fact_bytes(
|
|
410
|
+
return serve_fact_bytes(route, hash, config);
|
|
407
411
|
}
|
|
408
412
|
});
|
|
409
413
|
};
|
package/dist/server/static.d.ts
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* - Step 2: `.html` fallback for clean URLs (`/about` → `/about.html`)
|
|
7
7
|
* - Step 3 (optional): SPA fallback for client-side routes
|
|
8
8
|
*
|
|
9
|
+
* The server routes on the raw request path (`get_request_path`), and a
|
|
10
|
+
* runtime's `serveStatic` refuses a path holding a `%` — it expects one the
|
|
11
|
+
* router already decoded. So a path with an escape is decoded here first
|
|
12
|
+
* (`to_static_file_path`) and handed to `serveStatic` as the file to serve;
|
|
13
|
+
* one with no escape goes to it as is. The SPA fallback names its file
|
|
14
|
+
* outright, so no step but the exact match hands `serveStatic` the request
|
|
15
|
+
* path.
|
|
16
|
+
*
|
|
9
17
|
* @module
|
|
10
18
|
*/
|
|
11
19
|
import type { MiddlewareHandler } from 'hono';
|
|
@@ -16,6 +24,8 @@ export interface ServeStaticOptions {
|
|
|
16
24
|
root: string;
|
|
17
25
|
rewriteRequestPath?: (path: string) => string;
|
|
18
26
|
mimes?: Record<string, string>;
|
|
27
|
+
/** The file to serve, relative to `root`, in place of the request's path. */
|
|
28
|
+
path?: string;
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
31
|
* Factory function that creates a static file serving middleware.
|
|
@@ -23,6 +33,16 @@ export interface ServeStaticOptions {
|
|
|
23
33
|
* Matches the signature of `serveStatic` from `@hono/node-server/serve-static` and `@hono/bun`.
|
|
24
34
|
*/
|
|
25
35
|
export type ServeStaticFactory = (options: ServeStaticOptions) => MiddlewareHandler;
|
|
36
|
+
/**
|
|
37
|
+
* The file a raw request path names, each segment percent-decoded by
|
|
38
|
+
* `decodeURIComponent` — or `null`, no file, for an escape that doesn't
|
|
39
|
+
* decode, a segment that decodes to a `/` or a `%` (which `serveStatic`
|
|
40
|
+
* never served: it refused the router's decoded path holding either), and a
|
|
41
|
+
* decoded path holding a dot segment, an empty segment, a backslash or a NUL.
|
|
42
|
+
*
|
|
43
|
+
* @param path - the raw request path
|
|
44
|
+
*/
|
|
45
|
+
export declare const to_static_file_path: (path: string) => string | null;
|
|
26
46
|
/**
|
|
27
47
|
* Create static file serving middleware for SvelteKit static builds.
|
|
28
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/lib/server/static.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/lib/server/static.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,iBAAiB,CAAC;AAKpF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAc3D,CAAC;AAMF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GACpC,cAAc,kBAAkB,EAChC,UAAU;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,KAC1F,KAAK,CAAC,iBAAiB,CAmCzB,CAAC"}
|