@fuzdev/fuz_app 0.150.0 → 0.152.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 +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- 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_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 -34
- 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 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- 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 +52 -75
- 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 +70 -44
- 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_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 +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- 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 +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -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 +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- 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 +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- 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/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_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- 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_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -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 +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- 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 +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- 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 +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- 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/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 +1 -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 +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- 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 +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- 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/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_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- 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/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 +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- 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 +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- 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 +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- 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 +179 -158
- 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 -77
- 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/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 +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- 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_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 +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- 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/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 +9 -2
- 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 +23 -1
- 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_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 +45 -3
- 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 +9 -8
- 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 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- 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 -239
- 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
|
@@ -27,15 +27,14 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @module
|
|
29
29
|
*/
|
|
30
|
-
import { rpc_action } from '../actions/
|
|
30
|
+
import { rpc_action } from '../actions/action_types.js';
|
|
31
31
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
32
32
|
import { is_pg_unique_violation } from '../db/pg_error.js';
|
|
33
33
|
import { cell_item_insert_action_spec, cell_item_move_action_spec, cell_item_delete_action_spec, cell_item_list_action_spec, ERROR_CELL_ITEM_POSITION_TAKEN, ERROR_CELL_ITEM_LIST_REQUIRES_PARENT_OR_CHILD } from './cell_item_action_specs.js';
|
|
34
34
|
import { ERROR_CELL_NOT_FOUND } from './cell_action_specs.js';
|
|
35
|
-
import {
|
|
35
|
+
import { cell_viewer_from_auth } from './cell_authorize.js';
|
|
36
|
+
import { emit_cell_audit, require_editable_cell, require_viewable_cell } from './cell_action_helpers.js';
|
|
36
37
|
import { CELL_RELATION_LIST_LIMIT_DEFAULT } from './cell_relation_list_limit.js';
|
|
37
|
-
import { query_cell_get } from '../db/cell_queries.js';
|
|
38
|
-
import { query_cell_grant_list_for_cell } from '../db/cell_grant_queries.js';
|
|
39
38
|
import { query_cell_item_insert, query_cell_item_move, query_cell_item_delete, query_cell_item_list_for_parent, query_cell_item_list_for_child } from '../db/cell_item_queries.js';
|
|
40
39
|
export const to_item_json = (row) => ({
|
|
41
40
|
parent_id: row.parent_id,
|
|
@@ -54,23 +53,9 @@ const position_taken_error = () => jsonrpc_errors.invalid_params('cell_item posi
|
|
|
54
53
|
export const create_cell_item_actions = (deps) => {
|
|
55
54
|
const insert_handler = async (input, ctx) => {
|
|
56
55
|
const auth = ctx.auth;
|
|
57
|
-
|
|
58
|
-
if (!parent) {
|
|
59
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
60
|
-
}
|
|
61
|
-
const parent_grants = await query_cell_grant_list_for_cell(ctx, parent.id);
|
|
62
|
-
if (!can_edit_cell(auth, parent, parent_grants)) {
|
|
63
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
64
|
-
}
|
|
65
|
-
const child = await query_cell_get(ctx, input.child_id);
|
|
66
|
-
if (!child) {
|
|
67
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
68
|
-
}
|
|
56
|
+
await require_editable_cell(ctx, auth, input.parent_id);
|
|
69
57
|
// Child must be view-admitted — otherwise insert leaks existence.
|
|
70
|
-
|
|
71
|
-
if (!can_view_cell(auth, child, child_grants)) {
|
|
72
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
73
|
-
}
|
|
58
|
+
await require_viewable_cell(ctx, auth, input.child_id);
|
|
74
59
|
let row;
|
|
75
60
|
try {
|
|
76
61
|
row = await query_cell_item_insert(ctx, {
|
|
@@ -84,29 +69,16 @@ export const create_cell_item_actions = (deps) => {
|
|
|
84
69
|
throw position_taken_error();
|
|
85
70
|
throw err;
|
|
86
71
|
}
|
|
87
|
-
deps.audit
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
ip: ctx.client_ip,
|
|
92
|
-
metadata: {
|
|
93
|
-
parent_id: row.parent_id,
|
|
94
|
-
position: row.position,
|
|
95
|
-
child_id: row.child_id
|
|
96
|
-
}
|
|
72
|
+
emit_cell_audit(ctx, deps.audit, auth, 'cell_item_insert', {
|
|
73
|
+
parent_id: row.parent_id,
|
|
74
|
+
position: row.position,
|
|
75
|
+
child_id: row.child_id
|
|
97
76
|
});
|
|
98
77
|
return { item: to_item_json(row) };
|
|
99
78
|
};
|
|
100
79
|
const move_handler = async (input, ctx) => {
|
|
101
80
|
const auth = ctx.auth;
|
|
102
|
-
|
|
103
|
-
if (!parent) {
|
|
104
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
105
|
-
}
|
|
106
|
-
const parent_grants = await query_cell_grant_list_for_cell(ctx, parent.id);
|
|
107
|
-
if (!can_edit_cell(auth, parent, parent_grants)) {
|
|
108
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
109
|
-
}
|
|
81
|
+
await require_editable_cell(ctx, auth, input.parent_id);
|
|
110
82
|
let row;
|
|
111
83
|
try {
|
|
112
84
|
row = await query_cell_item_move(ctx, input.parent_id, input.position, input.new_position);
|
|
@@ -120,41 +92,22 @@ export const create_cell_item_actions = (deps) => {
|
|
|
120
92
|
// Source row missing — raced with deleter. 404 covers the gap.
|
|
121
93
|
throw jsonrpc_errors.not_found('cell_item', { reason: ERROR_CELL_NOT_FOUND });
|
|
122
94
|
}
|
|
123
|
-
deps.audit
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
ip: ctx.client_ip,
|
|
128
|
-
metadata: {
|
|
129
|
-
parent_id: row.parent_id,
|
|
130
|
-
position_old: input.position,
|
|
131
|
-
position_new: row.position
|
|
132
|
-
}
|
|
95
|
+
emit_cell_audit(ctx, deps.audit, auth, 'cell_item_move', {
|
|
96
|
+
parent_id: row.parent_id,
|
|
97
|
+
position_old: input.position,
|
|
98
|
+
position_new: row.position
|
|
133
99
|
});
|
|
134
100
|
return { item: to_item_json(row) };
|
|
135
101
|
};
|
|
136
102
|
const delete_handler = async (input, ctx) => {
|
|
137
103
|
const auth = ctx.auth;
|
|
138
|
-
|
|
139
|
-
if (!parent) {
|
|
140
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
141
|
-
}
|
|
142
|
-
const parent_grants = await query_cell_grant_list_for_cell(ctx, parent.id);
|
|
143
|
-
if (!can_edit_cell(auth, parent, parent_grants)) {
|
|
144
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
145
|
-
}
|
|
104
|
+
await require_editable_cell(ctx, auth, input.parent_id);
|
|
146
105
|
const deleted = await query_cell_item_delete(ctx, input.parent_id, input.position);
|
|
147
106
|
if (deleted) {
|
|
148
|
-
deps.audit
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
ip: ctx.client_ip,
|
|
153
|
-
metadata: {
|
|
154
|
-
parent_id: deleted.parent_id,
|
|
155
|
-
position: deleted.position,
|
|
156
|
-
child_id: deleted.child_id
|
|
157
|
-
}
|
|
107
|
+
emit_cell_audit(ctx, deps.audit, auth, 'cell_item_delete', {
|
|
108
|
+
parent_id: deleted.parent_id,
|
|
109
|
+
position: deleted.position,
|
|
110
|
+
child_id: deleted.child_id
|
|
158
111
|
});
|
|
159
112
|
}
|
|
160
113
|
return { ok: true, deleted: deleted !== null };
|
|
@@ -174,26 +127,12 @@ export const create_cell_item_actions = (deps) => {
|
|
|
174
127
|
// whose child the caller may view (strict target-visibility, in SQL
|
|
175
128
|
// before the limit).
|
|
176
129
|
if (input.parent_id !== undefined) {
|
|
177
|
-
const parent = await
|
|
178
|
-
if (!parent) {
|
|
179
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
180
|
-
}
|
|
181
|
-
const parent_grants = auth ? await query_cell_grant_list_for_cell(ctx, parent.id) : null;
|
|
182
|
-
if (!can_view_cell(auth, parent, parent_grants)) {
|
|
183
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
184
|
-
}
|
|
130
|
+
const parent = await require_viewable_cell(ctx, auth, input.parent_id);
|
|
185
131
|
const rows = await query_cell_item_list_for_parent(ctx, cell_viewer_from_auth(auth), parent.id, { limit, position_after: input.position_after });
|
|
186
132
|
return { items: rows.map(to_item_json) };
|
|
187
133
|
}
|
|
188
134
|
// Reverse listing: 2-layer authz. First, can_view_cell(child).
|
|
189
|
-
const child = await
|
|
190
|
-
if (!child) {
|
|
191
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
192
|
-
}
|
|
193
|
-
const child_grants = auth ? await query_cell_grant_list_for_cell(ctx, child.id) : null;
|
|
194
|
-
if (!can_view_cell(auth, child, child_grants)) {
|
|
195
|
-
throw jsonrpc_errors.not_found('cell', { reason: ERROR_CELL_NOT_FOUND });
|
|
196
|
-
}
|
|
135
|
+
const child = await require_viewable_cell(ctx, auth, input.child_id);
|
|
197
136
|
// Then page the items whose parent the caller may view — filtered in
|
|
198
137
|
// SQL before the limit, so hidden parents never crowd out visible ones,
|
|
199
138
|
// and bounded so a heavily inbound-linked child can't force an
|
package/dist/auth/cleanup.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export interface AuthCleanupDeps extends QueryDeps {
|
|
|
141
141
|
/**
|
|
142
142
|
* Closes the connections of each session the sweep deletes. Pass the
|
|
143
143
|
* closer the app's revocation handlers hold — `AppDeps.connection_closer`,
|
|
144
|
-
* the `RealtimeCloser` over every
|
|
144
|
+
* the `RealtimeCloser` over every registry it serves. Required: a sweep
|
|
145
145
|
* with nothing to close through would strand the swept sessions'
|
|
146
146
|
* connections. `noop_connection_closer` is for a database no other
|
|
147
147
|
* process holds connections on — a sweep run beside a live server from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC,QAAiB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,YAAY,CAAC;IACpB;;;;;;;;;OASG;IACH,iBAAiB,EAAE,gBAAgB,CAAC;CACpC;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IACjC,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,wBAAwB,GAAU,MAAM,eAAe,KAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC,QAAiB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,YAAY,CAAC;IACpB;;;;;;;;;OASG;IACH,iBAAiB,EAAE,gBAAgB,CAAC;CACpC;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IACjC,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,wBAAwB,GAAU,MAAM,eAAe,KAAG,OAAO,CAAC,MAAM,CAwCpF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iCAAiC,GAAU,MAAM,eAAe,KAAG,OAAO,CAAC,MAAM,CAgC7F,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAU,MAAM,eAAe,KAAG,OAAO,CAAC,iBAAiB,CAIvF,CAAC;AAEF,wCAAwC;AACxC,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,kBAAkB,GAC9B,MAAM,eAAe,EACrB,UAAS,0BAA+B,KACtC,YAWD,CAAC"}
|
package/dist/auth/cleanup.js
CHANGED
|
@@ -164,12 +164,15 @@ export const cleanup_expired_sessions = async (deps) => {
|
|
|
164
164
|
// the transaction has settled. The closes are synchronous, so nothing can
|
|
165
165
|
// interleave between the first and the last
|
|
166
166
|
let closed_connections = 0;
|
|
167
|
-
for (const
|
|
167
|
+
for (const session_hash of swept) {
|
|
168
168
|
try {
|
|
169
|
-
closed_connections += deps.connection_closer.
|
|
169
|
+
closed_connections += deps.connection_closer.close_connections({
|
|
170
|
+
kind: 'session',
|
|
171
|
+
session_hash
|
|
172
|
+
});
|
|
170
173
|
}
|
|
171
174
|
catch (error) {
|
|
172
|
-
// keep going — one
|
|
175
|
+
// keep going — one registry's failure must not leave another
|
|
173
176
|
// expired session's connections open
|
|
174
177
|
deps.log.error("auth cleanup failed to close an expired session's connections:", error);
|
|
175
178
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* A WebSocket or an SSE stream is authorized once, at open, and closed on
|
|
6
6
|
* revocation by identity. Expiry has no revocation event: nothing is written
|
|
7
7
|
* when a session or token passes its `expires_at`. So the auth middleware
|
|
8
|
-
* computes the deadline once (`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* computes the deadline once (`ResolvedAuth.credential_deadline`) and the
|
|
9
|
+
* transport closes the connection when it arrives
|
|
10
|
+
* (`schedule_credential_deadline`).
|
|
11
11
|
*
|
|
12
12
|
* The deadline is the earliest of what the credential carries:
|
|
13
13
|
*
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* A WebSocket or an SSE stream is authorized once, at open, and closed on
|
|
6
6
|
* revocation by identity. Expiry has no revocation event: nothing is written
|
|
7
7
|
* when a session or token passes its `expires_at`. So the auth middleware
|
|
8
|
-
* computes the deadline once (`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* computes the deadline once (`ResolvedAuth.credential_deadline`) and the
|
|
9
|
+
* transport closes the connection when it arrives
|
|
10
|
+
* (`schedule_credential_deadline`).
|
|
11
11
|
*
|
|
12
12
|
* The deadline is the earliest of what the credential carries:
|
|
13
13
|
*
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* open-registry pattern used for `RoleName`, `ScopeKindName`,
|
|
13
13
|
* `GrantPathName`, and `AuditEventTypeName`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* `hono_context.ts`)
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* `BuiltinCredentialType` is the closed set middleware sets on the Hono
|
|
16
|
+
* context (`hono_context.ts`) and the audit log records — middleware only
|
|
17
|
+
* ever authenticates through a builtin. Consumer-declared types live in
|
|
18
|
+
* the registry `create_credential_type_schema` builds, consulted when
|
|
19
|
+
* validating `RoleSpec.required_credential_types`.
|
|
20
20
|
*
|
|
21
21
|
* @module
|
|
22
22
|
*/
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* open-registry pattern used for `RoleName`, `ScopeKindName`,
|
|
13
13
|
* `GrantPathName`, and `AuditEventTypeName`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* `hono_context.ts`)
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* `BuiltinCredentialType` is the closed set middleware sets on the Hono
|
|
16
|
+
* context (`hono_context.ts`) and the audit log records — middleware only
|
|
17
|
+
* ever authenticates through a builtin. Consumer-declared types live in
|
|
18
|
+
* the registry `create_credential_type_schema` builds, consulted when
|
|
19
|
+
* validating `RoleSpec.required_credential_types`.
|
|
20
20
|
*
|
|
21
21
|
* @module
|
|
22
22
|
*/
|
|
@@ -34,10 +34,15 @@ import { type DaemonTokenState } from './daemon_token.js';
|
|
|
34
34
|
*/
|
|
35
35
|
export declare const resolve_keeper_account_id: (deps: QueryDeps) => Promise<string | null>;
|
|
36
36
|
/**
|
|
37
|
-
* Create middleware that authenticates via daemon token
|
|
37
|
+
* Create middleware that authenticates via daemon token — the first leg of the
|
|
38
|
+
* auth middleware chain, as in the Rust spine's `resolve_auth_from_headers`.
|
|
39
|
+
*
|
|
40
|
+
* Being first, it starts the chain from a clean slate: it clears
|
|
41
|
+
* `RESOLVED_AUTH_KEY` on entry, so a layer mounted before the credential legs
|
|
42
|
+
* cannot pre-set an identity that every leg would then skip past.
|
|
38
43
|
*
|
|
39
44
|
* Checks the `X-Daemon-Token` header. Behavior:
|
|
40
|
-
* - No header: pass through
|
|
45
|
+
* - No header: pass through.
|
|
41
46
|
* - Header present + `Origin` / `Referer` present: discard the credential
|
|
42
47
|
* (browser context) and pass through — daemon tokens are loopback-only and
|
|
43
48
|
* never carry an `Origin` in production, so a header-bearing request is not
|
|
@@ -56,9 +61,10 @@ export declare const resolve_keeper_account_id: (deps: QueryDeps) => Promise<str
|
|
|
56
61
|
* mirrors the Rust spine's `resolve.rs` (`None`), so the request falls
|
|
57
62
|
* through to anonymous and a daemon-gated action returns
|
|
58
63
|
* `credential_type_required` downstream.
|
|
59
|
-
* - Header present + valid + ok: set `
|
|
60
|
-
*
|
|
61
|
-
*
|
|
64
|
+
* - Header present + valid + ok: set the `daemon_token` arm of `ResolvedAuth`
|
|
65
|
+
* (`RESOLVED_AUTH_KEY`) for the keeper account. The session and bearer legs
|
|
66
|
+
* after it see the request resolved and skip, so a cookie or bearer sent
|
|
67
|
+
* beside the daemon token is never looked up.
|
|
62
68
|
*
|
|
63
69
|
* Acting-actor resolution + `RequestContext` construction are deferred
|
|
64
70
|
* to the dispatcher's authorization phase. Multi-actor keeper accounts
|
|
@@ -68,7 +74,7 @@ export declare const resolve_keeper_account_id: (deps: QueryDeps) => Promise<str
|
|
|
68
74
|
* @param state - the daemon token runtime state
|
|
69
75
|
* @param deps - query dependencies (pool-level db for keeper-account resolution)
|
|
70
76
|
* @param log - the logger instance
|
|
71
|
-
* @mutates Hono context -
|
|
77
|
+
* @mutates Hono context - clears `RESOLVED_AUTH_KEY` on entry, then sets it on a valid token
|
|
72
78
|
*/
|
|
73
79
|
export declare const create_daemon_token_middleware: (state: DaemonTokenState, deps: QueryDeps, log: Logger) => MiddlewareHandler;
|
|
74
80
|
//# sourceMappingURL=daemon_token_middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon_token_middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/daemon_token_middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"daemon_token_middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/daemon_token_middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAMtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,GAAU,MAAM,SAAS,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAEtF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,8BAA8B,GAC1C,OAAO,gBAAgB,EACvB,MAAM,SAAS,EACf,KAAK,MAAM,KACT,iBAkFF,CAAC"}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
16
|
import { DEV } from 'esm-env';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { RESOLVED_AUTH_KEY } from '../hono_context.js';
|
|
18
|
+
import { get_resolved_auth } from './resolved_auth.js';
|
|
19
19
|
import { is_browser_context } from '../http/origin.js';
|
|
20
20
|
import { query_role_grant_find_account_id_for_role } from './role_grant_queries.js';
|
|
21
21
|
import { ROLE_KEEPER } from './role_schema.js';
|
|
@@ -39,10 +39,15 @@ export const resolve_keeper_account_id = async (deps) => {
|
|
|
39
39
|
return query_role_grant_find_account_id_for_role(deps, ROLE_KEEPER);
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
* Create middleware that authenticates via daemon token
|
|
42
|
+
* Create middleware that authenticates via daemon token — the first leg of the
|
|
43
|
+
* auth middleware chain, as in the Rust spine's `resolve_auth_from_headers`.
|
|
44
|
+
*
|
|
45
|
+
* Being first, it starts the chain from a clean slate: it clears
|
|
46
|
+
* `RESOLVED_AUTH_KEY` on entry, so a layer mounted before the credential legs
|
|
47
|
+
* cannot pre-set an identity that every leg would then skip past.
|
|
43
48
|
*
|
|
44
49
|
* Checks the `X-Daemon-Token` header. Behavior:
|
|
45
|
-
* - No header: pass through
|
|
50
|
+
* - No header: pass through.
|
|
46
51
|
* - Header present + `Origin` / `Referer` present: discard the credential
|
|
47
52
|
* (browser context) and pass through — daemon tokens are loopback-only and
|
|
48
53
|
* never carry an `Origin` in production, so a header-bearing request is not
|
|
@@ -61,9 +66,10 @@ export const resolve_keeper_account_id = async (deps) => {
|
|
|
61
66
|
* mirrors the Rust spine's `resolve.rs` (`None`), so the request falls
|
|
62
67
|
* through to anonymous and a daemon-gated action returns
|
|
63
68
|
* `credential_type_required` downstream.
|
|
64
|
-
* - Header present + valid + ok: set `
|
|
65
|
-
*
|
|
66
|
-
*
|
|
69
|
+
* - Header present + valid + ok: set the `daemon_token` arm of `ResolvedAuth`
|
|
70
|
+
* (`RESOLVED_AUTH_KEY`) for the keeper account. The session and bearer legs
|
|
71
|
+
* after it see the request resolved and skip, so a cookie or bearer sent
|
|
72
|
+
* beside the daemon token is never looked up.
|
|
67
73
|
*
|
|
68
74
|
* Acting-actor resolution + `RequestContext` construction are deferred
|
|
69
75
|
* to the dispatcher's authorization phase. Multi-actor keeper accounts
|
|
@@ -73,10 +79,16 @@ export const resolve_keeper_account_id = async (deps) => {
|
|
|
73
79
|
* @param state - the daemon token runtime state
|
|
74
80
|
* @param deps - query dependencies (pool-level db for keeper-account resolution)
|
|
75
81
|
* @param log - the logger instance
|
|
76
|
-
* @mutates Hono context -
|
|
82
|
+
* @mutates Hono context - clears `RESOLVED_AUTH_KEY` on entry, then sets it on a valid token
|
|
77
83
|
*/
|
|
78
84
|
export const create_daemon_token_middleware = (state, deps, log) => {
|
|
79
85
|
return async (c, next) => {
|
|
86
|
+
// the chain's clean slate — nothing before the credential legs resolves
|
|
87
|
+
const cleared = get_resolved_auth(c);
|
|
88
|
+
if (cleared !== null) {
|
|
89
|
+
log.debug(`daemon token leg cleared a credential (${cleared.credential_type}) set before it`);
|
|
90
|
+
}
|
|
91
|
+
c.set(RESOLVED_AUTH_KEY, null);
|
|
80
92
|
const token_header = c.req.header(DAEMON_TOKEN_HEADER);
|
|
81
93
|
if (!token_header) {
|
|
82
94
|
await next();
|
|
@@ -135,15 +147,14 @@ export const create_daemon_token_middleware = (state, deps, log) => {
|
|
|
135
147
|
await next();
|
|
136
148
|
return;
|
|
137
149
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
c.set(CREDENTIAL_DEADLINE_KEY, null);
|
|
150
|
+
// Full authority (`resolved_auth_scope`): singular, filesystem-proved,
|
|
151
|
+
// keeper-bound — no minting step at which a narrowing could have been
|
|
152
|
+
// chosen. No row, no expiry.
|
|
153
|
+
c.set(RESOLVED_AUTH_KEY, {
|
|
154
|
+
credential_type: 'daemon_token',
|
|
155
|
+
account_id: state.keeper_account_id,
|
|
156
|
+
credential_deadline: null
|
|
157
|
+
});
|
|
147
158
|
await next();
|
|
148
159
|
};
|
|
149
160
|
};
|
package/dist/auth/deps.d.ts
CHANGED
|
@@ -51,11 +51,11 @@ export interface AppDeps {
|
|
|
51
51
|
/**
|
|
52
52
|
* Closes live connections — WebSocket and SSE — when a credential is
|
|
53
53
|
* revoked. Every revocation handler queues its close on this
|
|
54
|
-
* (`queue_connection_close`), so it must reach every
|
|
54
|
+
* (`queue_connection_close`), so it must reach every registry of the
|
|
55
55
|
* backend: `create_app_backend` creates it empty, and `create_app_server`
|
|
56
|
-
* adds each WebSocket
|
|
57
|
-
*
|
|
58
|
-
* option of `
|
|
56
|
+
* adds each WebSocket registry it mounts and its audit stream registry. A
|
|
57
|
+
* registry mounted by hand is added through the `connection_closer`
|
|
58
|
+
* option of `register_action_ws` / `create_audit_log_sse`.
|
|
59
59
|
*/
|
|
60
60
|
connection_closer: RealtimeCloser;
|
|
61
61
|
/**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wall-clock floor on auth-denial responses, shared by login and signup.
|
|
3
|
+
*
|
|
4
|
+
* Without a floor on denial paths, an attacker can tell cheap rejections
|
|
5
|
+
* (signup's `no_matching_invite`, which bails before Argon2 and the
|
|
6
|
+
* transaction) from expensive ones (`signup_conflict`, Argon2 + transaction +
|
|
7
|
+
* rollback) by response time, and use the gap as a username-enumeration
|
|
8
|
+
* oracle. Each route picks its own floor and jitter; this module holds the
|
|
9
|
+
* delay and the loud warning when a floor is turned off. Twin of the Rust
|
|
10
|
+
* spine's `fuz_auth::timing`.
|
|
11
|
+
*
|
|
12
|
+
* 429 responses take no floor — they short-circuit before any work, and their
|
|
13
|
+
* timing is no enumeration signal.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
18
|
+
/** Which denial-timing floor a disabled-floor banner names. */
|
|
19
|
+
export type FailFloor = 'login' | 'signup';
|
|
20
|
+
/** The stderr line a process prints when the login failure floor is off — the Rust spine's text. */
|
|
21
|
+
export declare const LOGIN_FAIL_FLOOR_DISABLED_BANNER = "!!! LOGIN FAILURE TIMING FLOOR DISABLED \u2014 test-only mode. A production server must never print this.";
|
|
22
|
+
/** The stderr line a process prints when the signup failure floor is off — the Rust spine's text. */
|
|
23
|
+
export declare const SIGNUP_FAIL_FLOOR_DISABLED_BANNER = "!!! SIGNUP FAILURE TIMING FLOOR DISABLED \u2014 test-only mode. A production server must never print this.";
|
|
24
|
+
/**
|
|
25
|
+
* Announce, once per module instance per floor, that a denial-timing floor is
|
|
26
|
+
* off.
|
|
27
|
+
*
|
|
28
|
+
* Called by the route factories (`create_account_route_specs`,
|
|
29
|
+
* `create_signup_route_specs`) at assembly when the configured floor is `0` or
|
|
30
|
+
* less. A disabled floor turns off the username-enumeration defense, so — like
|
|
31
|
+
* the rate limiters' `announce_rate_limiters_disabled` — it goes to stderr as
|
|
32
|
+
* well as the log: a deployment that copied a test binary's `0` shows it in
|
|
33
|
+
* its first lines of output. A positive floor prints nothing.
|
|
34
|
+
*
|
|
35
|
+
* @param floor - which floor
|
|
36
|
+
* @param floor_ms - the configured floor
|
|
37
|
+
* @param log - where the warning is logged beside the stderr banner
|
|
38
|
+
*/
|
|
39
|
+
export declare const warn_if_fail_floor_disabled: (floor: FailFloor, floor_ms: number, log: Logger) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Start the denial floor: a promise resolving `floor_ms` ± `jitter_ms` from
|
|
42
|
+
* now, or at once when `floor_ms` is `0` or less (the floor disabled).
|
|
43
|
+
*
|
|
44
|
+
* Call it before the denial path's work and await it after, so the observed
|
|
45
|
+
* response time is `max(work, delay)`, not `work + delay`. The timer starts
|
|
46
|
+
* at the call. Uniform jitter keeps a stable clamp point from leaking when a
|
|
47
|
+
* path occasionally exceeds the floor; `Math.random` suffices, since only the
|
|
48
|
+
* exact delay must be unpredictable.
|
|
49
|
+
*
|
|
50
|
+
* @param floor_ms - the floor
|
|
51
|
+
* @param jitter_ms - the jitter window on either side of the floor; `0` or less for none
|
|
52
|
+
* @returns a promise resolving when the floor has passed
|
|
53
|
+
*/
|
|
54
|
+
export declare const start_fail_floor: (floor_ms: number, jitter_ms: number) => Promise<void>;
|
|
55
|
+
//# sourceMappingURL=fail_floor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fail_floor.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/fail_floor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3C,oGAAoG;AACpG,eAAO,MAAM,gCAAgC,8GAC0D,CAAC;AAExG,qGAAqG;AACrG,eAAO,MAAM,iCAAiC,+GAC0D,CAAC;AAIzG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,GACvC,OAAO,SAAS,EAChB,UAAU,MAAM,EAChB,KAAK,MAAM,KACT,IAOF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,IAAI,CAIlF,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wall-clock floor on auth-denial responses, shared by login and signup.
|
|
3
|
+
*
|
|
4
|
+
* Without a floor on denial paths, an attacker can tell cheap rejections
|
|
5
|
+
* (signup's `no_matching_invite`, which bails before Argon2 and the
|
|
6
|
+
* transaction) from expensive ones (`signup_conflict`, Argon2 + transaction +
|
|
7
|
+
* rollback) by response time, and use the gap as a username-enumeration
|
|
8
|
+
* oracle. Each route picks its own floor and jitter; this module holds the
|
|
9
|
+
* delay and the loud warning when a floor is turned off. Twin of the Rust
|
|
10
|
+
* spine's `fuz_auth::timing`.
|
|
11
|
+
*
|
|
12
|
+
* 429 responses take no floor — they short-circuit before any work, and their
|
|
13
|
+
* timing is no enumeration signal.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/** The stderr line a process prints when the login failure floor is off — the Rust spine's text. */
|
|
18
|
+
export const LOGIN_FAIL_FLOOR_DISABLED_BANNER = '!!! LOGIN FAILURE TIMING FLOOR DISABLED — test-only mode. A production server must never print this.';
|
|
19
|
+
/** The stderr line a process prints when the signup failure floor is off — the Rust spine's text. */
|
|
20
|
+
export const SIGNUP_FAIL_FLOOR_DISABLED_BANNER = '!!! SIGNUP FAILURE TIMING FLOOR DISABLED — test-only mode. A production server must never print this.';
|
|
21
|
+
const fail_floor_warned = { login: false, signup: false };
|
|
22
|
+
/**
|
|
23
|
+
* Announce, once per module instance per floor, that a denial-timing floor is
|
|
24
|
+
* off.
|
|
25
|
+
*
|
|
26
|
+
* Called by the route factories (`create_account_route_specs`,
|
|
27
|
+
* `create_signup_route_specs`) at assembly when the configured floor is `0` or
|
|
28
|
+
* less. A disabled floor turns off the username-enumeration defense, so — like
|
|
29
|
+
* the rate limiters' `announce_rate_limiters_disabled` — it goes to stderr as
|
|
30
|
+
* well as the log: a deployment that copied a test binary's `0` shows it in
|
|
31
|
+
* its first lines of output. A positive floor prints nothing.
|
|
32
|
+
*
|
|
33
|
+
* @param floor - which floor
|
|
34
|
+
* @param floor_ms - the configured floor
|
|
35
|
+
* @param log - where the warning is logged beside the stderr banner
|
|
36
|
+
*/
|
|
37
|
+
export const warn_if_fail_floor_disabled = (floor, floor_ms, log) => {
|
|
38
|
+
if (floor_ms > 0 || fail_floor_warned[floor])
|
|
39
|
+
return;
|
|
40
|
+
fail_floor_warned[floor] = true;
|
|
41
|
+
console.error(floor === 'login' ? LOGIN_FAIL_FLOOR_DISABLED_BANNER : SIGNUP_FAIL_FLOOR_DISABLED_BANNER);
|
|
42
|
+
log.warn(`${floor} failure timing floor disabled — test-only mode`);
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Start the denial floor: a promise resolving `floor_ms` ± `jitter_ms` from
|
|
46
|
+
* now, or at once when `floor_ms` is `0` or less (the floor disabled).
|
|
47
|
+
*
|
|
48
|
+
* Call it before the denial path's work and await it after, so the observed
|
|
49
|
+
* response time is `max(work, delay)`, not `work + delay`. The timer starts
|
|
50
|
+
* at the call. Uniform jitter keeps a stable clamp point from leaking when a
|
|
51
|
+
* path occasionally exceeds the floor; `Math.random` suffices, since only the
|
|
52
|
+
* exact delay must be unpredictable.
|
|
53
|
+
*
|
|
54
|
+
* @param floor_ms - the floor
|
|
55
|
+
* @param jitter_ms - the jitter window on either side of the floor; `0` or less for none
|
|
56
|
+
* @returns a promise resolving when the floor has passed
|
|
57
|
+
*/
|
|
58
|
+
export const start_fail_floor = (floor_ms, jitter_ms) => {
|
|
59
|
+
if (floor_ms <= 0)
|
|
60
|
+
return Promise.resolve();
|
|
61
|
+
const jitter = jitter_ms > 0 ? Math.floor(Math.random() * (jitter_ms * 2 + 1)) - jitter_ms : 0;
|
|
62
|
+
return new Promise((resolve) => setTimeout(resolve, floor_ms + jitter));
|
|
63
|
+
};
|
|
@@ -27,14 +27,6 @@ export declare const INVITE_COLUMNS: readonly ["id", "email", "username", "claim
|
|
|
27
27
|
* @mutates `invite` table - inserts the new row
|
|
28
28
|
*/
|
|
29
29
|
export declare const query_create_invite: (deps: QueryDeps, input: CreateInviteInput) => Promise<Invite>;
|
|
30
|
-
/**
|
|
31
|
-
* Find an unclaimed invite by email (case-insensitive).
|
|
32
|
-
*/
|
|
33
|
-
export declare const query_invite_find_unclaimed_by_email: (deps: QueryDeps, email: string) => Promise<Invite | undefined>;
|
|
34
|
-
/**
|
|
35
|
-
* Find an unclaimed invite by username (case-insensitive).
|
|
36
|
-
*/
|
|
37
|
-
export declare const query_invite_find_unclaimed_by_username: (deps: QueryDeps, username: string) => Promise<Invite | undefined>;
|
|
38
30
|
/**
|
|
39
31
|
* Find an unclaimed invite matching email and/or username, taking a
|
|
40
32
|
* row-level write lock on the matched row.
|
|
@@ -64,9 +56,9 @@ export declare const query_invite_find_unclaimed_match_for_update: (deps: QueryD
|
|
|
64
56
|
* The `_unscoped` suffix is the safety signal — the SQL only checks the
|
|
65
57
|
* row state (`claimed_at IS NULL`), not whether the claiming account's
|
|
66
58
|
* email or username matches the invite. Callers must scope the lookup
|
|
67
|
-
* upstream
|
|
68
|
-
*
|
|
69
|
-
*
|
|
59
|
+
* upstream through `query_invite_find_unclaimed_match_for_update`, which
|
|
60
|
+
* also makes find + claim atomic. Skipping the find step lets a caller
|
|
61
|
+
* claim any unclaimed invite by id.
|
|
70
62
|
*
|
|
71
63
|
* Mirrors the `query_session_revoke_by_hash_unscoped` precedent — there
|
|
72
64
|
* is no scoped sibling because the scoping is provided by a separate
|
|
@@ -79,10 +71,6 @@ export declare const query_invite_find_unclaimed_match_for_update: (deps: QueryD
|
|
|
79
71
|
* @mutates `invite` row - sets `claimed_by` and `claimed_at` when still unclaimed
|
|
80
72
|
*/
|
|
81
73
|
export declare const query_invite_claim_unscoped: (deps: QueryDeps, invite_id: string, account_id: string) => Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* List all invites, newest first.
|
|
84
|
-
*/
|
|
85
|
-
export declare const query_invite_list_all: (deps: QueryDeps) => Promise<Array<Invite>>;
|
|
86
74
|
/**
|
|
87
75
|
* List all invites with resolved creator/claimer usernames, newest first.
|
|
88
76
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invite_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/invite_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,8FAQqB,CAAC;AAKjD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,OAAO,iBAAiB,KACtB,OAAO,CAAC,MAAM,CAQhB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"invite_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/invite_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,8FAQqB,CAAC;AAKjD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,OAAO,iBAAiB,KACtB,OAAO,CAAC,MAAM,CAQhB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4CAA4C,GACxD,MAAM,SAAS,EACf,OAAO,MAAM,GAAG,IAAI,EACpB,UAAU,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,SAAS,EACf,WAAW,MAAM,EACjB,YAAY,MAAM,KAChB,OAAO,CAAC,OAAO,CAQjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,GAChD,MAAM,SAAS,KACb,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAUxC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACzC,MAAM,SAAS,EACf,IAAI,MAAM,KACR,OAAO,CAAC,OAAO,CAMjB,CAAC"}
|
|
@@ -42,18 +42,6 @@ export const query_create_invite = async (deps, input) => {
|
|
|
42
42
|
RETURNING ${columns_sql(INVITE_COLUMNS, invite_expr(''))}`, [input.email ?? null, input.username ?? null, input.created_by]);
|
|
43
43
|
return assert_row(row, 'INSERT INTO invite');
|
|
44
44
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Find an unclaimed invite by email (case-insensitive).
|
|
47
|
-
*/
|
|
48
|
-
export const query_invite_find_unclaimed_by_email = async (deps, email) => {
|
|
49
|
-
return deps.db.query_one(`SELECT ${columns_sql(INVITE_COLUMNS, invite_expr(''))} FROM invite WHERE LOWER(email) = LOWER($1) AND claimed_at IS NULL`, [email]);
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Find an unclaimed invite by username (case-insensitive).
|
|
53
|
-
*/
|
|
54
|
-
export const query_invite_find_unclaimed_by_username = async (deps, username) => {
|
|
55
|
-
return deps.db.query_one(`SELECT ${columns_sql(INVITE_COLUMNS, invite_expr(''))} FROM invite WHERE LOWER(username) = LOWER($1) AND claimed_at IS NULL`, [username]);
|
|
56
|
-
};
|
|
57
45
|
/**
|
|
58
46
|
* Find an unclaimed invite matching email and/or username, taking a
|
|
59
47
|
* row-level write lock on the matched row.
|
|
@@ -96,9 +84,9 @@ export const query_invite_find_unclaimed_match_for_update = async (deps, email,
|
|
|
96
84
|
* The `_unscoped` suffix is the safety signal — the SQL only checks the
|
|
97
85
|
* row state (`claimed_at IS NULL`), not whether the claiming account's
|
|
98
86
|
* email or username matches the invite. Callers must scope the lookup
|
|
99
|
-
* upstream
|
|
100
|
-
*
|
|
101
|
-
*
|
|
87
|
+
* upstream through `query_invite_find_unclaimed_match_for_update`, which
|
|
88
|
+
* also makes find + claim atomic. Skipping the find step lets a caller
|
|
89
|
+
* claim any unclaimed invite by id.
|
|
102
90
|
*
|
|
103
91
|
* Mirrors the `query_session_revoke_by_hash_unscoped` precedent — there
|
|
104
92
|
* is no scoped sibling because the scoping is provided by a separate
|
|
@@ -116,12 +104,6 @@ export const query_invite_claim_unscoped = async (deps, invite_id, account_id) =
|
|
|
116
104
|
RETURNING id`, [account_id, invite_id]);
|
|
117
105
|
return rows.length > 0;
|
|
118
106
|
};
|
|
119
|
-
/**
|
|
120
|
-
* List all invites, newest first.
|
|
121
|
-
*/
|
|
122
|
-
export const query_invite_list_all = async (deps) => {
|
|
123
|
-
return deps.db.query(`SELECT ${columns_sql(INVITE_COLUMNS, invite_expr(''))} FROM invite ORDER BY invite.created_at DESC`);
|
|
124
|
-
};
|
|
125
107
|
/**
|
|
126
108
|
* List all invites with resolved creator/claimer usernames, newest first.
|
|
127
109
|
*
|