@fuzdev/fuz_app 0.180.0 → 0.182.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 +38 -20
- package/dist/actions/action_rpc.d.ts +25 -6
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -48
- package/dist/actions/action_types.d.ts +31 -13
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +1 -1
- package/dist/actions/notification_sender.d.ts +83 -0
- package/dist/actions/notification_sender.d.ts.map +1 -0
- package/dist/actions/notification_sender.js +85 -0
- package/dist/actions/perform_action.d.ts +13 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +27 -18
- package/dist/actions/register_action_ws.d.ts +20 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +17 -5
- package/dist/actions/ws_socket_session.d.ts +3 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +3 -2
- package/dist/auth/CLAUDE.md +84 -59
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +30 -3
- package/dist/auth/account_queries.d.ts +213 -2
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +255 -2
- 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 +5 -7
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +110 -89
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +117 -25
- package/dist/auth/api_token_queries.d.ts +29 -12
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +42 -27
- 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 +37 -32
- 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 +39 -30
- package/dist/auth/deps.d.ts +10 -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 +97 -76
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +93 -104
- package/dist/auth/resolved_auth.d.ts +10 -5
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +5 -3
- package/dist/auth/role_grant_offer_actions.d.ts +7 -11
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +97 -106
- 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_notifications.d.ts +87 -38
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +75 -22
- package/dist/auth/role_grant_offer_queries.d.ts +143 -9
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +266 -66
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/role_grant_queries.d.ts +57 -10
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +81 -22
- package/dist/auth/role_grant_sql.d.ts +21 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -1
- package/dist/auth/role_grant_sql.js +21 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +9 -2
- 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 +95 -14
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +98 -19
- 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/standard_rpc_actions.d.ts +6 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +5 -6
- package/dist/auth/token_scope.d.ts +6 -8
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +6 -9
- 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 +156 -48
- package/dist/http/auth_shape.d.ts +4 -4
- 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 +45 -22
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +53 -26
- 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 +299 -83
- 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 +4 -4
- package/dist/server/app_server.d.ts +54 -33
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +69 -41
- package/dist/server/serve_fact_route.d.ts +3 -3
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -55
- 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 +406 -1202
- 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 +5 -9
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +3 -2
- 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 +320 -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.d.ts +1 -26
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +3 -7
- 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 +4 -10
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +11 -4
- 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 +5 -4
- 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 +185 -31
- 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 +82 -34
- 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 +3 -1
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +14 -7
- package/dist/testing/resolved_auth.d.ts +3 -1
- package/dist/testing/resolved_auth.d.ts.map +1 -1
- package/dist/testing/resolved_auth.js +4 -4
- 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 +13 -10
- 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/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +8 -4
- package/package.json +1 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* `_testing_credential_read` — the testing seam behind the cross-impl
|
|
4
|
+
* credential conformance table (`credential_conformance.json`): its input and
|
|
5
|
+
* output schemas, the pure read it answers with, its spec, and the action
|
|
6
|
+
* builder.
|
|
7
|
+
*
|
|
8
|
+
* A leaf like `testing_origin_check.ts`, and hono-free for the same reason: a
|
|
9
|
+
* consumer whose backend is a spawned Rust binary runs the table without
|
|
10
|
+
* installing `hono`.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { array, max_length, nullable, object, one_of, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
|
+
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
16
|
+
import { rpc_action } from '../../actions/action_types.js';
|
|
17
|
+
import { read_bearer_token, read_daemon_token, read_session_cookie_value } from '../../auth/credential_headers.js';
|
|
18
|
+
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
19
|
+
import { process_session_cookie } from '../../auth/session_cookie.js';
|
|
20
|
+
import { trim_optional_whitespace } from '../../http/header_lines.js';
|
|
21
|
+
import { jsonrpc_errors } from '../../http/jsonrpc_errors.js';
|
|
22
|
+
import { bounded_string } from '../../primitive_schemas.js';
|
|
23
|
+
import { TESTING_ACTION_AUTH } from './spine_surface_constants.js';
|
|
24
|
+
/**
|
|
25
|
+
* The `data.reason` of every refusal `_testing_credential_read` gives its
|
|
26
|
+
* `lines`: a value that is no list of strings, a list or a line over its cap
|
|
27
|
+
* (`TESTING_CREDENTIAL_READ_LINES_MAX`,
|
|
28
|
+
* `TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX`), and a line it cannot read as a
|
|
29
|
+
* header line — no `:`, a name that is no HTTP token, or a character that is
|
|
30
|
+
* no byte a field value holds: above U+00FF (a line is bytes, one per
|
|
31
|
+
* character), or a control character other than HTAB, which an HTTP parser
|
|
32
|
+
* refuses before any spine code runs.
|
|
33
|
+
*/
|
|
34
|
+
export const ERROR_TESTING_CREDENTIAL_READ_LINE = 'invalid_header_line';
|
|
35
|
+
/**
|
|
36
|
+
* The longest header line `_testing_credential_read` reads, in UTF-16 code
|
|
37
|
+
* units — one a byte for every character a line may hold. A cap both spines
|
|
38
|
+
* state, so neither reads a line the other's header types refuse for its
|
|
39
|
+
* length; far above any credential line.
|
|
40
|
+
*/
|
|
41
|
+
export const TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX = 1024;
|
|
42
|
+
/** The most header lines `_testing_credential_read` reads — both spines' cap. */
|
|
43
|
+
export const TESTING_CREDENTIAL_READ_LINES_MAX = 32;
|
|
44
|
+
/** Input of `_testing_credential_read`, a `@fuzdev/fuz_schema` `object`. */
|
|
45
|
+
export const TestingCredentialReadInput = object({
|
|
46
|
+
/**
|
|
47
|
+
* The request's header lines, each `Name: value`, in the order sent — a
|
|
48
|
+
* name may repeat. Every character is one byte a field value may hold
|
|
49
|
+
* (HTAB, U+0020–U+007E, U+0080–U+00FF), as a runtime hands a handler a
|
|
50
|
+
* header's bytes. At most `TESTING_CREDENTIAL_READ_LINES_MAX` lines of at
|
|
51
|
+
* most `TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX` characters each.
|
|
52
|
+
*/
|
|
53
|
+
lines: meta(pipe(array(bounded_string({ max: TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX })), max_length(TESTING_CREDENTIAL_READ_LINES_MAX)), { invalid_reason: ERROR_TESTING_CREDENTIAL_READ_LINE })
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* What a request's `Cookie` lines hold of the session cookie — the wire form
|
|
57
|
+
* of the Rust spine's `fuz_auth::SessionCookieRead`, its variants in
|
|
58
|
+
* lowercase.
|
|
59
|
+
*/
|
|
60
|
+
export const SessionCookieRead = one_of(['absent', 'invalid', 'valid']);
|
|
61
|
+
/**
|
|
62
|
+
* Output of `_testing_credential_read`, a `@fuzdev/fuz_schema` `object`: how
|
|
63
|
+
* each credential leg reads the lines, before any database work.
|
|
64
|
+
*/
|
|
65
|
+
export const TestingCredentialReadOutput = object({
|
|
66
|
+
/**
|
|
67
|
+
* `absent` — no pair names the cookie; `invalid` — one does and its value
|
|
68
|
+
* fails verification (what the spine clears); `valid` — it verifies under
|
|
69
|
+
* the server's keyring and its signed expiry is ahead. Says nothing about
|
|
70
|
+
* the `auth_session` row.
|
|
71
|
+
*/
|
|
72
|
+
session_cookie: SessionCookieRead,
|
|
73
|
+
/** The API token the bearer leg would look up, or `null` when it reads none. */
|
|
74
|
+
bearer_token: nullable(string),
|
|
75
|
+
/** The daemon token the daemon leg would compare, or `null` when it reads none. */
|
|
76
|
+
daemon_token: nullable(string)
|
|
77
|
+
});
|
|
78
|
+
/** An HTTP field name: an RFC 9110 `token`. */
|
|
79
|
+
const HEADER_NAME_REGEX = /^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/;
|
|
80
|
+
/**
|
|
81
|
+
* Whether every character of `line` is a byte a header line may hold: HTAB,
|
|
82
|
+
* visible ASCII and SP, or `obs-text` (U+0080–U+00FF).
|
|
83
|
+
*/
|
|
84
|
+
const is_header_line_bytes = (line) => {
|
|
85
|
+
for (let i = 0; i < line.length; i++) {
|
|
86
|
+
const code = line.charCodeAt(i);
|
|
87
|
+
if (code > 0xff || code === 0x7f || (code < 0x20 && code !== 0x09))
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Split `Name: value` lines into the per-name lines the credential readers
|
|
94
|
+
* take — what an HTTP parser does to a request head: the name ends at the
|
|
95
|
+
* first `:` and compares in ASCII lowercase, the value loses its outer SP and
|
|
96
|
+
* HTAB, and lines of one name keep their order.
|
|
97
|
+
*
|
|
98
|
+
* @param lines - the header lines
|
|
99
|
+
* @returns the lines of a header by its lowercase name (`[]` for a header not sent)
|
|
100
|
+
* @throws ThrownJsonrpcError `invalid_params` with reason `ERROR_TESTING_CREDENTIAL_READ_LINE` for a line with no `:`, a name that is no token, or a character no header line holds
|
|
101
|
+
*/
|
|
102
|
+
export const parse_testing_header_lines = (lines) => {
|
|
103
|
+
const by_name = new Map();
|
|
104
|
+
for (const line of lines) {
|
|
105
|
+
const colon = line.indexOf(':');
|
|
106
|
+
const name = colon === -1 ? '' : line.slice(0, colon);
|
|
107
|
+
if (!HEADER_NAME_REGEX.test(name) || !is_header_line_bytes(line)) {
|
|
108
|
+
throw jsonrpc_errors.invalid_params('a header line must be `Name: value` in bytes', {
|
|
109
|
+
reason: ERROR_TESTING_CREDENTIAL_READ_LINE
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const lower_name = name.toLowerCase();
|
|
113
|
+
let values = by_name.get(lower_name);
|
|
114
|
+
if (!values)
|
|
115
|
+
by_name.set(lower_name, (values = []));
|
|
116
|
+
values.push(trim_optional_whitespace(line.slice(colon + 1)));
|
|
117
|
+
}
|
|
118
|
+
return (lower_name) => by_name.get(lower_name) ?? [];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Answer one `_testing_credential_read` input: read each credential out of
|
|
122
|
+
* the lines with the readers the auth middleware legs call
|
|
123
|
+
* (`read_session_cookie_value` then `process_session_cookie`,
|
|
124
|
+
* `read_bearer_token`, `read_daemon_token`). The action handler and the
|
|
125
|
+
* conformance table's unit test both call this, so the table checks the same
|
|
126
|
+
* functions the wire serves.
|
|
127
|
+
*
|
|
128
|
+
* @param input - the header lines
|
|
129
|
+
* @param deps - the keyring and session options the cookie is verified with
|
|
130
|
+
* @returns the reading the Rust twin returns for the same lines
|
|
131
|
+
* @throws ThrownJsonrpcError `invalid_params` for a line `parse_testing_header_lines` refuses
|
|
132
|
+
*/
|
|
133
|
+
export const run_testing_credential_read = async (input, deps) => {
|
|
134
|
+
const header = parse_testing_header_lines(input.lines);
|
|
135
|
+
const session = await process_session_cookie(read_session_cookie_value(header('cookie'), deps.session_options.cookie_name), deps.keyring, deps.session_options);
|
|
136
|
+
return {
|
|
137
|
+
session_cookie: session.valid ? 'valid' : session.action === 'clear' ? 'invalid' : 'absent',
|
|
138
|
+
bearer_token: read_bearer_token(header('authorization')),
|
|
139
|
+
daemon_token: read_daemon_token(header(DAEMON_TOKEN_HEADER.toLowerCase()))
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* `_testing_credential_read` — read the three credentials out of a list of
|
|
144
|
+
* header lines, so the shared conformance table
|
|
145
|
+
* (`credential_conformance.json`) checks each backend's header grammar over
|
|
146
|
+
* the wire, row by row. Pure: no database, no state beyond the server's
|
|
147
|
+
* keyring and cookie name. The Rust mirror is
|
|
148
|
+
* `fuz_testing::create_testing_credential_read_action_spec`.
|
|
149
|
+
*
|
|
150
|
+
* Like `_testing_origin_check`, it is **not** bundled by
|
|
151
|
+
* `create_testing_actions`: a consumer whose Rust binary doesn't mount the
|
|
152
|
+
* mirror would fail its action-manifest parity gate. The spine test binary
|
|
153
|
+
* appends it at the full-mount layer (`build_full_spine_rpc_actions`).
|
|
154
|
+
*
|
|
155
|
+
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
156
|
+
*/
|
|
157
|
+
export const testing_credential_read_action_spec = {
|
|
158
|
+
method: '_testing_credential_read',
|
|
159
|
+
kind: 'request_response',
|
|
160
|
+
initiator: 'frontend',
|
|
161
|
+
auth: TESTING_ACTION_AUTH,
|
|
162
|
+
side_effects: false,
|
|
163
|
+
input: TestingCredentialReadInput,
|
|
164
|
+
output: TestingCredentialReadOutput,
|
|
165
|
+
async: true,
|
|
166
|
+
error_reasons: [ERROR_TESTING_CREDENTIAL_READ_LINE],
|
|
167
|
+
description: 'Test-binary only — read the session cookie, bearer token and daemon token out of ' +
|
|
168
|
+
'{lines}, for the cross-impl credential conformance table.'
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Build the standalone `_testing_credential_read` action (see the spec doc).
|
|
172
|
+
*
|
|
173
|
+
* @param deps - the server's keyring and session options
|
|
174
|
+
*/
|
|
175
|
+
export const create_testing_credential_read_action = (deps) => rpc_action(testing_credential_read_action_spec, (input) => run_testing_credential_read(input, deps));
|
|
@@ -552,6 +552,25 @@ export declare const testing_shorten_credential_expiry_action_spec: {
|
|
|
552
552
|
readonly async: true;
|
|
553
553
|
readonly description: string;
|
|
554
554
|
};
|
|
555
|
+
/**
|
|
556
|
+
* The writes behind `_testing_shorten_credential_expiry`: every `auth_session`
|
|
557
|
+
* and `api_token` row of the account gets `LEAST(expires_at, NOW() + seconds)`,
|
|
558
|
+
* so nothing moves later and an eternal token gains an expiry.
|
|
559
|
+
*
|
|
560
|
+
* Shared by the action and the in-process fixture's `mint_expired_token`, so
|
|
561
|
+
* both fixtures expire a token with one statement. Unbounded here; the
|
|
562
|
+
* action's input holds `seconds` to its range.
|
|
563
|
+
*
|
|
564
|
+
* @param db - the database, a request transaction or the pool
|
|
565
|
+
* @param account_id - the account whose credentials expire
|
|
566
|
+
* @param seconds - the new expiry's offset from the database's `NOW()`
|
|
567
|
+
* @returns how many sessions and API tokens the statement rewrote
|
|
568
|
+
* @mutates `auth_session` and `api_token` - the account's rows' `expires_at`
|
|
569
|
+
*/
|
|
570
|
+
export declare const query_shorten_credential_expiry: (db: Db, account_id: string, seconds: number) => Promise<{
|
|
571
|
+
sessions: number;
|
|
572
|
+
api_tokens: number;
|
|
573
|
+
}>;
|
|
555
574
|
/** Build the standalone `_testing_shorten_credential_expiry` action (see the spec doc). */
|
|
556
575
|
export declare const create_testing_shorten_credential_expiry_action: () => RpcAction;
|
|
557
576
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmF9B,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAK3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAInE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAsBzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;QAiBpC;;;;;;;;WAQG;;;;;;;;;;;;;;;QAMH,4EAA4E;;;;;;;;;;;;;;;;;CAMhC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;CA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E,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,2BAA2B,KAClC,KAAK,CAAC,SAAS,CAwJjB,CAAC"}
|
|
@@ -574,13 +574,29 @@ export const testing_shorten_credential_expiry_action_spec = {
|
|
|
574
574
|
description: "Test-binary only — pull an account's session and API token expiries in to seconds from " +
|
|
575
575
|
'now (shorten-only), for the cross-impl credential-deadline cases.'
|
|
576
576
|
};
|
|
577
|
-
/**
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
577
|
+
/**
|
|
578
|
+
* The writes behind `_testing_shorten_credential_expiry`: every `auth_session`
|
|
579
|
+
* and `api_token` row of the account gets `LEAST(expires_at, NOW() + seconds)`,
|
|
580
|
+
* so nothing moves later and an eternal token gains an expiry.
|
|
581
|
+
*
|
|
582
|
+
* Shared by the action and the in-process fixture's `mint_expired_token`, so
|
|
583
|
+
* both fixtures expire a token with one statement. Unbounded here; the
|
|
584
|
+
* action's input holds `seconds` to its range.
|
|
585
|
+
*
|
|
586
|
+
* @param db - the database, a request transaction or the pool
|
|
587
|
+
* @param account_id - the account whose credentials expire
|
|
588
|
+
* @param seconds - the new expiry's offset from the database's `NOW()`
|
|
589
|
+
* @returns how many sessions and API tokens the statement rewrote
|
|
590
|
+
* @mutates `auth_session` and `api_token` - the account's rows' `expires_at`
|
|
591
|
+
*/
|
|
592
|
+
export const query_shorten_credential_expiry = async (db, account_id, seconds) => {
|
|
593
|
+
const params = [account_id, seconds];
|
|
594
|
+
const sessions = await db.query(`UPDATE auth_session SET expires_at = ${SHORTEN_EXPIRES_AT_SQL} WHERE account_id = $1 RETURNING id`, params);
|
|
595
|
+
const api_tokens = await db.query(`UPDATE api_token SET expires_at = ${SHORTEN_EXPIRES_AT_SQL} WHERE account_id = $1 RETURNING id`, params);
|
|
582
596
|
return { sessions: sessions.length, api_tokens: api_tokens.length };
|
|
583
|
-
}
|
|
597
|
+
};
|
|
598
|
+
/** Build the standalone `_testing_shorten_credential_expiry` action (see the spec doc). */
|
|
599
|
+
export const create_testing_shorten_credential_expiry_action = () => rpc_action(testing_shorten_credential_expiry_action_spec, async (input, ctx) => query_shorten_credential_expiry(ctx.db, input.account_id, input.seconds));
|
|
584
600
|
/**
|
|
585
601
|
* `_testing_action_manifest` — dump the backend's live RPC method set as a
|
|
586
602
|
* normalized `ActionManifest` (one entry per method: `{method, input,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/token_lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/token_lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqF9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC7C,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAsBD,eAAO,MAAM,mCAAmC,GAC/C,SAAS,6BAA6B,KACpC,IAqbF,CAAC"}
|
|
@@ -47,8 +47,17 @@ import '../assert_dev_env.js';
|
|
|
47
47
|
* daemon token and a bearer never validates the bearer: its
|
|
48
48
|
* `last_used_at` stays `null`. A spine resolving the bearer first (or both)
|
|
49
49
|
* bumps it. The positive control is a second token used alone, read back
|
|
50
|
-
* with a `last_used_at` — sent after the first request, so
|
|
51
|
-
* is visible the first's
|
|
50
|
+
* with a `last_used_at` — sent after the first request, so by the time its
|
|
51
|
+
* touch is visible the first's has had longer to land (the touches are
|
|
52
|
+
* independent writes; nothing stronger orders them).
|
|
53
|
+
* - **A token sent beside a winning session is never used** — the session
|
|
54
|
+
* leg runs ahead of the bearer leg, so a request carrying one account's
|
|
55
|
+
* session cookie and another account's bearer, with no `Origin` to discard
|
|
56
|
+
* the bearer as browser context, acts as the session's account and leaves
|
|
57
|
+
* the bearer's `last_used_at` `null`. The session is proven alone first; a
|
|
58
|
+
* second token sent alone after the combined request is the control, its
|
|
59
|
+
* touch landing; and the token sent beside the session, used alone last,
|
|
60
|
+
* authenticates as its own account, so it was live all along.
|
|
52
61
|
* - **An invalid daemon token falls through to the bearer beside it** — the
|
|
53
62
|
* daemon leg soft-fails a token that is not the current one, so the bearer
|
|
54
63
|
* leg still runs: the request authenticates on the token, which records its
|
|
@@ -174,6 +183,53 @@ export const describe_token_lifetime_cross_tests = (options) => {
|
|
|
174
183
|
assert.notStrictEqual(after.get(alone.id), null, 'a bearer used alone records its last use (the positive control)');
|
|
175
184
|
assert.strictEqual(after.get(beside.id), null, 'a bearer sent beside a winning daemon token is never validated, so never touched');
|
|
176
185
|
});
|
|
186
|
+
test('a token sent beside a winning session is never used; the request acts as the session’s account', async () => {
|
|
187
|
+
const fixture = await setup_test();
|
|
188
|
+
const session_account = await fixture.create_account({ username: 'lifetime_by_session' });
|
|
189
|
+
const bearer_account = await fixture.create_account({ username: 'lifetime_by_bearer' });
|
|
190
|
+
/** Mint a token on the bearer account over its session. */
|
|
191
|
+
const mint = async (name) => expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, account_token_create_action_spec.method, { name, scope: { kind: 'full' }, lifetime: { kind: 'eternal' } }, bearer_account.create_session_headers()), TokenCreateOutput);
|
|
192
|
+
/** The bearer account's tokens' `last_used_at`, by id. */
|
|
193
|
+
const read_last_used = async () => {
|
|
194
|
+
const listed = expect_output(await cross_rpc_call(fixture.fresh_transport(), rpc_path, account_token_list_action_spec.method, undefined, bearer_account.create_session_headers()), TokenListOutput);
|
|
195
|
+
return new Map(listed.tokens.map((t) => [t.id, t.last_used_at]));
|
|
196
|
+
};
|
|
197
|
+
/** `account_verify` over a cookie-free, `Origin`-free transport. */
|
|
198
|
+
const verify = (headers) => cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, 'account_verify', undefined, headers);
|
|
199
|
+
const beside = await mint('beside-session');
|
|
200
|
+
const alone = await mint('used-alone');
|
|
201
|
+
const before = await read_last_used();
|
|
202
|
+
assert.strictEqual(before.get(beside.id), null, 'a fresh token is unused');
|
|
203
|
+
assert.strictEqual(before.get(alone.id), null, 'a fresh token is unused');
|
|
204
|
+
// the session cookie alone, with no `Origin` — a bearer beside one is
|
|
205
|
+
// discarded as browser context, which would hide the leg order
|
|
206
|
+
const { origin: _, ...session_headers } = session_account.create_session_headers();
|
|
207
|
+
const on_session = await verify(session_headers);
|
|
208
|
+
assert.ok(on_session.ok, 'the session alone authenticates');
|
|
209
|
+
assert.strictEqual(on_session.result.id, session_account.account.id, 'the session authenticates as its own account');
|
|
210
|
+
// one request carrying the session and the other account's bearer
|
|
211
|
+
const both = await verify({ ...session_headers, authorization: `Bearer ${beside.token}` });
|
|
212
|
+
assert.ok(both.ok, 'the request with both credentials authenticates');
|
|
213
|
+
assert.strictEqual(both.result.id, session_account.account.id, 'the session leg wins: the request acts as the session’s account');
|
|
214
|
+
// the positive control, sent after it: the bearer alone is used, and
|
|
215
|
+
// authenticates as its own account
|
|
216
|
+
const on_bearer = await verify({ authorization: `Bearer ${alone.token}` });
|
|
217
|
+
assert.ok(on_bearer.ok, 'the bearer alone authenticates');
|
|
218
|
+
assert.strictEqual(on_bearer.result.id, bearer_account.account.id, 'the bearer authenticates as its own account');
|
|
219
|
+
// the touch is fire-and-forget on both spines, so wait for the control's
|
|
220
|
+
const deadline = Date.now() + LAST_USED_WAIT_MS;
|
|
221
|
+
let after = await read_last_used();
|
|
222
|
+
while (after.get(alone.id) === null && Date.now() < deadline) {
|
|
223
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
224
|
+
after = await read_last_used();
|
|
225
|
+
}
|
|
226
|
+
assert.notStrictEqual(after.get(alone.id), null, 'a bearer used alone records its last use (the positive control)');
|
|
227
|
+
assert.strictEqual(after.get(beside.id), null, 'a bearer sent beside a winning session is never validated, so never touched');
|
|
228
|
+
// and it was live all along: alone, it authenticates as its account
|
|
229
|
+
const beside_alone = await verify({ authorization: `Bearer ${beside.token}` });
|
|
230
|
+
assert.ok(beside_alone.ok, 'the token sent beside the session is live');
|
|
231
|
+
assert.strictEqual(beside_alone.result.id, bearer_account.account.id);
|
|
232
|
+
});
|
|
177
233
|
test('an invalid daemon token falls through to the bearer beside it', async () => {
|
|
178
234
|
const fixture = await setup_test();
|
|
179
235
|
const minted = expect_output(await cross_rpc_call(fixture.transport, rpc_path, account_token_create_action_spec.method, { name: 'beside-bad-daemon', scope: { kind: 'full' }, lifetime: { kind: 'eternal' } }, fixture.create_session_headers()), TokenCreateOutput);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { type BackendCapabilities } from './capabilities.js';
|
|
3
3
|
import type { RpcPathCapabilityGatedCrossSuiteOptions, SetupTest } from './setup.js';
|
|
4
|
+
import { type XfailMarker } from './xfail.js';
|
|
4
5
|
/** A transport's front door, as the table's rows name it. */
|
|
5
6
|
export type TransportCompositionSurface = 'rest_post' | 'rest_password' | 'rpc_post' | 'rpc_get' | 'ws_upgrade' | 'sse';
|
|
6
7
|
/** What a probe sends, as the table's columns name it. */
|
|
@@ -35,10 +36,7 @@ export interface TransportCompositionMultiActorOptions {
|
|
|
35
36
|
/** Per-test fixture whose keeper is seeded with at least one `extra_actors` entry. */
|
|
36
37
|
readonly setup_test: SetupTest;
|
|
37
38
|
/** Run the multi-actor rows as `xfail_until` — for a backend known to admit them. */
|
|
38
|
-
readonly xfail?:
|
|
39
|
-
readonly tracking_id: string;
|
|
40
|
-
readonly reason: string;
|
|
41
|
-
};
|
|
39
|
+
readonly xfail?: XfailMarker;
|
|
42
40
|
}
|
|
43
41
|
/** Options for `describe_transport_composition_cross_tests`. */
|
|
44
42
|
export interface TransportCompositionCrossTestOptions extends RpcPathCapabilityGatedCrossSuiteOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport_composition.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/transport_composition.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuG9B,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,uCAAuC,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"transport_composition.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/transport_composition.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuG9B,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,KAAK,EAAE,uCAAuC,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AASlG,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3D,6DAA6D;AAC7D,MAAM,MAAM,2BAA2B,GACtC,WAAW,GAAG,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,CAAC;AAE/E,0DAA0D;AAC1D,MAAM,MAAM,yBAAyB,GAClC,gBAAgB,GAChB,mBAAmB,GACnB,mBAAmB,GACnB,yBAAyB,GACzB,eAAe,GACf,gBAAgB,GAChB,uBAAuB,CAAC;AAE3B,kCAAkC;AAClC,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,8FAA8F;IA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CAAC;CACrC;AAqED;;;;;;;GAOG;AACH,eAAO,MAAM,0CAA0C,GACtD,SAAS,oCAAoC,KAC3C,IA6PF,CAAC"}
|
|
@@ -39,8 +39,8 @@ import '../assert_dev_env.js';
|
|
|
39
39
|
* - **no credential** sends an allowed `Origin` and nothing else.
|
|
40
40
|
* - **WS path, no upgrade** is a `GET` on the WebSocket path with no
|
|
41
41
|
* `Upgrade` header: the gates answer it as they answer an upgrade, and one
|
|
42
|
-
* they admit is
|
|
43
|
-
* table).
|
|
42
|
+
* they admit is the JSON `route_not_found` 404; any method but `GET` is the
|
|
43
|
+
* 405 (its own cases below the table).
|
|
44
44
|
* - **narrowed token** sends a bearer minted with a method-scoped scope, and no
|
|
45
45
|
* `Origin` (a bearer in a browser context is discarded, not refused). The RPC
|
|
46
46
|
* probe calls a method the scope doesn't name. A narrowed token reaches no
|
|
@@ -208,7 +208,7 @@ const assert_refusal_body = (c, body, text) => {
|
|
|
208
208
|
assert.strictEqual(refusal.error, c.expect.error, `${label}: body.error`);
|
|
209
209
|
}
|
|
210
210
|
for (const [key, expected] of Object.entries(c.expect.fields ?? {})) {
|
|
211
|
-
assert.deepStrictEqual(refusal[key], expected, `${label}: ${key}`);
|
|
211
|
+
assert.deepStrictEqual(refusal[key], expected, `${label}: ${key} (body: ${text})`);
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
/**
|
|
@@ -390,15 +390,17 @@ export const describe_transport_composition_cross_tests = (options) => {
|
|
|
390
390
|
test_if(is_runnable(c), case_name(c), () => run_case(c, setup_test));
|
|
391
391
|
}
|
|
392
392
|
// The WebSocket path serves `GET` alone, and its gates run before the
|
|
393
|
-
// upgrade is looked at: any other method is
|
|
394
|
-
// upgrade is refused by the gates like an
|
|
395
|
-
//
|
|
396
|
-
//
|
|
393
|
+
// upgrade is looked at: any other method is the 405 every routed path
|
|
394
|
+
// answers, a `GET` asking for no upgrade is refused by the gates like an
|
|
395
|
+
// upgrade is, and one the gates admit is the `route_not_found` 404 —
|
|
396
|
+
// never an upgrade refusal answered ahead of auth. None of them upgrades,
|
|
397
|
+
// so they run in-process too.
|
|
397
398
|
const ws_runnable = capabilities.ws;
|
|
398
|
-
test_if(ws_runnable, 'ws path × POST with a session →
|
|
399
|
+
test_if(ws_runnable, 'ws path × POST with a session → 405', async () => {
|
|
399
400
|
const fixture = await setup_test();
|
|
400
401
|
const res = await send_probe(fixture, ws_path_probe('POST', { ...fixture.create_session_headers(), origin: allowed_origin }));
|
|
401
|
-
assert.strictEqual(res.status,
|
|
402
|
+
assert.strictEqual(res.status, 405, `body: ${res.text.slice(0, 200)}`);
|
|
403
|
+
assert.strictEqual(raw_http_parse_json(res.text)?.error, 'method_not_allowed');
|
|
402
404
|
});
|
|
403
405
|
test_if(ws_runnable, 'ws path × GET without upgrade, no credential → 401', async () => {
|
|
404
406
|
const fixture = await setup_test();
|
|
@@ -415,6 +417,7 @@ export const describe_transport_composition_cross_tests = (options) => {
|
|
|
415
417
|
const fixture = await setup_test();
|
|
416
418
|
const res = await send_probe(fixture, ws_path_probe('GET', { ...fixture.create_session_headers(), origin: allowed_origin }));
|
|
417
419
|
assert.strictEqual(res.status, 404, `body: ${res.text.slice(0, 200)}`);
|
|
420
|
+
assert.strictEqual(raw_http_parse_json(res.text)?.error, 'route_not_found');
|
|
418
421
|
});
|
|
419
422
|
const { multi_actor } = options;
|
|
420
423
|
if (!multi_actor)
|
|
@@ -426,7 +429,7 @@ export const describe_transport_composition_cross_tests = (options) => {
|
|
|
426
429
|
test_if(false, name, body);
|
|
427
430
|
}
|
|
428
431
|
else if (multi_actor.xfail) {
|
|
429
|
-
xfail_until(multi_actor.xfail
|
|
432
|
+
xfail_until(multi_actor.xfail, name, body);
|
|
430
433
|
}
|
|
431
434
|
else {
|
|
432
435
|
test(name, body);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts_spine_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ts_spine_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ts_spine_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ts_spine_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA4EzD,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,wDAAwD,CAAC;AAEzF,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,uDAAuD,CAAC;AAEvF,MAAM,WAAW,2BAA2B;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAWD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAS,2BAAgC,KACvC,aAyBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACvC,UAAS,2BAAgC,KACvC,aAyBF,CAAC"}
|
|
@@ -42,8 +42,9 @@ const ts_spine_capabilities = Object.freeze({
|
|
|
42
42
|
});
|
|
43
43
|
/**
|
|
44
44
|
* Capabilities for the **Bun** spine binary — `ts_spine_capabilities` with
|
|
45
|
-
* `ws_handshake_pipelining: false
|
|
46
|
-
* sends a refused upgrade's response as built)
|
|
45
|
+
* `ws_handshake_pipelining: false`, `ws_refusal_body: true` (`Bun.serve`
|
|
46
|
+
* sends a refused upgrade's response as built) and no
|
|
47
|
+
* `ws_upgrade_runtime_refusals` (the host gate answers an empty `Host`).
|
|
47
48
|
*
|
|
48
49
|
* `Bun.serve` answers `400` to an upgrade request that carries WebSocket
|
|
49
50
|
* frames in the same TCP write when the handler upgrades after an await that
|
|
@@ -56,7 +57,8 @@ const ts_spine_capabilities = Object.freeze({
|
|
|
56
57
|
const ts_spine_bun_capabilities = Object.freeze({
|
|
57
58
|
...ts_spine_capabilities,
|
|
58
59
|
ws_handshake_pipelining: false,
|
|
59
|
-
ws_refusal_body: true
|
|
60
|
+
ws_refusal_body: true,
|
|
61
|
+
ws_upgrade_runtime_refusals: Object.freeze([])
|
|
60
62
|
});
|
|
61
63
|
/** Default port for the Node TS spine binary — slots beside the Rust `spine_stub` (1177). */
|
|
62
64
|
export const TS_SPINE_NODE_DEFAULT_PORT = 1178;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { type WsTransportClient, type WsTransportOptions } from '../transports/ws_transport.js';
|
|
2
|
+
import { WsUpgradeRefusedError, type WsTransportClient, type WsTransportOptions } from '../transports/ws_transport.js';
|
|
3
3
|
/** Where a backend's WebSocket endpoint is. */
|
|
4
4
|
export interface WsEndpointTarget {
|
|
5
5
|
/** Base URL the backend is reachable at (e.g. `http://localhost:1178`). */
|
|
@@ -48,4 +48,14 @@ export declare const to_session_cookie: (account: WsSessionAccount) => string;
|
|
|
48
48
|
* the admission heartbeat) fails
|
|
49
49
|
*/
|
|
50
50
|
export declare const open_session_ws: (target: WsEndpointTarget, account: WsSessionAccount, options: OpenSessionWsOptions) => Promise<WsTransportClient>;
|
|
51
|
+
/**
|
|
52
|
+
* Assert `open` fails as an upgrade the server refused with `status` — not a
|
|
53
|
+
* network error, and not a refusal at another status. Matching the status on
|
|
54
|
+
* the error's message would also match a port or path in the URL it names.
|
|
55
|
+
*
|
|
56
|
+
* @param open - opens the socket the server must refuse
|
|
57
|
+
* @param status - the refusal's expected HTTP status
|
|
58
|
+
* @returns the refusal, for a case asserting its body
|
|
59
|
+
*/
|
|
60
|
+
export declare const assert_ws_upgrade_refused: (open: () => Promise<unknown>, status: number) => Promise<WsUpgradeRefusedError>;
|
|
51
61
|
//# sourceMappingURL=ws_endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_endpoint.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ws_endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ws_endpoint.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ws_endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,EAGN,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,+BAA+B,CAAC;AAEvC,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5F;AAED,qCAAqC;AACrC,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CACjD,kBAAkB,EAClB,oBAAoB,GAAG,YAAY,GAAG,SAAS,CAC/C;IACA;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,gBAAgB,KAAG,MAI7D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAC3B,QAAQ,gBAAgB,EACxB,SAAS,gBAAgB,EACzB,SAAS,oBAAoB,KAC3B,OAAO,CAAC,iBAAiB,CAU3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,MAAM,OAAO,CAAC,OAAO,CAAC,EAC5B,QAAQ,MAAM,KACZ,OAAO,CAAC,qBAAqB,CAQ/B,CAAC"}
|
|
@@ -7,14 +7,16 @@ import '../assert_dev_env.js';
|
|
|
7
7
|
* options (flat, or nested as `ws` on a suite whose socket cases are
|
|
8
8
|
* optional), and open a socket on a fixture account's session through
|
|
9
9
|
* `open_session_ws`, so the cookie read, the missing-cookie assertion and the
|
|
10
|
-
* transport choice are written once.
|
|
10
|
+
* transport choice are written once. A refused upgrade is asserted at its
|
|
11
|
+
* status with `assert_ws_upgrade_refused`. Sockets on another credential — a daemon
|
|
11
12
|
* token, a bearer, a session a case logged in on its own transport — and the
|
|
12
13
|
* raw-socket cases open their own way.
|
|
13
14
|
*
|
|
14
15
|
* @module
|
|
15
16
|
*/
|
|
16
17
|
import { assert } from 'vitest';
|
|
17
|
-
import {
|
|
18
|
+
import { assert_rejects } from '@fuzdev/fuz_util/testing.ts';
|
|
19
|
+
import { create_admitted_ws_transport, create_ws_transport, WsUpgradeRefusedError } from '../transports/ws_transport.js';
|
|
18
20
|
/**
|
|
19
21
|
* The account's session cookie (`<name>=<value>`), asserted present.
|
|
20
22
|
*
|
|
@@ -52,3 +54,18 @@ export const open_session_ws = (target, account, options) => {
|
|
|
52
54
|
...transport_options
|
|
53
55
|
});
|
|
54
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Assert `open` fails as an upgrade the server refused with `status` — not a
|
|
59
|
+
* network error, and not a refusal at another status. Matching the status on
|
|
60
|
+
* the error's message would also match a port or path in the URL it names.
|
|
61
|
+
*
|
|
62
|
+
* @param open - opens the socket the server must refuse
|
|
63
|
+
* @param status - the refusal's expected HTTP status
|
|
64
|
+
* @returns the refusal, for a case asserting its body
|
|
65
|
+
*/
|
|
66
|
+
export const assert_ws_upgrade_refused = async (open, status) => {
|
|
67
|
+
const error = await assert_rejects(open);
|
|
68
|
+
assert.ok(error instanceof WsUpgradeRefusedError, `expected the upgrade refused with ${status}, got: ${error.message}`);
|
|
69
|
+
assert.strictEqual(error.status, status, `refusal body: ${error.body.slice(0, 200)}`);
|
|
70
|
+
return error;
|
|
71
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_role_gated.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ws_role_gated.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ws_role_gated.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ws_role_gated.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsC9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAMtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAK1B,8DAA8D;AAC9D,MAAM,WAAW,2BAA4B,SAAQ,gBAAgB;IACpE,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,8CAA8C;IAC9C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kCAAkC,GAAI,SAAS,2BAA2B,KAAG,IA+HzF,CAAC"}
|
|
@@ -24,7 +24,6 @@ import '../assert_dev_env.js';
|
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
26
26
|
import { assert, describe } from 'vitest';
|
|
27
|
-
import { assert_rejects } from '@fuzdev/fuz_util/testing.ts';
|
|
28
27
|
import { heartbeat_action_spec } from '../../actions/heartbeat.js';
|
|
29
28
|
import { WS_CLOSE_PERMISSION_REVOKED, WS_CLOSE_PERMISSION_REVOKED_REASON } from '../../actions/transports.js';
|
|
30
29
|
import { ROLE_ADMIN } from '../../auth/role_schema.js';
|
|
@@ -34,7 +33,7 @@ import { is_notification_with } from '../transports/ws_client.js';
|
|
|
34
33
|
import { test_if } from './capabilities.js';
|
|
35
34
|
import { create_active_role_grant, create_pending_role_grant_offer } from './role_grant_cross_helpers.js';
|
|
36
35
|
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
37
|
-
import { open_session_ws } from './ws_endpoint.js';
|
|
36
|
+
import { assert_ws_upgrade_refused, open_session_ws } from './ws_endpoint.js';
|
|
38
37
|
/** How long a socket that must stay open is watched for a close it must not get. */
|
|
39
38
|
const STAYS_OPEN_MS = 1500;
|
|
40
39
|
/**
|
|
@@ -88,7 +87,7 @@ export const describe_ws_role_gated_cross_tests = (options) => {
|
|
|
88
87
|
assert.strictEqual(ungated.close_code, null);
|
|
89
88
|
assert.deepStrictEqual(await ungated.request(2, heartbeat_action_spec.method, {}), {});
|
|
90
89
|
// and the gate refuses the account a new gated socket
|
|
91
|
-
await
|
|
90
|
+
await assert_ws_upgrade_refused(() => open_session_ws(gated_target, target, { admitted: false }), 403);
|
|
92
91
|
}
|
|
93
92
|
finally {
|
|
94
93
|
await gated.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_round_trip.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ws_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ws_round_trip.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ws_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwH9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAItE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAKzD,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAK1B,2DAA2D;AAC3D,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IAClE;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,wFAAwF;IACxF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,4FAA4F;IAC5F,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAClD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,yBAAyB,KAAG,IA4epF,CAAC"}
|