@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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the raw-socket conformance suites share: the accounts that name a
|
|
4
|
+
* credential, the raw `account_verify` request and upgrade they send, and how
|
|
5
|
+
* they read which credential an answer is for.
|
|
6
|
+
*
|
|
7
|
+
* Each of the three credentials belongs to a different account — the session
|
|
8
|
+
* cookie and the API token to two seeded `extra_accounts`, the daemon token to
|
|
9
|
+
* the keeper — so the account `account_verify` answers as names the
|
|
10
|
+
* credential that authenticated, and a 401 names none.
|
|
11
|
+
* `credential_conformance_wire.ts` and `request_header_conformance_wire.ts`
|
|
12
|
+
* read their rows' outcomes this way.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { assert } from 'vitest';
|
|
17
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
|
+
import { SessionAccountJson } from '../../auth/account_schema.js';
|
|
19
|
+
import { CREDENTIAL_TYPE_API_TOKEN, CREDENTIAL_TYPE_DAEMON_TOKEN, CREDENTIAL_TYPE_SESSION } from '../../auth/credential_type_schema.js';
|
|
20
|
+
import { ROLE_ADMIN, ROLE_KEEPER } from '../../auth/role_schema.js';
|
|
21
|
+
import { JSONRPC_ERROR_CODES } from '../../http/jsonrpc_errors.js';
|
|
22
|
+
import { raw_http_exchange, raw_http_parse_json, raw_http_parse_response, raw_http_request, RAW_HTTP_READ_TIMEOUT_MS } from '../transports/raw_http.js';
|
|
23
|
+
import { is_raw_ws_close, RAW_WS_OPCODE_TEXT } from '../transports/ws_raw_client.js';
|
|
24
|
+
/**
|
|
25
|
+
* The `extra_accounts` username whose session cookie the suites send. Their
|
|
26
|
+
* `setup_test` must seed it, with `CREDENTIAL_SESSION_ACCOUNT_PASSWORD`.
|
|
27
|
+
*/
|
|
28
|
+
export const CREDENTIAL_SESSION_ACCOUNT_USERNAME = 'credential_session';
|
|
29
|
+
/**
|
|
30
|
+
* The password the `CREDENTIAL_SESSION_ACCOUNT_USERNAME` account is seeded
|
|
31
|
+
* with (`ExtraAccountSpec.password_value`) — the credential suite's login
|
|
32
|
+
* case signs in as it.
|
|
33
|
+
*/
|
|
34
|
+
export const CREDENTIAL_SESSION_ACCOUNT_PASSWORD = 'credential-session-password';
|
|
35
|
+
/**
|
|
36
|
+
* The `extra_accounts` username whose API token the suites send. Their
|
|
37
|
+
* `setup_test` must seed it.
|
|
38
|
+
*/
|
|
39
|
+
export const CREDENTIAL_BEARER_ACCOUNT_USERNAME = 'credential_bearer';
|
|
40
|
+
/**
|
|
41
|
+
* The seeding the credential suites need: the two accounts, each holding
|
|
42
|
+
* `ws_required_roles` so it can open a socket where the upgrade is
|
|
43
|
+
* role-gated, and the keeper behind the daemon token holding them too.
|
|
44
|
+
*
|
|
45
|
+
* @param ws_required_roles - the roles the backend's WebSocket upgrade requires
|
|
46
|
+
*/
|
|
47
|
+
export const create_credential_wire_seed = (ws_required_roles = []) => ({
|
|
48
|
+
// the keeper already holds the builtin roles
|
|
49
|
+
extra_keeper_roles: ws_required_roles.filter((role) => role !== ROLE_KEEPER && role !== ROLE_ADMIN),
|
|
50
|
+
extra_accounts: [
|
|
51
|
+
{
|
|
52
|
+
username: CREDENTIAL_SESSION_ACCOUNT_USERNAME,
|
|
53
|
+
password_value: CREDENTIAL_SESSION_ACCOUNT_PASSWORD,
|
|
54
|
+
roles: [...ws_required_roles]
|
|
55
|
+
},
|
|
56
|
+
{ username: CREDENTIAL_BEARER_ACCOUNT_USERNAME, roles: [...ws_required_roles] }
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
/** A credential reading for a failure message. */
|
|
60
|
+
export const format_authenticated_credential = (credential) => typeof credential === 'object' && credential !== null
|
|
61
|
+
? credential.unexpected
|
|
62
|
+
: String(credential);
|
|
63
|
+
/**
|
|
64
|
+
* The fixture's three credential accounts.
|
|
65
|
+
*
|
|
66
|
+
* @throws AssertionError when the fixture lacks the seeded accounts, or two credentials share one
|
|
67
|
+
*/
|
|
68
|
+
export const read_credential_wire_accounts = (fixture) => {
|
|
69
|
+
const session = fixture.extra_accounts[CREDENTIAL_SESSION_ACCOUNT_USERNAME];
|
|
70
|
+
const bearer = fixture.extra_accounts[CREDENTIAL_BEARER_ACCOUNT_USERNAME];
|
|
71
|
+
assert.ok(session && bearer, `the suite's setup_test must seed the extra_accounts '${CREDENTIAL_SESSION_ACCOUNT_USERNAME}' ` +
|
|
72
|
+
`and '${CREDENTIAL_BEARER_ACCOUNT_USERNAME}'`);
|
|
73
|
+
const ids = new Set([session.account.id, bearer.account.id, fixture.account.id]);
|
|
74
|
+
assert.strictEqual(ids.size, 3, 'the three credentials belong to three accounts');
|
|
75
|
+
return { session, bearer, keeper_id: fixture.account.id };
|
|
76
|
+
};
|
|
77
|
+
/** The id of the `account_verify` call the suites send. */
|
|
78
|
+
export const CREDENTIAL_WIRE_VERIFY_ID = 'credential';
|
|
79
|
+
/** The `account_verify` call the suites send — an RPC body, and a socket frame. */
|
|
80
|
+
export const CREDENTIAL_WIRE_VERIFY_BODY = JSON.stringify({
|
|
81
|
+
jsonrpc: '2.0',
|
|
82
|
+
id: CREDENTIAL_WIRE_VERIFY_ID,
|
|
83
|
+
method: 'account_verify'
|
|
84
|
+
});
|
|
85
|
+
/** An upgrade request's own header lines, with RFC 6455's sample key. */
|
|
86
|
+
export const WS_UPGRADE_HEADER_LINES = [
|
|
87
|
+
'Connection: Upgrade',
|
|
88
|
+
'Upgrade: websocket',
|
|
89
|
+
'Sec-WebSocket-Version: 13',
|
|
90
|
+
'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ=='
|
|
91
|
+
];
|
|
92
|
+
/** How long an accepted socket has to answer its `account_verify` frame. */
|
|
93
|
+
const VERIFY_FRAME_TIMEOUT_MS = 5_000;
|
|
94
|
+
/**
|
|
95
|
+
* The credential an `account_verify` envelope names, by the account it
|
|
96
|
+
* answers as.
|
|
97
|
+
*
|
|
98
|
+
* @param suite - the calling suite, named in the throw
|
|
99
|
+
* @throws Error when the backend has no `account_verify` there — a missing requirement, not a row's failure
|
|
100
|
+
*/
|
|
101
|
+
export const credential_of_verify_envelope = (envelope, accounts, where, suite) => {
|
|
102
|
+
const { result, error } = (envelope ?? {});
|
|
103
|
+
if (error?.code === JSONRPC_ERROR_CODES.method_not_found) {
|
|
104
|
+
throw new Error(`${suite}: the backend answers method_not_found for account_verify on ${where} — ` +
|
|
105
|
+
'the suite reads which credential authenticated from it');
|
|
106
|
+
}
|
|
107
|
+
const account = parse(SessionAccountJson, result);
|
|
108
|
+
if (!account.ok)
|
|
109
|
+
return { unexpected: 'an answer whose result is no account' };
|
|
110
|
+
switch (account.value.id) {
|
|
111
|
+
case accounts.session.account.id:
|
|
112
|
+
return CREDENTIAL_TYPE_SESSION;
|
|
113
|
+
case accounts.bearer.account.id:
|
|
114
|
+
return CREDENTIAL_TYPE_API_TOKEN;
|
|
115
|
+
case accounts.keeper_id:
|
|
116
|
+
return CREDENTIAL_TYPE_DAEMON_TOKEN;
|
|
117
|
+
default:
|
|
118
|
+
return { unexpected: 'an account behind none of the three credentials' };
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* `POST` `account_verify` to `rpc_path` carrying `header_lines` (and
|
|
123
|
+
* `Connection: close`), read until the server closes.
|
|
124
|
+
*/
|
|
125
|
+
export const send_raw_verify = async (request) => {
|
|
126
|
+
const { received } = await raw_http_exchange(request.base_url, raw_http_request({
|
|
127
|
+
method: 'POST',
|
|
128
|
+
path: request.rpc_path,
|
|
129
|
+
host: request.host,
|
|
130
|
+
header_lines: [...request.header_lines, 'Connection: close'],
|
|
131
|
+
body: CREDENTIAL_WIRE_VERIFY_BODY
|
|
132
|
+
}), { read_timeout_ms: RAW_HTTP_READ_TIMEOUT_MS });
|
|
133
|
+
return { received, response: raw_http_parse_response(received) };
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* The credential an RPC `account_verify` response names; `null` for a 401.
|
|
137
|
+
*
|
|
138
|
+
* @param suite - the calling suite, named in a throw
|
|
139
|
+
*/
|
|
140
|
+
export const credential_of_verify_response = (response, accounts, rpc_path, suite) => {
|
|
141
|
+
if (response.status === 401)
|
|
142
|
+
return null;
|
|
143
|
+
const envelope = raw_http_parse_json(response.body);
|
|
144
|
+
const credential = credential_of_verify_envelope(envelope, accounts, `the RPC endpoint (${rpc_path})`, suite);
|
|
145
|
+
if (response.status !== 200)
|
|
146
|
+
return { unexpected: `status ${response.status}` };
|
|
147
|
+
return credential;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Send a WebSocket upgrade to `ws_path` carrying `header_lines` after the
|
|
151
|
+
* upgrade's own lines, and read the first response — for an upgrade the
|
|
152
|
+
* caller expects refused.
|
|
153
|
+
*/
|
|
154
|
+
export const send_raw_upgrade = async (request) => {
|
|
155
|
+
const { received } = await raw_http_exchange(request.base_url, raw_http_request({
|
|
156
|
+
method: 'GET',
|
|
157
|
+
path: request.ws_path,
|
|
158
|
+
host: request.host,
|
|
159
|
+
header_lines: [...WS_UPGRADE_HEADER_LINES, ...request.header_lines]
|
|
160
|
+
}), { read_timeout_ms: RAW_HTTP_READ_TIMEOUT_MS, until: 'response' });
|
|
161
|
+
return { received, response: raw_http_parse_response(received) };
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Ask an accepted socket who it is: send `account_verify` and read the
|
|
165
|
+
* credential its answer names.
|
|
166
|
+
*
|
|
167
|
+
* @param suite - the calling suite, named in a throw
|
|
168
|
+
* @returns the credential, or why none could be read
|
|
169
|
+
*/
|
|
170
|
+
export const verify_socket_credential = async (client, accounts, ws_path, suite) => {
|
|
171
|
+
client.send_text(CREDENTIAL_WIRE_VERIFY_BODY);
|
|
172
|
+
let frame;
|
|
173
|
+
try {
|
|
174
|
+
frame = await client.wait_for((candidate) => is_raw_ws_close(candidate) ||
|
|
175
|
+
(candidate.opcode === RAW_WS_OPCODE_TEXT &&
|
|
176
|
+
raw_http_parse_json(candidate.payload.toString('utf-8'))
|
|
177
|
+
?.id === CREDENTIAL_WIRE_VERIFY_ID), VERIFY_FRAME_TIMEOUT_MS);
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return { failure: 'the accepted socket never answered account_verify' };
|
|
181
|
+
}
|
|
182
|
+
if (is_raw_ws_close(frame)) {
|
|
183
|
+
return { failure: 'the accepted socket closed instead of answering account_verify' };
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
credential: credential_of_verify_envelope(raw_http_parse_json(frame.payload.toString('utf-8')), accounts, `the WebSocket endpoint (${ws_path}), which capabilities.ws_account_actions says mounts it`, suite)
|
|
187
|
+
};
|
|
188
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_backend_configs.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/default_backend_configs.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiBlG;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,mBAAmB,MAAM,KAAG,MAS/D,CAAC;AAcF,2CAA2C;AAC3C,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACjD;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,yBAAyB,KAChC,MAAM,CAAC,MAAM,EAAE,MAAM,CAKtB,CAAC;AAEH,gCAAgC;AAChC,MAAM,WAAW,gBAAgB;IAChC,oFAAoF;IACpF,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,6EAA6E;IAC7E,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,iFAAiF;IACjF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,4FAA4F;IAC5F,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,gBAAgB,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAc1E,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"default_backend_configs.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/default_backend_configs.ts"],"names":[],"mappings":"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"}
|
|
@@ -120,7 +120,18 @@ export const ts_default_capabilities = Object.freeze({
|
|
|
120
120
|
ws_handshake_pipelining: true,
|
|
121
121
|
// `@hono/node-server` drops a refused upgrade's body, so a Node-served backend
|
|
122
122
|
// sends none. A Bun-served one overrides to `true`.
|
|
123
|
-
ws_refusal_body: false
|
|
123
|
+
ws_refusal_body: false,
|
|
124
|
+
// `@hono/node-server` answers an upgrade whose first `Host` line is empty
|
|
125
|
+
// with a bodiless 400 before the app runs. A Bun-served one overrides to `[]`.
|
|
126
|
+
ws_upgrade_runtime_refusals: Object.freeze(['empty_host']),
|
|
127
|
+
// Node builds the request's URL by the WHATWG parser, dot segments resolved;
|
|
128
|
+
// Bun does the same.
|
|
129
|
+
runtime_resolves_dot_segments: true,
|
|
130
|
+
// `create_app_server`'s unmatched-route handler answers outside `/api`
|
|
131
|
+
// unless the backend mounts a static fallback of its own there.
|
|
132
|
+
spine_fallback: true,
|
|
133
|
+
// `create_app_server` mounts the host gate unless `host_gate: false`.
|
|
134
|
+
host_gate: true
|
|
124
135
|
});
|
|
125
136
|
/**
|
|
126
137
|
* Capabilities for the Rust family — only what the family guarantees, as with
|
|
@@ -139,7 +150,16 @@ export const rust_default_capabilities = Object.freeze({
|
|
|
139
150
|
// stream, where they wait for the read loop that starts at admission.
|
|
140
151
|
ws_handshake_pipelining: true,
|
|
141
152
|
// axum sends a refused upgrade's response as built, body included.
|
|
142
|
-
ws_refusal_body: true
|
|
153
|
+
ws_refusal_body: true,
|
|
154
|
+
// hyper hands an upgrade with an empty `Host` to the host gate.
|
|
155
|
+
ws_upgrade_runtime_refusals: Object.freeze([]),
|
|
156
|
+
// axum routes the raw path, dot segments kept.
|
|
157
|
+
runtime_resolves_dot_segments: false,
|
|
158
|
+
// `fuz_actions::server::fallback_group` answers outside `/api` unless the
|
|
159
|
+
// backend's fallback group is its own.
|
|
160
|
+
spine_fallback: true,
|
|
161
|
+
// `compose_stack` mounts the host gate unless `StackOptions::host_gate` is off.
|
|
162
|
+
host_gate: true
|
|
143
163
|
});
|
|
144
164
|
/** Bootstrap block built from the default secrets + supplied paths. */
|
|
145
165
|
const build_default_bootstrap = (paths, overrides) => ({
|
|
@@ -12,7 +12,7 @@ import { create_test_app_surface_spec } from '../stubs.js';
|
|
|
12
12
|
// Pure path / role / fixture-URL constants live on the hono-free
|
|
13
13
|
// `spine_surface_constants.ts` leaf so cross-process suite modules can import them
|
|
14
14
|
// without dragging this module's eager in-process route handlers
|
|
15
|
-
// (→ `
|
|
15
|
+
// (→ `audit_log_routes` → `hono/streaming`). Import only the constants this
|
|
16
16
|
// module uses internally; callers that need a bare constant reach for the leaf.
|
|
17
17
|
import { SPINE_ACCOUNT_PATH_PREFIX, SPINE_CELL_EDITOR_ROLE, SPINE_EXPECTED_SCHEMA_URL, SPINE_PARTICIPANT_ROLE, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
18
18
|
/**
|
|
@@ -64,7 +64,7 @@ export interface KnownDivergencePath {
|
|
|
64
64
|
* A tracked, accepted difference between the two backends.
|
|
65
65
|
*
|
|
66
66
|
* `what_differs` lists the normalized-response paths that differ
|
|
67
|
-
* (`DifferentialDiff.path` — `status`, `headers.<name>`,
|
|
67
|
+
* (`DifferentialDiff.path` — `status`, `headers.<name>`, `session_cookie`,
|
|
68
68
|
* `body.error.data.reason`), each optionally with the value each side shows
|
|
69
69
|
* (`KnownDivergencePath`). A matched case may differ there and nowhere else.
|
|
70
70
|
* An entry naming cases must still differ on each of them; one naming
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"differential.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/differential.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"differential.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/differential.ts"],"names":[],"mappings":"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"}
|
|
@@ -8,7 +8,8 @@ import '../assert_dev_env.js';
|
|
|
8
8
|
* does any body difference on a case pinned by status alone.
|
|
9
9
|
* `describe_differential_conformance_tests` sends every case to two backends,
|
|
10
10
|
* normalizes both responses (`normalize_differential_response`), and asserts
|
|
11
|
-
* they are equal: status, header names,
|
|
11
|
+
* they are equal: status, header names, what each does to the session cookie,
|
|
12
|
+
* and the whole body.
|
|
12
13
|
*
|
|
13
14
|
* Each case runs on a fresh fixture per backend — each backend's own
|
|
14
15
|
* `setup_test`, so separate databases and separate keepers, which is why the
|
|
@@ -144,7 +145,7 @@ export const describe_differential_conformance_tests = (options) => {
|
|
|
144
145
|
resolved_rpc_endpoints,
|
|
145
146
|
request_headers: DIFFERENTIAL_REQUEST_HEADERS,
|
|
146
147
|
...(backend.ws && { ws: backend.ws })
|
|
147
|
-
}));
|
|
148
|
+
}), options.session_options.cookie_name);
|
|
148
149
|
describe(options.suite_name ?? 'differential conformance', () => {
|
|
149
150
|
// per entry: the cases it matched, the ones that ran to a diff, and
|
|
150
151
|
// whether any of them showed it
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
+
import { type SessionCookieEffect } from './session_cookie_effect.js';
|
|
2
3
|
/**
|
|
3
4
|
* Response normalization for the cross-backend differential.
|
|
4
5
|
*
|
|
@@ -39,6 +40,13 @@ import '../assert_dev_env.js';
|
|
|
39
40
|
* and the header values that are contracts are pinned per backend by the
|
|
40
41
|
* conformance table's `expect.headers` and its no-fingerprint floor. A
|
|
41
42
|
* header one backend sends and the other doesn't is still a difference.
|
|
43
|
+
* - **The session cookie's effect, classified.** Since `set-cookie` values are
|
|
44
|
+
* not compared, a clear and a mint would both read as the one header name;
|
|
45
|
+
* `session_cookie` is what the response does to the session cookie
|
|
46
|
+
* (`classify_session_cookie_effect`, the reading the conformance table
|
|
47
|
+
* asserts `expect.set_cookie` with), so one backend clearing where the other
|
|
48
|
+
* mints, or clearing where the other sends nothing, differs at
|
|
49
|
+
* `session_cookie`.
|
|
42
50
|
*
|
|
43
51
|
* `diff_differential_responses` lists every place two normalized responses
|
|
44
52
|
* differ, one entry per leaf path, which is what a known-divergence ledger
|
|
@@ -66,12 +74,19 @@ export interface DifferentialResponse {
|
|
|
66
74
|
readonly body: unknown;
|
|
67
75
|
/** Sorted response header names, minus `VOLATILE_HEADER_NAMES`. */
|
|
68
76
|
readonly header_names: ReadonlyArray<string>;
|
|
77
|
+
/**
|
|
78
|
+
* What the response does to the session cookie, `'unrecognized'` for lines
|
|
79
|
+
* of no shape `SessionCookieEffect` names.
|
|
80
|
+
*/
|
|
81
|
+
readonly session_cookie: SessionCookieEffect | 'unrecognized';
|
|
69
82
|
}
|
|
70
83
|
/** The raw response `normalize_differential_response` takes. */
|
|
71
84
|
export interface DifferentialRawResponse {
|
|
72
85
|
readonly status: number;
|
|
73
86
|
/** Header snapshot with lowercased names (`headers_to_record`'s shape). */
|
|
74
87
|
readonly headers: Readonly<Record<string, string>>;
|
|
88
|
+
/** Every `Set-Cookie` line, in order. */
|
|
89
|
+
readonly set_cookies: ReadonlyArray<string>;
|
|
75
90
|
readonly body: unknown;
|
|
76
91
|
}
|
|
77
92
|
/**
|
|
@@ -98,14 +113,16 @@ export declare const VOLATILE_VALUE_PATTERNS: ReadonlyArray<VolatileValuePattern
|
|
|
98
113
|
* Normalize one response into its `DifferentialResponse`. Pure; numbering
|
|
99
114
|
* restarts for every call.
|
|
100
115
|
*
|
|
101
|
-
* @param response - the raw status, header snapshot and JSON body
|
|
116
|
+
* @param response - the raw status, header snapshot, `Set-Cookie` lines and JSON body
|
|
117
|
+
* @param session_cookie_name - the session cookie's name, which `session_cookie` classifies
|
|
102
118
|
* @returns the canonical form
|
|
103
119
|
*/
|
|
104
|
-
export declare const normalize_differential_response: (response: DifferentialRawResponse) => DifferentialResponse;
|
|
120
|
+
export declare const normalize_differential_response: (response: DifferentialRawResponse, session_cookie_name: string) => DifferentialResponse;
|
|
105
121
|
/**
|
|
106
122
|
* One place two normalized responses differ. `path` is dotted from the
|
|
107
|
-
* response root (`status`, `headers.x-example`, `
|
|
108
|
-
* `body.result.accounts[0]`); `a` / `b` are the
|
|
123
|
+
* response root (`status`, `headers.x-example`, `session_cookie`,
|
|
124
|
+
* `body.error.data.reason`, `body.result.accounts[0]`); `a` / `b` are the
|
|
125
|
+
* values on each side,
|
|
109
126
|
* `undefined` where a side has nothing there. A header one side sent and the
|
|
110
127
|
* other didn't is `headers.<name>`, with `true` on the side that sent it.
|
|
111
128
|
* An object one side lacks is compared key by key, so each of its keys is its
|
|
@@ -119,8 +136,8 @@ export interface DifferentialDiff {
|
|
|
119
136
|
}
|
|
120
137
|
/**
|
|
121
138
|
* Every place two normalized responses differ, in a stable order: status,
|
|
122
|
-
* then header names, then the
|
|
123
|
-
* the responses are equal.
|
|
139
|
+
* then header names, then the session cookie's effect, then the body
|
|
140
|
+
* depth-first with keys sorted. Empty when the responses are equal.
|
|
124
141
|
*
|
|
125
142
|
* @param a - one backend's normalized response
|
|
126
143
|
* @param b - the other's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"differential_normalize.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/differential_normalize.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"differential_normalize.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/differential_normalize.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,mBAAmB;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,mBAAmB,GAAG,cAAc,CAAC;CAC9D;AAED,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAMvD,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACpC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,oBAAoB,CAUvE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC3C,UAAU,uBAAuB,EACjC,qBAAqB,MAAM,KACzB,oBA4CF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACpB;AA6BD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GACvC,GAAG,oBAAoB,EACvB,GAAG,oBAAoB,KACrB,KAAK,CAAC,gBAAgB,CAexB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,OAEoB,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,OAAO,aAAa,CAAC,gBAAgB,CAAC,EACtC,QAAQ;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,KAChD,MAOU,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
+
import { classify_session_cookie_effect } from './session_cookie_effect.js';
|
|
2
3
|
/**
|
|
3
4
|
* Response headers left out of `header_names`: framing and per-request
|
|
4
5
|
* headers each HTTP server sets its own way, which say nothing about the
|
|
@@ -32,10 +33,11 @@ export const VOLATILE_VALUE_PATTERNS = [
|
|
|
32
33
|
* Normalize one response into its `DifferentialResponse`. Pure; numbering
|
|
33
34
|
* restarts for every call.
|
|
34
35
|
*
|
|
35
|
-
* @param response - the raw status, header snapshot and JSON body
|
|
36
|
+
* @param response - the raw status, header snapshot, `Set-Cookie` lines and JSON body
|
|
37
|
+
* @param session_cookie_name - the session cookie's name, which `session_cookie` classifies
|
|
36
38
|
* @returns the canonical form
|
|
37
39
|
*/
|
|
38
|
-
export const normalize_differential_response = (response) => {
|
|
40
|
+
export const normalize_differential_response = (response, session_cookie_name) => {
|
|
39
41
|
const seen = new Map();
|
|
40
42
|
const placeholder = (kind, value) => {
|
|
41
43
|
let values = seen.get(kind);
|
|
@@ -77,7 +79,8 @@ export const normalize_differential_response = (response) => {
|
|
|
77
79
|
header_names: Object.keys(response.headers)
|
|
78
80
|
.map((name) => name.toLowerCase())
|
|
79
81
|
.filter((name) => !VOLATILE_HEADER_NAMES.includes(name))
|
|
80
|
-
.sort()
|
|
82
|
+
.sort(),
|
|
83
|
+
session_cookie: classify_session_cookie_effect(response.set_cookies, session_cookie_name) ?? 'unrecognized'
|
|
81
84
|
};
|
|
82
85
|
};
|
|
83
86
|
const is_record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -109,8 +112,8 @@ const diff_values = (path, a, b, out) => {
|
|
|
109
112
|
};
|
|
110
113
|
/**
|
|
111
114
|
* Every place two normalized responses differ, in a stable order: status,
|
|
112
|
-
* then header names, then the
|
|
113
|
-
* the responses are equal.
|
|
115
|
+
* then header names, then the session cookie's effect, then the body
|
|
116
|
+
* depth-first with keys sorted. Empty when the responses are equal.
|
|
114
117
|
*
|
|
115
118
|
* @param a - one backend's normalized response
|
|
116
119
|
* @param b - the other's
|
|
@@ -127,6 +130,9 @@ export const diff_differential_responses = (a, b) => {
|
|
|
127
130
|
out.push({ path: `headers.${name}`, a: in_a || undefined, b: in_b || undefined });
|
|
128
131
|
}
|
|
129
132
|
}
|
|
133
|
+
if (a.session_cookie !== b.session_cookie) {
|
|
134
|
+
out.push({ path: 'session_cookie', a: a.session_cookie, b: b.session_cookie });
|
|
135
|
+
}
|
|
130
136
|
diff_values('body', a.body, b.body, out);
|
|
131
137
|
return out;
|
|
132
138
|
};
|
|
@@ -15,6 +15,7 @@ import '../assert_dev_env.js';
|
|
|
15
15
|
* - the full cell verb set (CRUD + grant + field + item + audit),
|
|
16
16
|
* - the opt-in `actor_lookup` / `actor_search` resolvers,
|
|
17
17
|
* - the `_testing_origin_check` probe the origin conformance table drives,
|
|
18
|
+
* - the `_testing_credential_read` probe the credential conformance table drives,
|
|
18
19
|
* - the `_testing_shorten_credential_expiry` seam the credential-deadline
|
|
19
20
|
* suite drives,
|
|
20
21
|
* - the `_testing_room_evict` seam the rooms suite drives, over the room
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full_spine_mount.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/full_spine_mount.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"full_spine_mount.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/full_spine_mount.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAS1E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAMvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA2C7D;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GAAI,aAAa,kBAAkB,KAAG,YAC1B,CAAC;AAEpD,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzD;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC;CACtC;AASD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,KAAK,CAAC,SAAS,CAAwD,CAAC;AA4E3E,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,cAYF,CAAC;AAaF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,QAAO,KAAK,CAAC,eAAe,CAOvE,CAAC"}
|
|
@@ -14,6 +14,7 @@ import { CELL_DROP_TABLES } from '../../db/cell_ddl.js';
|
|
|
14
14
|
import { FACT_DROP_TABLES } from '../../db/fact_ddl.js';
|
|
15
15
|
import { create_testing_action_manifest_action, create_testing_actions, create_testing_room_evict_action, create_testing_shorten_credential_expiry_action } from './testing_reset_actions.js';
|
|
16
16
|
import { test_room_authorize } from './test_room_authorize.js';
|
|
17
|
+
import { create_testing_credential_read_action } from './testing_credential_read.js';
|
|
17
18
|
import { create_testing_origin_check_action } from './testing_origin_check.js';
|
|
18
19
|
import { test_cell_gated_create_authorize } from './test_cell_gated_create_authorize.js';
|
|
19
20
|
import { test_cell_grant_steward_revoke_authorize } from './test_cell_grant_steward_revoke_authorize.js';
|
|
@@ -102,6 +103,12 @@ const build_full_spine_actions = (deps, options) => {
|
|
|
102
103
|
// the origin conformance table's probe — kept out of
|
|
103
104
|
// `create_testing_actions` (see its spec doc)
|
|
104
105
|
create_testing_origin_check_action(),
|
|
106
|
+
// the credential conformance table's probe, over the binary's keyring and
|
|
107
|
+
// cookie name — out of `create_testing_actions` for the same reason
|
|
108
|
+
create_testing_credential_read_action({
|
|
109
|
+
keyring: deps.keyring,
|
|
110
|
+
session_options: spine_session_options
|
|
111
|
+
}),
|
|
105
112
|
// the credential-deadline suite's shorten-only seam — kept out of
|
|
106
113
|
// `create_testing_actions` for the same reason
|
|
107
114
|
create_testing_shorten_credential_expiry_action(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity_parity.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"identity_parity.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA8H9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA0B5C,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAsKD,eAAO,MAAM,oCAAoC,GAChD,SAAS,8BAA8B,KACrC,IA6gBF,CAAC"}
|
|
@@ -104,6 +104,10 @@ import '../assert_dev_env.js';
|
|
|
104
104
|
* cross-process leg (`cross_backend/spine_suites.cross.test.ts`, the TS spine
|
|
105
105
|
* binaries + Rust `testing_spine_stub` over real HTTP).
|
|
106
106
|
*
|
|
107
|
+
* The accepted-case rows answer 403 no-matching-invite, so a backend with a
|
|
108
|
+
* signup denial floor pays it per row; the spine surface zeroes
|
|
109
|
+
* `signup_fail_floor_ms`.
|
|
110
|
+
*
|
|
107
111
|
* @module
|
|
108
112
|
*/
|
|
109
113
|
import { describe, test, assert } from 'vitest';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in_process_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"in_process_setup.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/in_process_setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqB9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAanE,OAAO,EAIN,KAAK,oBAAoB,EACzB,KAAK,eAAe,EAEpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAMN,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,MAAM,YAAY,CAAC;AAepB;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,kCAAkC,CAAC,EAAE,OAAO,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,qBAAqB,KAAG,SA6JjC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gCAAgC,GAAI,KAAK,CAAC,CAAC,SAAS,4BAA4B,EAC5F,SAAS,CAAC,KACR;IACF,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,mBAAmB,CAAC;IAClC,eAAe,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtC,kBAAkB,EAAE,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC;IACf,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAqClC,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { ROLE_KEEPER } from '../../auth/role_schema.js';
|
|
3
|
+
import { AUTH_SESSION_LIFETIME_MS, query_session_revoke_for_account } from '../../auth/session_queries.js';
|
|
4
|
+
import { generate_api_token } from '../../auth/api_token.js';
|
|
5
|
+
import { query_create_api_token, query_revoke_api_token_for_account } from '../../auth/api_token_queries.js';
|
|
6
|
+
import { token_scope_full } from '../../auth/token_scope.js';
|
|
3
7
|
import { create_test_extra_actor } from '../db_entities.js';
|
|
4
8
|
import { create_test_app, create_test_account_with_credentials, mint_test_session } from '../app_server.js';
|
|
5
9
|
import { create_test_app_surface_spec } from '../stubs.js';
|
|
6
|
-
import { http_transport } from '../rpc_helpers.js';
|
|
10
|
+
import { find_rpc_action, http_transport, resolve_rpc_endpoints_for_setup } from '../rpc_helpers.js';
|
|
11
|
+
import { query_shorten_credential_expiry } from './testing_reset_actions.js';
|
|
7
12
|
import { in_process_capabilities } from './capabilities.js';
|
|
8
|
-
import { EXPIRED_SESSION_OFFSET_SECONDS, to_test_account } from './setup.js';
|
|
13
|
+
import { assert_credential_authenticates, EXPIRED_SESSION_OFFSET_SECONDS, EXPIRED_TOKEN_SHORTEN_SECONDS, EXPIRED_TOKEN_WAIT_MS, to_test_account } from './setup.js';
|
|
9
14
|
/**
|
|
10
15
|
* Wrap a Hono-style app into a `FetchTransport`-shaped object so the
|
|
11
16
|
* shared `TestFixture.transport` type holds for both in-process and
|
|
@@ -50,6 +55,15 @@ export const default_in_process_setup = (options) => async () => {
|
|
|
50
55
|
// `ExtraAccountSpec` for why this bypass is bootstrap-cradle-only.
|
|
51
56
|
const extra_accounts = {};
|
|
52
57
|
const { cookie_name } = options.session_options;
|
|
58
|
+
// where `account_verify` is mounted, for the liveness checks of the
|
|
59
|
+
// dead-credential mints; read only when one runs
|
|
60
|
+
const account_verify_rpc_path = (accessor) => {
|
|
61
|
+
const found = find_rpc_action(resolve_rpc_endpoints_for_setup(options.rpc_endpoints ?? [], options.session_options), 'account_verify');
|
|
62
|
+
if (!found) {
|
|
63
|
+
throw new Error(`${accessor}: the in-process app mounts no account_verify to prove the credential live`);
|
|
64
|
+
}
|
|
65
|
+
return found.path;
|
|
66
|
+
};
|
|
53
67
|
for (const spec of options.extra_accounts ?? []) {
|
|
54
68
|
const seeded = await create_test_account_with_credentials({
|
|
55
69
|
db: test_app.backend.deps.db,
|
|
@@ -98,6 +112,67 @@ export const default_in_process_setup = (options) => async () => {
|
|
|
98
112
|
expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS
|
|
99
113
|
});
|
|
100
114
|
return `${cookie_name}=${session_cookie}`;
|
|
115
|
+
},
|
|
116
|
+
// The mints, revocations and the expiry go through the queries the
|
|
117
|
+
// production paths (and the expiry backdoor) write with, so the rows
|
|
118
|
+
// match what the cross-process accessors leave; each credential is
|
|
119
|
+
// proven live first, so its refusal can only be the revocation or the
|
|
120
|
+
// expiry.
|
|
121
|
+
mint_revoked_session: async () => {
|
|
122
|
+
const db = test_app.backend.deps.db;
|
|
123
|
+
const account_id = test_app.backend.account.id;
|
|
124
|
+
const { session_cookie, session_hash } = await mint_test_session({
|
|
125
|
+
db,
|
|
126
|
+
keyring: test_app.backend.keyring,
|
|
127
|
+
session_options: options.session_options,
|
|
128
|
+
account_id,
|
|
129
|
+
expires_in_seconds: AUTH_SESSION_LIFETIME_MS / 1000
|
|
130
|
+
});
|
|
131
|
+
const cookie = `${cookie_name}=${session_cookie}`;
|
|
132
|
+
await assert_credential_authenticates({
|
|
133
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
134
|
+
rpc_path: account_verify_rpc_path('mint_revoked_session'),
|
|
135
|
+
headers: { cookie },
|
|
136
|
+
account_id,
|
|
137
|
+
accessor: 'mint_revoked_session'
|
|
138
|
+
});
|
|
139
|
+
if (!(await query_session_revoke_for_account({ db }, session_hash, account_id))) {
|
|
140
|
+
throw new Error('mint_revoked_session: the revoke removed no session row');
|
|
141
|
+
}
|
|
142
|
+
return cookie;
|
|
143
|
+
},
|
|
144
|
+
mint_revoked_token: async () => {
|
|
145
|
+
const deps = { db: test_app.backend.deps.db };
|
|
146
|
+
const account_id = test_app.backend.account.id;
|
|
147
|
+
const { token, id, token_hash } = generate_api_token();
|
|
148
|
+
await query_create_api_token(deps, id, account_id, 'conformance revoked token', token_hash, token_scope_full());
|
|
149
|
+
await assert_credential_authenticates({
|
|
150
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
151
|
+
rpc_path: account_verify_rpc_path('mint_revoked_token'),
|
|
152
|
+
headers: { authorization: `Bearer ${token}` },
|
|
153
|
+
account_id,
|
|
154
|
+
accessor: 'mint_revoked_token'
|
|
155
|
+
});
|
|
156
|
+
if (!(await query_revoke_api_token_for_account(deps, id, account_id))) {
|
|
157
|
+
throw new Error('mint_revoked_token: the revoke removed no token row');
|
|
158
|
+
}
|
|
159
|
+
return token;
|
|
160
|
+
},
|
|
161
|
+
mint_expired_token: async () => {
|
|
162
|
+
const other = await test_app.create_account();
|
|
163
|
+
await assert_credential_authenticates({
|
|
164
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
165
|
+
rpc_path: account_verify_rpc_path('mint_expired_token'),
|
|
166
|
+
headers: { authorization: `Bearer ${other.api_token}` },
|
|
167
|
+
account_id: other.account.id,
|
|
168
|
+
accessor: 'mint_expired_token'
|
|
169
|
+
});
|
|
170
|
+
const shortened = await query_shorten_credential_expiry(test_app.backend.deps.db, other.account.id, EXPIRED_TOKEN_SHORTEN_SECONDS);
|
|
171
|
+
if (shortened.api_tokens < 1) {
|
|
172
|
+
throw new Error('mint_expired_token: the expiry rewrote no token row');
|
|
173
|
+
}
|
|
174
|
+
await new Promise((resolve) => setTimeout(resolve, EXPIRED_TOKEN_WAIT_MS));
|
|
175
|
+
return other.api_token;
|
|
101
176
|
}
|
|
102
177
|
};
|
|
103
178
|
};
|
|
@@ -107,8 +182,7 @@ export const default_in_process_setup = (options) => async () => {
|
|
|
107
182
|
// `create_test_app` (so the route exists at dispatch time and returns 403
|
|
108
183
|
// `ERROR_ALREADY_BOOTSTRAPPED` matching its declared 403 schema). Same
|
|
109
184
|
// precedent as `rpc_endpoints`. Discriminated union shape (`mode: 'disabled'`
|
|
110
|
-
// | `'surface_only'` | `'live'`)
|
|
111
|
-
// overload that conflated three deployment intents on one channel.
|
|
185
|
+
// | `'surface_only'` | `'live'`), one deployment intent per mode.
|
|
112
186
|
/**
|
|
113
187
|
* Build the full in-process suite bundle in a single helper invocation.
|
|
114
188
|
* Output covers `{setup_test, surface_source, capabilities}` plus every
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_security.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/login_security.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"login_security.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/login_security.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA2F9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C,mDAAmD;AACnD,MAAM,WAAW,6BAA6B;IAC7C,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;;OAMG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAmDD,eAAO,MAAM,mCAAmC,GAC/C,SAAS,6BAA6B,KACpC,IA8VF,CAAC"}
|