@fuzdev/fuz_app 0.149.0 → 0.151.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/README.md +1 -1
- package/dist/actions/CLAUDE.md +327 -300
- package/dist/actions/action_bridge.d.ts +5 -79
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -74
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_event_types.d.ts +1 -1
- package/dist/actions/action_event_types.d.ts.map +1 -1
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -31
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -292
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -903
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +53 -76
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +132 -68
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_lookup_queries.d.ts +3 -2
- package/dist/auth/actor_lookup_queries.d.ts.map +1 -1
- package/dist/auth/actor_lookup_queries.js +6 -3
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +10 -7
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +18 -11
- package/dist/auth/admin_action_specs.d.ts +4 -4
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +7 -5
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +47 -48
- package/dist/auth/all_cell_actions.d.ts +14 -3
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +2 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +12 -6
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +11 -5
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +14 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +19 -23
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/bootstrap_account.d.ts +25 -1
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +37 -4
- package/dist/auth/bootstrap_routes.d.ts +3 -2
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +5 -4
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_action_specs.d.ts +215 -15
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +103 -16
- package/dist/auth/cell_actions.d.ts +58 -27
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +206 -161
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_events.d.ts +1 -1
- package/dist/auth/cell_audit_events.d.ts.map +1 -1
- package/dist/auth/cell_audit_events.js +3 -2
- package/dist/auth/cell_audit_metadata.d.ts +12 -1
- package/dist/auth/cell_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_audit_metadata.js +11 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +9 -2
- package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_grant_action_specs.js +10 -3
- package/dist/auth/cell_grant_actions.d.ts +105 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +81 -56
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +8 -7
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +8 -7
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +117 -16
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +51 -16
- package/dist/auth/role_grant_offer_actions.d.ts +22 -11
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +72 -19
- package/dist/auth/role_grant_offer_notifications.d.ts +6 -5
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +4 -3
- package/dist/auth/role_grant_offer_queries.d.ts +20 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +40 -37
- package/dist/auth/role_grant_queries.d.ts +44 -76
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +73 -118
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/role_schema.d.ts +14 -8
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +6 -3
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +21 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +18 -6
- package/dist/db/cell_ddl.d.ts +5 -134
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +28 -17
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +65 -55
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +85 -62
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/body_limit.d.ts +3 -1
- package/dist/http/body_limit.d.ts.map +1 -1
- package/dist/http/body_limit.js +6 -1
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc.d.ts +9 -0
- package/dist/http/jsonrpc.d.ts.map +1 -1
- package/dist/http/jsonrpc.js +17 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +70 -23
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/proxy.d.ts +4 -2
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +7 -2
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +4 -2
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +7 -4
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +52 -1
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +123 -6
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +73 -54
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +115 -78
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +213 -179
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -75
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/actor_lookup.d.ts.map +1 -1
- package/dist/testing/cross_backend/actor_lookup.js +27 -0
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +15 -8
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.js +109 -13
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_moderate.d.ts +7 -1
- package/dist/testing/cross_backend/cell_moderate.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_moderate.js +68 -4
- package/dist/testing/cross_backend/cell_ref_admission.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_ref_admission.js +18 -9
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +6 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +12 -10
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/differential.d.ts +7 -0
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +17 -0
- package/dist/testing/cross_backend/expected_schema.json +1 -0
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +13 -5
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +96 -2
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts +18 -19
- package/dist/testing/cross_backend/test_cell_gated_create_authorize.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_gated_create_authorize.js +66 -42
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +48 -6
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +2 -1
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -94
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -138
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -238
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* account delete and purge, `/logout`, `/password`, and the session and token
|
|
12
12
|
* caps for what they evict. A role revocation is the exception: it closes
|
|
13
13
|
* only the connections an endpoint gated on that role, and only through the
|
|
14
|
-
* audit
|
|
15
|
-
*
|
|
14
|
+
* audit listener (`create_revocation_guard`) — no handler holds a closer for
|
|
15
|
+
* it. The auth cleanup holds one too
|
|
16
16
|
* (`AuthCleanupDeps.connection_closer`): its session sweep closes the
|
|
17
17
|
* connections of each expired session it deletes, after that delete commits.
|
|
18
18
|
*
|
|
@@ -33,21 +33,32 @@
|
|
|
33
33
|
*
|
|
34
34
|
* ## Why the handlers close directly
|
|
35
35
|
*
|
|
36
|
-
* The audit
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* The audit listener (`create_revocation_guard`) closes connections too, but
|
|
37
|
+
* only once the audit row is written, and that write is pool-routed and
|
|
38
|
+
* fail-open. The handler's own close is the one that runs
|
|
39
39
|
* whatever happens to the audit write, so the closer it holds must reach every
|
|
40
40
|
* transport whose connections outlive their credential. `RealtimeCloser` is
|
|
41
41
|
* that fan-out, and `create_app_backend` puts one on `AppDeps`.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* ## The audit listener
|
|
44
|
+
*
|
|
45
|
+
* `create_revocation_guard` repeats a revocation's close when its audit row is
|
|
46
|
+
* announced, which covers a revocation emitted by code that holds no closer,
|
|
47
|
+
* and is the one closer of a role revocation. `create_app_server` registers one
|
|
48
|
+
* on `deps.connection_closer` when it mounts a WebSocket endpoint or the audit
|
|
49
|
+
* stream, so it reaches every member — each WebSocket connection registry and the audit
|
|
50
|
+
* stream registry — through the one fan-out.
|
|
51
|
+
*
|
|
52
|
+
* Twin of the Rust spine's `ConnectionCloser`, `ConnectionCloseTarget`,
|
|
53
|
+
* `queue_connection_close`, `RealtimeCloser`, and
|
|
54
|
+
* `register_revocation_guard`.
|
|
45
55
|
*
|
|
46
56
|
* @module
|
|
47
57
|
*/
|
|
48
58
|
import type { Uuid } from '../primitive_schemas.js';
|
|
49
59
|
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
50
60
|
import { type EmitAfterCommitContext } from '../http/pending_effects.js';
|
|
61
|
+
import { type AuditLogEvent } from '../auth/audit_log_schema.js';
|
|
51
62
|
/**
|
|
52
63
|
* Close live connections by identity, or all of them.
|
|
53
64
|
*
|
|
@@ -60,54 +71,54 @@ import { type EmitAfterCommitContext } from '../http/pending_effects.js';
|
|
|
60
71
|
* implementation attempts every matching connection, then throws the first
|
|
61
72
|
* error it met.
|
|
62
73
|
*
|
|
63
|
-
* `
|
|
64
|
-
* `create_sse_connection_closer` adapts
|
|
74
|
+
* `ConnectionRegistry` satisfies this structurally, and
|
|
75
|
+
* `create_sse_connection_closer` adapts an `SseRegistry`. Twin of the
|
|
76
|
+
* Rust spine's `ConnectionCloser` (with its `ShutdownCloser` supertrait's
|
|
77
|
+
* `close_all_connections`).
|
|
65
78
|
*/
|
|
66
79
|
export interface ConnectionCloser {
|
|
67
|
-
/** Close every connection authenticated by the session whose blake3 hash is `session_token_hash`. */
|
|
68
|
-
close_sockets_for_session: (session_token_hash: string) => number;
|
|
69
|
-
/** Close every connection authenticated by the API token `api_token_id`. */
|
|
70
|
-
close_sockets_for_token: (api_token_id: string) => number;
|
|
71
|
-
/**
|
|
72
|
-
* Close every connection of `account_id`, whatever credential opened it —
|
|
73
|
-
* the close for a revocation that invalidates all of an account's
|
|
74
|
-
* credentials.
|
|
75
|
-
*/
|
|
76
|
-
close_sockets_for_account: (account_id: Uuid) => number;
|
|
77
80
|
/**
|
|
78
|
-
* Close
|
|
79
|
-
* `role` — the close for a revoked **global** grant of that role (a scoped
|
|
80
|
-
* grant never admits at a role gate, so revoking one closes nothing; the
|
|
81
|
-
* caller filters, `to_global_role_revocation`). A WebSocket gets
|
|
82
|
-
* `WS_CLOSE_PERMISSION_REVOKED`, not a revocation's code: the credential is
|
|
83
|
-
* still good.
|
|
81
|
+
* Close every connection `target` names — pending admission or admitted.
|
|
84
82
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* account still holds another. The client reconnects into the gate if it
|
|
88
|
-
* still qualifies.
|
|
83
|
+
* A revocation handler calls `queue_connection_close` instead, which runs
|
|
84
|
+
* this after the commit.
|
|
89
85
|
*/
|
|
90
|
-
|
|
86
|
+
close_connections: (target: ConnectionCloseTarget) => number;
|
|
91
87
|
/**
|
|
92
88
|
* Close every connection, whoever opened it — the shutdown close
|
|
93
89
|
* `AppServer.close` runs. Not a revocation: a WebSocket gets
|
|
94
90
|
* `WS_CLOSE_GOING_AWAY`, so its client reconnects rather than treating
|
|
95
|
-
* its credential as revoked. The
|
|
91
|
+
* its credential as revoked. The registry is left closing: a
|
|
96
92
|
* registration that arrives afterward is born closed, refused at once
|
|
97
|
-
* (`
|
|
93
|
+
* (`ConnectionRegistry` and `SseRegistry` both do).
|
|
98
94
|
*/
|
|
99
|
-
|
|
95
|
+
close_all_connections: () => number;
|
|
100
96
|
}
|
|
101
97
|
/**
|
|
102
98
|
* Which connections a revocation closes — the argument of
|
|
103
|
-
* `
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
99
|
+
* `ConnectionCloser.close_connections` and `queue_connection_close`.
|
|
100
|
+
* Twin of the Rust spine's `ConnectionCloseTarget`, the same four variants.
|
|
101
|
+
*
|
|
102
|
+
* - `session` — every connection authenticated by the session whose blake3
|
|
103
|
+
* hash is `session_hash` (`ConnectionIdentity.session_hash`)
|
|
104
|
+
* - `token` — every connection authenticated by the API token `api_token_id`
|
|
105
|
+
* - `account` — every connection of `account_id`, whatever credential opened
|
|
106
|
+
* it: the close for a revocation that invalidates all of an account's
|
|
107
|
+
* credentials
|
|
108
|
+
* - `role` — the connections of `account_id` whose endpoint gated them on
|
|
109
|
+
* `role`: the close for a revoked **global** grant of that role (a scoped
|
|
110
|
+
* grant never admits at a role gate, so revoking one closes nothing;
|
|
111
|
+
* `to_connection_close_target` filters). A WebSocket gets
|
|
112
|
+
* `WS_CLOSE_PERMISSION_REVOKED`, not a revocation's code: the credential is
|
|
113
|
+
* still good. It **over-closes an any-of gate**: a connection whose
|
|
114
|
+
* endpoint listed several roles closes on the loss of any of them, whether
|
|
115
|
+
* or not the account still holds another; the client reconnects into the
|
|
116
|
+
* gate if it still qualifies. No handler queues `role`: the audit listener
|
|
117
|
+
* is a role's only closer.
|
|
107
118
|
*/
|
|
108
119
|
export type ConnectionCloseTarget = {
|
|
109
120
|
kind: 'session';
|
|
110
|
-
|
|
121
|
+
session_hash: string;
|
|
111
122
|
} | {
|
|
112
123
|
kind: 'token';
|
|
113
124
|
api_token_id: string;
|
|
@@ -120,14 +131,36 @@ export type ConnectionCloseTarget = {
|
|
|
120
131
|
role: string;
|
|
121
132
|
};
|
|
122
133
|
/**
|
|
123
|
-
*
|
|
134
|
+
* The connections a revocation's audit row closes, dispatched on the
|
|
135
|
+
* `RevocationScope` its event declares in `audit_event_revocation_scopes`
|
|
136
|
+
* (`auth/audit_log_schema.ts`) — `null` when it closes nothing:
|
|
137
|
+
*
|
|
138
|
+
* - a row whose outcome is not `success` — a failure carries
|
|
139
|
+
* attacker-controlled identifiers (a `session_revoke` the DB rejected still
|
|
140
|
+
* records the submitted session id), so reacting to it would let any
|
|
141
|
+
* authenticated caller close another user's connection by guessing a session
|
|
142
|
+
* hash or token id; matching the success rather than skipping the failure
|
|
143
|
+
* keeps an outcome outside the enum inert
|
|
144
|
+
* - scope `none` — every event that revokes nothing, and any event type
|
|
145
|
+
* fuz_app does not define
|
|
146
|
+
* - a row missing the key its scope closes by (an empty string included)
|
|
147
|
+
* - a `role` row whose revoked grant was scoped (`to_global_role_revocation`)
|
|
148
|
+
*
|
|
149
|
+
* Otherwise:
|
|
150
|
+
*
|
|
151
|
+
* - `session` → `{kind: 'session', session_hash: metadata.session_id}`
|
|
152
|
+
* - `token` → `{kind: 'token', api_token_id: metadata.token_id}`
|
|
153
|
+
* - `account` → `{kind: 'account', account_id: target_account_id ?? account_id}`
|
|
154
|
+
* — admin actions set `target_account_id`, self-service ones only
|
|
155
|
+
* `account_id`
|
|
156
|
+
* - `role` → `{kind: 'role', account_id, role}` of the revoked global grant
|
|
124
157
|
*
|
|
125
|
-
*
|
|
126
|
-
* after the commit.
|
|
158
|
+
* Twin of the Rust spine's `ConnectionCloseTarget::from_audit_event`.
|
|
127
159
|
*
|
|
128
|
-
* @
|
|
160
|
+
* @param event - the audit row announced after its commit
|
|
161
|
+
* @returns the connections to close, or `null`
|
|
129
162
|
*/
|
|
130
|
-
export declare const
|
|
163
|
+
export declare const to_connection_close_target: (event: AuditLogEvent) => ConnectionCloseTarget | null;
|
|
131
164
|
/**
|
|
132
165
|
* Close the connections `target` names, now, for a revocation that has
|
|
133
166
|
* already committed — logging a close that throws instead of throwing it.
|
|
@@ -167,12 +200,12 @@ export declare const queue_connection_close: (ctx: EmitAfterCommitContext, close
|
|
|
167
200
|
*/
|
|
168
201
|
export declare const noop_connection_closer: ConnectionCloser;
|
|
169
202
|
/**
|
|
170
|
-
* One `ConnectionCloser` over every live-connection
|
|
203
|
+
* One `ConnectionCloser` over every live-connection registry of a backend.
|
|
171
204
|
*
|
|
172
205
|
* Each close fans out to every member and returns the sum of what each
|
|
173
|
-
* closed. A revocation handler holds this rather than one
|
|
174
|
-
* close reaches the WebSocket
|
|
175
|
-
* `AppServer.close` runs its `
|
|
206
|
+
* closed. A revocation handler holds this rather than one registry, so its
|
|
207
|
+
* close reaches the WebSocket registries and the SSE registries alike, and
|
|
208
|
+
* `AppServer.close` runs its `close_all_connections` to end every live connection
|
|
176
209
|
* of the backend at shutdown.
|
|
177
210
|
*
|
|
178
211
|
* A member that throws does not stop the fan-out: every member is still
|
|
@@ -204,11 +237,48 @@ export interface RealtimeCloser extends ConnectionCloser {
|
|
|
204
237
|
* Create an empty `RealtimeCloser`.
|
|
205
238
|
*
|
|
206
239
|
* `create_app_backend` creates the one on `AppDeps.connection_closer`, and
|
|
207
|
-
* `create_app_server` adds each WebSocket
|
|
240
|
+
* `create_app_server` adds each WebSocket connection registry it mounts and its audit
|
|
208
241
|
* stream registry, removing them when its assembly fails or the server
|
|
209
|
-
* closes. A consumer that mounts a
|
|
210
|
-
* the `connection_closer` option of `
|
|
242
|
+
* closes. A consumer that mounts a connection registry by hand adds it through
|
|
243
|
+
* the `connection_closer` option of `register_action_ws` /
|
|
211
244
|
* `create_audit_log_sse`, or with `add`.
|
|
212
245
|
*/
|
|
213
246
|
export declare const create_realtime_closer: () => RealtimeCloser;
|
|
247
|
+
/**
|
|
248
|
+
* Audit-event callback shape — the function `CreateAuditEmitterOptions.on_audit_event`
|
|
249
|
+
* accepts, `AuditEmitter.add_listener` registers, and `create_revocation_guard`
|
|
250
|
+
* returns.
|
|
251
|
+
*/
|
|
252
|
+
export type AuditEventHandler = (event: AuditLogEvent) => void;
|
|
253
|
+
/**
|
|
254
|
+
* Create the audit listener that closes live connections on a successful
|
|
255
|
+
* revocation row: `to_connection_close_target` maps the row to the
|
|
256
|
+
* connections it names, and the listener closes them with
|
|
257
|
+
* `closer.close_connections`.
|
|
258
|
+
*
|
|
259
|
+
* **Why it exists beside the handlers' own closes.** The revocation handlers
|
|
260
|
+
* close after their commit (`queue_connection_close`), whatever happens to the
|
|
261
|
+
* audit write; this listener repeats that close when the row is announced,
|
|
262
|
+
* which covers a revocation emitted by code that holds no closer. Closing is
|
|
263
|
+
* idempotent, so the overlap is a repeat. A success row is announced only after
|
|
264
|
+
* its request's transaction commits (`auth/audit_emitter.ts`), so this close is
|
|
265
|
+
* post-commit too, and it reaches connections still pending admission.
|
|
266
|
+
*
|
|
267
|
+
* **The role close.** `perform_action` re-authorizes every request against its
|
|
268
|
+
* own action, but an endpoint's role gate is the only check on what its
|
|
269
|
+
* connections *receive* — WebSocket broadcasts and notifications, the audit
|
|
270
|
+
* stream's rows — with no per-recipient filter, so a connection left open past
|
|
271
|
+
* the revocation would keep receiving what the gate exists to withhold. No
|
|
272
|
+
* handler closes for a role, so this listener is its one closer: a WebSocket
|
|
273
|
+
* closes with `WS_CLOSE_PERMISSION_REVOKED`, a stream gated on the role ends.
|
|
274
|
+
*
|
|
275
|
+
* Twin of the Rust spine's `register_revocation_guard`.
|
|
276
|
+
*
|
|
277
|
+
* @param closer - what to close on — `deps.connection_closer`, the fan-out over
|
|
278
|
+
* every registry, which is what `create_app_server` registers it on
|
|
279
|
+
* @param log - logger for the closes (info level, when any connection closed)
|
|
280
|
+
* @returns an `on_audit_event` callback for `create_audit_emitter`, or for
|
|
281
|
+
* `AuditEmitter.add_listener`
|
|
282
|
+
*/
|
|
283
|
+
export declare const create_revocation_guard: (closer: ConnectionCloser, log: Logger) => AuditEventHandler;
|
|
214
284
|
//# sourceMappingURL=connection_closer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection_closer.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/connection_closer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"connection_closer.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/connection_closer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAGN,KAAK,aAAa,EAClB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,MAAM,CAAC;IAC7D;;;;;;;OAOG;IACH,qBAAqB,EAAE,MAAM,MAAM,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,qBAAqB,GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,aAAa,KAAG,qBAAqB,GAAG,IA8BzF,CAAC;AAqBF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,GAC1C,QAAQ,gBAAgB,EACxB,QAAQ,qBAAqB,EAC7B,KAAK,MAAM,KACT,IAMF,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,GAClC,KAAK,sBAAsB,EAC3B,QAAQ,gBAAgB,EACxB,QAAQ,qBAAqB,KAC3B,IAIF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,gBAGnC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACvD;;;;;;;;;;;;;;;OAeG;IACH,GAAG,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,MAAM,IAAI,CAAC;IAC9C,2EAA2E;IAC3E,YAAY,EAAE,MAAM,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,QAAO,cAwCzC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,uBAAuB,GACnC,QAAQ,gBAAgB,EACxB,KAAK,MAAM,KACT,iBAWF,CAAC"}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* account delete and purge, `/logout`, `/password`, and the session and token
|
|
12
12
|
* caps for what they evict. A role revocation is the exception: it closes
|
|
13
13
|
* only the connections an endpoint gated on that role, and only through the
|
|
14
|
-
* audit
|
|
15
|
-
*
|
|
14
|
+
* audit listener (`create_revocation_guard`) — no handler holds a closer for
|
|
15
|
+
* it. The auth cleanup holds one too
|
|
16
16
|
* (`AuthCleanupDeps.connection_closer`): its session sweep closes the
|
|
17
17
|
* connections of each expired session it deletes, after that delete commits.
|
|
18
18
|
*
|
|
@@ -33,38 +33,111 @@
|
|
|
33
33
|
*
|
|
34
34
|
* ## Why the handlers close directly
|
|
35
35
|
*
|
|
36
|
-
* The audit
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* The audit listener (`create_revocation_guard`) closes connections too, but
|
|
37
|
+
* only once the audit row is written, and that write is pool-routed and
|
|
38
|
+
* fail-open. The handler's own close is the one that runs
|
|
39
39
|
* whatever happens to the audit write, so the closer it holds must reach every
|
|
40
40
|
* transport whose connections outlive their credential. `RealtimeCloser` is
|
|
41
41
|
* that fan-out, and `create_app_backend` puts one on `AppDeps`.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* ## The audit listener
|
|
44
|
+
*
|
|
45
|
+
* `create_revocation_guard` repeats a revocation's close when its audit row is
|
|
46
|
+
* announced, which covers a revocation emitted by code that holds no closer,
|
|
47
|
+
* and is the one closer of a role revocation. `create_app_server` registers one
|
|
48
|
+
* on `deps.connection_closer` when it mounts a WebSocket endpoint or the audit
|
|
49
|
+
* stream, so it reaches every member — each WebSocket connection registry and the audit
|
|
50
|
+
* stream registry — through the one fan-out.
|
|
51
|
+
*
|
|
52
|
+
* Twin of the Rust spine's `ConnectionCloser`, `ConnectionCloseTarget`,
|
|
53
|
+
* `queue_connection_close`, `RealtimeCloser`, and
|
|
54
|
+
* `register_revocation_guard`.
|
|
45
55
|
*
|
|
46
56
|
* @module
|
|
47
57
|
*/
|
|
48
58
|
import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
|
|
49
59
|
import { emit_after_commit } from '../http/pending_effects.js';
|
|
60
|
+
import { to_global_role_revocation, to_revocation_scope } from '../auth/audit_log_schema.js';
|
|
50
61
|
/**
|
|
51
|
-
*
|
|
62
|
+
* The connections a revocation's audit row closes, dispatched on the
|
|
63
|
+
* `RevocationScope` its event declares in `audit_event_revocation_scopes`
|
|
64
|
+
* (`auth/audit_log_schema.ts`) — `null` when it closes nothing:
|
|
65
|
+
*
|
|
66
|
+
* - a row whose outcome is not `success` — a failure carries
|
|
67
|
+
* attacker-controlled identifiers (a `session_revoke` the DB rejected still
|
|
68
|
+
* records the submitted session id), so reacting to it would let any
|
|
69
|
+
* authenticated caller close another user's connection by guessing a session
|
|
70
|
+
* hash or token id; matching the success rather than skipping the failure
|
|
71
|
+
* keeps an outcome outside the enum inert
|
|
72
|
+
* - scope `none` — every event that revokes nothing, and any event type
|
|
73
|
+
* fuz_app does not define
|
|
74
|
+
* - a row missing the key its scope closes by (an empty string included)
|
|
75
|
+
* - a `role` row whose revoked grant was scoped (`to_global_role_revocation`)
|
|
52
76
|
*
|
|
53
|
-
*
|
|
54
|
-
* after the commit.
|
|
77
|
+
* Otherwise:
|
|
55
78
|
*
|
|
56
|
-
*
|
|
79
|
+
* - `session` → `{kind: 'session', session_hash: metadata.session_id}`
|
|
80
|
+
* - `token` → `{kind: 'token', api_token_id: metadata.token_id}`
|
|
81
|
+
* - `account` → `{kind: 'account', account_id: target_account_id ?? account_id}`
|
|
82
|
+
* — admin actions set `target_account_id`, self-service ones only
|
|
83
|
+
* `account_id`
|
|
84
|
+
* - `role` → `{kind: 'role', account_id, role}` of the revoked global grant
|
|
85
|
+
*
|
|
86
|
+
* Twin of the Rust spine's `ConnectionCloseTarget::from_audit_event`.
|
|
87
|
+
*
|
|
88
|
+
* @param event - the audit row announced after its commit
|
|
89
|
+
* @returns the connections to close, or `null`
|
|
57
90
|
*/
|
|
58
|
-
export const
|
|
91
|
+
export const to_connection_close_target = (event) => {
|
|
92
|
+
if (event.outcome !== 'success')
|
|
93
|
+
return null;
|
|
94
|
+
const scope = to_revocation_scope(event.event_type);
|
|
95
|
+
switch (scope) {
|
|
96
|
+
case 'none':
|
|
97
|
+
return null;
|
|
98
|
+
case 'session': {
|
|
99
|
+
const session_id = event.metadata?.session_id;
|
|
100
|
+
if (typeof session_id !== 'string' || session_id.length === 0)
|
|
101
|
+
return null;
|
|
102
|
+
return { kind: 'session', session_hash: session_id };
|
|
103
|
+
}
|
|
104
|
+
case 'token': {
|
|
105
|
+
const token_id = event.metadata?.token_id;
|
|
106
|
+
if (typeof token_id !== 'string' || token_id.length === 0)
|
|
107
|
+
return null;
|
|
108
|
+
return { kind: 'token', api_token_id: token_id };
|
|
109
|
+
}
|
|
110
|
+
case 'account': {
|
|
111
|
+
const account_id = event.target_account_id ?? event.account_id;
|
|
112
|
+
if (!account_id)
|
|
113
|
+
return null;
|
|
114
|
+
return { kind: 'account', account_id };
|
|
115
|
+
}
|
|
116
|
+
case 'role': {
|
|
117
|
+
// global grants only — a role gate never admitted on a scoped one
|
|
118
|
+
const revoked = to_global_role_revocation(event);
|
|
119
|
+
if (!revoked)
|
|
120
|
+
return null;
|
|
121
|
+
return { kind: 'role', account_id: revoked.account_id, role: revoked.role };
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
throw new UnreachableError(scope);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* The log text for a close target — `session <hash>`, `token <id>`,
|
|
129
|
+
* `account <id>`, `role <role> of account <id>`.
|
|
130
|
+
*/
|
|
131
|
+
const format_connection_close_target = (target) => {
|
|
59
132
|
switch (target.kind) {
|
|
60
133
|
case 'session':
|
|
61
|
-
return
|
|
134
|
+
return `session ${target.session_hash}`;
|
|
62
135
|
case 'token':
|
|
63
|
-
return
|
|
136
|
+
return `token ${target.api_token_id}`;
|
|
64
137
|
case 'account':
|
|
65
|
-
return
|
|
138
|
+
return `account ${target.account_id}`;
|
|
66
139
|
case 'role':
|
|
67
|
-
return
|
|
140
|
+
return `role ${target.role} of account ${target.account_id}`;
|
|
68
141
|
default:
|
|
69
142
|
throw new UnreachableError(target);
|
|
70
143
|
}
|
|
@@ -85,7 +158,7 @@ export const close_connections = (closer, target) => {
|
|
|
85
158
|
*/
|
|
86
159
|
export const close_connections_after_commit = (closer, target, log) => {
|
|
87
160
|
try {
|
|
88
|
-
close_connections(
|
|
161
|
+
closer.close_connections(target);
|
|
89
162
|
}
|
|
90
163
|
catch (err) {
|
|
91
164
|
log.error('connection close after commit failed:', err);
|
|
@@ -110,7 +183,7 @@ export const close_connections_after_commit = (closer, target, log) => {
|
|
|
110
183
|
*/
|
|
111
184
|
export const queue_connection_close = (ctx, closer, target) => {
|
|
112
185
|
emit_after_commit(ctx, () => {
|
|
113
|
-
close_connections(
|
|
186
|
+
closer.close_connections(target);
|
|
114
187
|
});
|
|
115
188
|
};
|
|
116
189
|
/**
|
|
@@ -118,20 +191,17 @@ export const queue_connection_close = (ctx, closer, target) => {
|
|
|
118
191
|
* live-connection surface, where a revocation has nothing to close.
|
|
119
192
|
*/
|
|
120
193
|
export const noop_connection_closer = Object.freeze({
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
close_sockets_for_account: () => 0,
|
|
124
|
-
close_sockets_for_role: () => 0,
|
|
125
|
-
close_all_sockets: () => 0
|
|
194
|
+
close_connections: () => 0,
|
|
195
|
+
close_all_connections: () => 0
|
|
126
196
|
});
|
|
127
197
|
/**
|
|
128
198
|
* Create an empty `RealtimeCloser`.
|
|
129
199
|
*
|
|
130
200
|
* `create_app_backend` creates the one on `AppDeps.connection_closer`, and
|
|
131
|
-
* `create_app_server` adds each WebSocket
|
|
201
|
+
* `create_app_server` adds each WebSocket connection registry it mounts and its audit
|
|
132
202
|
* stream registry, removing them when its assembly fails or the server
|
|
133
|
-
* closes. A consumer that mounts a
|
|
134
|
-
* the `connection_closer` option of `
|
|
203
|
+
* closes. A consumer that mounts a connection registry by hand adds it through
|
|
204
|
+
* the `connection_closer` option of `register_action_ws` /
|
|
135
205
|
* `create_audit_log_sse`, or with `add`.
|
|
136
206
|
*/
|
|
137
207
|
export const create_realtime_closer = () => {
|
|
@@ -176,10 +246,48 @@ export const create_realtime_closer = () => {
|
|
|
176
246
|
};
|
|
177
247
|
},
|
|
178
248
|
member_count: () => members.size,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
close_sockets_for_account: (account_id) => fan_out((member) => member.close_sockets_for_account(account_id)),
|
|
182
|
-
close_sockets_for_role: (account_id, role) => fan_out((member) => member.close_sockets_for_role(account_id, role)),
|
|
183
|
-
close_all_sockets: () => fan_out((member) => member.close_all_sockets())
|
|
249
|
+
close_connections: (target) => fan_out((member) => member.close_connections(target)),
|
|
250
|
+
close_all_connections: () => fan_out((member) => member.close_all_connections())
|
|
184
251
|
});
|
|
185
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* Create the audit listener that closes live connections on a successful
|
|
255
|
+
* revocation row: `to_connection_close_target` maps the row to the
|
|
256
|
+
* connections it names, and the listener closes them with
|
|
257
|
+
* `closer.close_connections`.
|
|
258
|
+
*
|
|
259
|
+
* **Why it exists beside the handlers' own closes.** The revocation handlers
|
|
260
|
+
* close after their commit (`queue_connection_close`), whatever happens to the
|
|
261
|
+
* audit write; this listener repeats that close when the row is announced,
|
|
262
|
+
* which covers a revocation emitted by code that holds no closer. Closing is
|
|
263
|
+
* idempotent, so the overlap is a repeat. A success row is announced only after
|
|
264
|
+
* its request's transaction commits (`auth/audit_emitter.ts`), so this close is
|
|
265
|
+
* post-commit too, and it reaches connections still pending admission.
|
|
266
|
+
*
|
|
267
|
+
* **The role close.** `perform_action` re-authorizes every request against its
|
|
268
|
+
* own action, but an endpoint's role gate is the only check on what its
|
|
269
|
+
* connections *receive* — WebSocket broadcasts and notifications, the audit
|
|
270
|
+
* stream's rows — with no per-recipient filter, so a connection left open past
|
|
271
|
+
* the revocation would keep receiving what the gate exists to withhold. No
|
|
272
|
+
* handler closes for a role, so this listener is its one closer: a WebSocket
|
|
273
|
+
* closes with `WS_CLOSE_PERMISSION_REVOKED`, a stream gated on the role ends.
|
|
274
|
+
*
|
|
275
|
+
* Twin of the Rust spine's `register_revocation_guard`.
|
|
276
|
+
*
|
|
277
|
+
* @param closer - what to close on — `deps.connection_closer`, the fan-out over
|
|
278
|
+
* every registry, which is what `create_app_server` registers it on
|
|
279
|
+
* @param log - logger for the closes (info level, when any connection closed)
|
|
280
|
+
* @returns an `on_audit_event` callback for `create_audit_emitter`, or for
|
|
281
|
+
* `AuditEmitter.add_listener`
|
|
282
|
+
*/
|
|
283
|
+
export const create_revocation_guard = (closer, log) => {
|
|
284
|
+
return (event) => {
|
|
285
|
+
const target = to_connection_close_target(event);
|
|
286
|
+
if (!target)
|
|
287
|
+
return;
|
|
288
|
+
const closed = closer.close_connections(target);
|
|
289
|
+
if (closed > 0) {
|
|
290
|
+
log.info(`revocation guard: closed ${closed} connection(s) for ${format_connection_close_target(target)} (${event.event_type})`);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
};
|