@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
|
@@ -50,8 +50,8 @@ export declare const AuditEventType: z.ZodEnum<{
|
|
|
50
50
|
}>;
|
|
51
51
|
export type AuditEventType = z.infer<typeof AuditEventType>;
|
|
52
52
|
/**
|
|
53
|
-
* What a **successful** audit row invalidates — the axis
|
|
54
|
-
*
|
|
53
|
+
* What a **successful** audit row invalidates — the axis the revocation
|
|
54
|
+
* listener (`create_revocation_guard`) dispatches on.
|
|
55
55
|
*
|
|
56
56
|
* - `none` — the row invalidates no live connection.
|
|
57
57
|
* - `session` — one session: the connections whose session-token hash equals
|
|
@@ -63,8 +63,8 @@ export type AuditEventType = z.infer<typeof AuditEventType>;
|
|
|
63
63
|
* `metadata.role`, when the revoked grant was global
|
|
64
64
|
* (`to_global_role_revocation`).
|
|
65
65
|
*
|
|
66
|
-
* The scope says what the row invalidated;
|
|
67
|
-
* alike. On `role` that matters for the WebSocket too: per-message dispatch
|
|
66
|
+
* The scope says what the row invalidated; the listener acts on every scope
|
|
67
|
+
* alike, for every transport. On `role` that matters for the WebSocket too: per-message dispatch
|
|
68
68
|
* re-authorizes each request against its own action, but a socket admitted by
|
|
69
69
|
* a role gate also receives every server push its endpoint sends, which no
|
|
70
70
|
* dispatch ever re-checks — so a socket that lost the gating role is closed,
|
|
@@ -74,9 +74,8 @@ export type AuditEventType = z.infer<typeof AuditEventType>;
|
|
|
74
74
|
*/
|
|
75
75
|
export type RevocationScope = 'none' | 'session' | 'token' | 'account' | 'role';
|
|
76
76
|
/**
|
|
77
|
-
* The `RevocationScope` of every builtin audit event — declared once,
|
|
78
|
-
*
|
|
79
|
-
* list each. Typed over `AuditEventType`, so a new event type does not compile
|
|
77
|
+
* The `RevocationScope` of every builtin audit event — declared once, the one
|
|
78
|
+
* answer the revocation listener reads, and the twin of the Rust spine's table. Typed over `AuditEventType`, so a new event type does not compile
|
|
80
79
|
* until it declares its scope here.
|
|
81
80
|
*
|
|
82
81
|
* A scope other than `none` marks an event whose success invalidates a live
|
|
@@ -104,15 +103,16 @@ export declare const to_revocation_scope: (event_type: string) => RevocationScop
|
|
|
104
103
|
* The account and role a successful `role`-scope row took away, when the
|
|
105
104
|
* revoked grant was **global** — `null` otherwise.
|
|
106
105
|
*
|
|
107
|
-
* A role gate (`
|
|
106
|
+
* A role gate (`register_action_ws`'s `required_roles`, the audit stream's
|
|
108
107
|
* `require_role`) admits on global grants only, so revoking a scoped grant
|
|
109
108
|
* takes away nothing a gate admitted on and closes nothing. A row with no
|
|
110
109
|
* `metadata.scope_id` reads as global: when unsure, closing is the safe side.
|
|
111
110
|
* The target is `target_account_id ?? account_id`, as for the `account` scope.
|
|
112
|
-
*
|
|
113
|
-
* role close on the same rows.
|
|
111
|
+
* The revocation guard reads it for every transport, so a socket and a
|
|
112
|
+
* stream gated on one role close on the same rows.
|
|
114
113
|
*
|
|
115
|
-
* Twin of the Rust spine's
|
|
114
|
+
* Twin of the role arm of the Rust spine's
|
|
115
|
+
* `ConnectionCloseTarget::from_audit_event`.
|
|
116
116
|
*
|
|
117
117
|
* @param event - a row whose scope is `role` (the caller dispatched on it)
|
|
118
118
|
* @returns the account and role to close on, or `null` when the row names no
|
|
@@ -263,6 +263,7 @@ export declare const audit_metadata_schemas: Readonly<{
|
|
|
263
263
|
sibling_accepted: "sibling_accepted";
|
|
264
264
|
role_grant_revoked: "role_grant_revoked";
|
|
265
265
|
scope_destroyed: "scope_destroyed";
|
|
266
|
+
account_deleted: "account_deleted";
|
|
266
267
|
}>;
|
|
267
268
|
cause_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
268
269
|
}, z.core.$loose>;
|
|
@@ -379,14 +380,6 @@ export interface AuditLogEvent {
|
|
|
379
380
|
created_at: string;
|
|
380
381
|
metadata: Record<string, unknown> | null;
|
|
381
382
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Narrow metadata type for a known event type.
|
|
384
|
-
*
|
|
385
|
-
* Use after checking `event_type` to get typed metadata access.
|
|
386
|
-
*/
|
|
387
|
-
export declare const get_audit_metadata: <T extends AuditEventType>(event: AuditLogEvent & {
|
|
388
|
-
event_type: T;
|
|
389
|
-
}) => AuditMetadataMap[T] | null;
|
|
390
383
|
/** Input for creating an audit log entry. */
|
|
391
384
|
export interface AuditLogInput<T extends string = AuditEventType> {
|
|
392
385
|
event_type: T;
|
|
@@ -485,7 +478,7 @@ export interface AuditLogListOptions {
|
|
|
485
478
|
* types registered via `create_audit_log_config({extra_events})` round-trip
|
|
486
479
|
* through queries, `on_audit_event` callbacks, and JSON-RPC responses
|
|
487
480
|
* identically to builtins. `AuditLogInput<T>` stays parameterized on the
|
|
488
|
-
* write side so `AuditMetadataMap`
|
|
481
|
+
* write side so `AuditMetadataMap` narrows metadata per event type.
|
|
489
482
|
*/
|
|
490
483
|
export declare const AuditLogEventJson: z.ZodObject<{
|
|
491
484
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
@@ -544,7 +537,7 @@ export declare const RoleGrantHistoryEventJson: z.ZodObject<{
|
|
|
544
537
|
target_username: z.ZodNullable<z.ZodString>;
|
|
545
538
|
}, z.core.$strict>;
|
|
546
539
|
export type RoleGrantHistoryEventJson = z.infer<typeof RoleGrantHistoryEventJson>;
|
|
547
|
-
/** Zod schema for admin session listing (session + username). */
|
|
540
|
+
/** Zod schema for admin session listing (session + username, without `is_current`). */
|
|
548
541
|
export declare const AdminSessionJson: z.ZodObject<{
|
|
549
542
|
id: z.core.$ZodBranded<z.ZodString, "SessionId", "out">;
|
|
550
543
|
account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAS,MAAM,yBAAyB,CAAC;AAkBtD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,6iBA6BnB,CAAC;AAEZ,wCAAwC;AACxC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhF
|
|
1
|
+
{"version":3,"file":"audit_log_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAS,MAAM,yBAAyB,CAAC;AAkBtD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,6iBA6BnB,CAAC;AAEZ,wCAAwC;AACxC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhF;;;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AAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,uFAAuF;AACvF,eAAO,MAAM,gBAAgB;;;;;;kBAE3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -62,9 +62,8 @@ export const AUDIT_EVENT_TYPES = Object.freeze([
|
|
|
62
62
|
/** Zod schema for audit event types. */
|
|
63
63
|
export const AuditEventType = z.enum(AUDIT_EVENT_TYPES);
|
|
64
64
|
/**
|
|
65
|
-
* The `RevocationScope` of every builtin audit event — declared once,
|
|
66
|
-
*
|
|
67
|
-
* list each. Typed over `AuditEventType`, so a new event type does not compile
|
|
65
|
+
* The `RevocationScope` of every builtin audit event — declared once, the one
|
|
66
|
+
* answer the revocation listener reads, and the twin of the Rust spine's table. Typed over `AuditEventType`, so a new event type does not compile
|
|
68
67
|
* until it declares its scope here.
|
|
69
68
|
*
|
|
70
69
|
* A scope other than `none` marks an event whose success invalidates a live
|
|
@@ -123,15 +122,16 @@ export const to_revocation_scope = (event_type) => Object.hasOwn(audit_event_rev
|
|
|
123
122
|
* The account and role a successful `role`-scope row took away, when the
|
|
124
123
|
* revoked grant was **global** — `null` otherwise.
|
|
125
124
|
*
|
|
126
|
-
* A role gate (`
|
|
125
|
+
* A role gate (`register_action_ws`'s `required_roles`, the audit stream's
|
|
127
126
|
* `require_role`) admits on global grants only, so revoking a scoped grant
|
|
128
127
|
* takes away nothing a gate admitted on and closes nothing. A row with no
|
|
129
128
|
* `metadata.scope_id` reads as global: when unsure, closing is the safe side.
|
|
130
129
|
* The target is `target_account_id ?? account_id`, as for the `account` scope.
|
|
131
|
-
*
|
|
132
|
-
* role close on the same rows.
|
|
130
|
+
* The revocation guard reads it for every transport, so a socket and a
|
|
131
|
+
* stream gated on one role close on the same rows.
|
|
133
132
|
*
|
|
134
|
-
* Twin of the Rust spine's
|
|
133
|
+
* Twin of the role arm of the Rust spine's
|
|
134
|
+
* `ConnectionCloseTarget::from_audit_event`.
|
|
135
135
|
*
|
|
136
136
|
* @param event - a row whose scope is `role` (the caller dispatched on it)
|
|
137
137
|
* @returns the account and role to close on, or `null` when the row names no
|
|
@@ -348,19 +348,23 @@ export const audit_metadata_schemas = Object.freeze({
|
|
|
348
348
|
}),
|
|
349
349
|
// Emitted when an offer is obsoleted by an external event. `reason`
|
|
350
350
|
// distinguishes the trigger; `cause_id` points to the accepted offer
|
|
351
|
-
// (for `sibling_accepted`), the revoked role_grant (for `role_grant_revoked`
|
|
352
|
-
//
|
|
351
|
+
// (for `sibling_accepted`), the revoked role_grant (for `role_grant_revoked`
|
|
352
|
+
// — the recipient's grant of the offered role, or a grant of the grantor's),
|
|
353
|
+
// the destroyed parent scope row (for `scope_destroyed`), or the grantor's
|
|
354
|
+
// removed account (for `account_deleted`).
|
|
353
355
|
role_grant_offer_supersede: z.looseObject({
|
|
354
356
|
offer_id: Uuid.meta({ description: 'Id of the superseded offer.' }),
|
|
355
357
|
role: z.string().meta({ description: 'Role that was offered.' }),
|
|
356
358
|
scope_id: Uuid.nullish().meta({
|
|
357
359
|
description: 'Scope of the offered role; null for global offers.'
|
|
358
360
|
}),
|
|
359
|
-
reason: z
|
|
360
|
-
|
|
361
|
+
reason: z
|
|
362
|
+
.enum(['sibling_accepted', 'role_grant_revoked', 'scope_destroyed', 'account_deleted'])
|
|
363
|
+
.meta({
|
|
364
|
+
description: "Trigger that obsoleted the offer: a sibling offer was accepted, the resulting role_grant or one of the grantor's was revoked, the parent scope row was destroyed, or the grantor's account was deleted or purged."
|
|
361
365
|
}),
|
|
362
366
|
cause_id: Uuid.meta({
|
|
363
|
-
description:
|
|
367
|
+
description: "Row that caused the supersede: accepted offer (`sibling_accepted`), revoked role_grant (`role_grant_revoked`), destroyed parent scope row (`scope_destroyed`), or the grantor's account (`account_deleted`)."
|
|
364
368
|
})
|
|
365
369
|
}),
|
|
366
370
|
invite_create: z.looseObject({
|
|
@@ -458,14 +462,6 @@ export const audit_metadata_schemas = Object.freeze({
|
|
|
458
462
|
})
|
|
459
463
|
})
|
|
460
464
|
});
|
|
461
|
-
/**
|
|
462
|
-
* Narrow metadata type for a known event type.
|
|
463
|
-
*
|
|
464
|
-
* Use after checking `event_type` to get typed metadata access.
|
|
465
|
-
*/
|
|
466
|
-
export const get_audit_metadata = (event) => {
|
|
467
|
-
return event.metadata;
|
|
468
|
-
};
|
|
469
465
|
/** Builtin fuz_app audit-log config — every existing event type and its metadata schema. */
|
|
470
466
|
export const builtin_audit_log_config = Object.freeze({
|
|
471
467
|
event_types: AUDIT_EVENT_TYPES,
|
|
@@ -522,7 +518,7 @@ export const AUDIT_LOG_DEFAULT_LIMIT = 50;
|
|
|
522
518
|
* types registered via `create_audit_log_config({extra_events})` round-trip
|
|
523
519
|
* through queries, `on_audit_event` callbacks, and JSON-RPC responses
|
|
524
520
|
* identically to builtins. `AuditLogInput<T>` stays parameterized on the
|
|
525
|
-
* write side so `AuditMetadataMap`
|
|
521
|
+
* write side so `AuditMetadataMap` narrows metadata per event type.
|
|
526
522
|
*/
|
|
527
523
|
export const AuditLogEventJson = z.strictObject({
|
|
528
524
|
id: Uuid,
|
|
@@ -547,7 +543,7 @@ export const RoleGrantHistoryEventJson = AuditLogEventJson.extend({
|
|
|
547
543
|
username: z.string().nullable(),
|
|
548
544
|
target_username: z.string().nullable()
|
|
549
545
|
});
|
|
550
|
-
/** Zod schema for admin session listing (session + username). */
|
|
551
|
-
export const AdminSessionJson = AuthSessionJson.extend({
|
|
546
|
+
/** Zod schema for admin session listing (session + username, without `is_current`). */
|
|
547
|
+
export const AdminSessionJson = AuthSessionJson.omit({ is_current: true }).extend({
|
|
552
548
|
username: z.string()
|
|
553
549
|
});
|
|
@@ -34,9 +34,12 @@ import type { QueryDeps } from '../db/query_deps.js';
|
|
|
34
34
|
* A token that fails the `is_api_token_shaped` precheck soft-fails before
|
|
35
35
|
* the database is touched.
|
|
36
36
|
* Auth scheme matching is case-insensitive per RFC 7235.
|
|
37
|
-
* On success, sets `
|
|
38
|
-
* and
|
|
39
|
-
* (
|
|
37
|
+
* On success, sets the `api_token` arm of `ResolvedAuth` (`RESOLVED_AUTH_KEY`):
|
|
38
|
+
* the account, the token id, its scope, and its deadline. The last leg of the
|
|
39
|
+
* chain, it skips when an earlier one (the daemon token or a session cookie)
|
|
40
|
+
* already resolved the request — before reading the header, so a token sent
|
|
41
|
+
* beside a winning credential is never looked up and its `last_used_at` /
|
|
42
|
+
* `last_used_ip` never move. Acting-actor resolution + `RequestContext`
|
|
40
43
|
* construction are deferred to the dispatcher's authorization phase.
|
|
41
44
|
*
|
|
42
45
|
* There is deliberately **no rate limit on this path**, and no 429 — every
|
|
@@ -50,7 +53,7 @@ import type { QueryDeps } from '../db/query_deps.js';
|
|
|
50
53
|
*
|
|
51
54
|
* @param deps - query dependencies (pool-level db for middleware)
|
|
52
55
|
* @param log - the logger instance
|
|
53
|
-
* @mutates Hono context - sets `
|
|
56
|
+
* @mutates Hono context - sets `RESOLVED_AUTH_KEY` on success
|
|
54
57
|
*/
|
|
55
58
|
export declare const create_bearer_auth_middleware: (deps: QueryDeps, log: Logger) => MiddlewareHandler;
|
|
56
59
|
//# sourceMappingURL=bearer_auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bearer_auth.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bearer_auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"bearer_auth.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bearer_auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,SAAS,EAAE,KAAK,MAAM,KAAG,iBAkF5E,CAAC"}
|
package/dist/auth/bearer_auth.js
CHANGED
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
17
|
import { DEV } from 'esm-env';
|
|
18
|
-
import {
|
|
18
|
+
import { RESOLVED_AUTH_KEY } from '../hono_context.js';
|
|
19
19
|
import { credential_deadline_after } from './credential_deadline.js';
|
|
20
|
+
import { get_resolved_auth } from './resolved_auth.js';
|
|
20
21
|
import { is_api_token_shaped } from './api_token.js';
|
|
21
22
|
import { query_validate_api_token } from './api_token_queries.js';
|
|
22
23
|
import { get_client_ip } from '../http/client_ip.js';
|
|
@@ -38,9 +39,12 @@ import { is_browser_context } from '../http/origin.js';
|
|
|
38
39
|
* A token that fails the `is_api_token_shaped` precheck soft-fails before
|
|
39
40
|
* the database is touched.
|
|
40
41
|
* Auth scheme matching is case-insensitive per RFC 7235.
|
|
41
|
-
* On success, sets `
|
|
42
|
-
* and
|
|
43
|
-
* (
|
|
42
|
+
* On success, sets the `api_token` arm of `ResolvedAuth` (`RESOLVED_AUTH_KEY`):
|
|
43
|
+
* the account, the token id, its scope, and its deadline. The last leg of the
|
|
44
|
+
* chain, it skips when an earlier one (the daemon token or a session cookie)
|
|
45
|
+
* already resolved the request — before reading the header, so a token sent
|
|
46
|
+
* beside a winning credential is never looked up and its `last_used_at` /
|
|
47
|
+
* `last_used_ip` never move. Acting-actor resolution + `RequestContext`
|
|
44
48
|
* construction are deferred to the dispatcher's authorization phase.
|
|
45
49
|
*
|
|
46
50
|
* There is deliberately **no rate limit on this path**, and no 429 — every
|
|
@@ -54,12 +58,12 @@ import { is_browser_context } from '../http/origin.js';
|
|
|
54
58
|
*
|
|
55
59
|
* @param deps - query dependencies (pool-level db for middleware)
|
|
56
60
|
* @param log - the logger instance
|
|
57
|
-
* @mutates Hono context - sets `
|
|
61
|
+
* @mutates Hono context - sets `RESOLVED_AUTH_KEY` on success
|
|
58
62
|
*/
|
|
59
63
|
export const create_bearer_auth_middleware = (deps, log) => {
|
|
60
64
|
return async (c, next) => {
|
|
61
|
-
//
|
|
62
|
-
if (c
|
|
65
|
+
// an earlier leg (daemon token, session cookie) already resolved the request
|
|
66
|
+
if (get_resolved_auth(c) !== null) {
|
|
63
67
|
await next();
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
@@ -112,14 +116,16 @@ export const create_bearer_auth_middleware = (deps, log) => {
|
|
|
112
116
|
await next();
|
|
113
117
|
return;
|
|
114
118
|
}
|
|
115
|
-
c.set(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
c.set(RESOLVED_AUTH_KEY, {
|
|
120
|
+
credential_type: 'api_token',
|
|
121
|
+
account_id: api_token.account_id,
|
|
122
|
+
api_token_id: api_token.id,
|
|
123
|
+
// Parsed by the query, which refuses a token whose stored scope is
|
|
124
|
+
// unreadable — there is no default to fall back to.
|
|
125
|
+
scope: api_token.scope,
|
|
126
|
+
// the row's expiry, read on the database clock; none for an eternal token
|
|
127
|
+
credential_deadline: credential_deadline_after([api_token.expires_in_ms])
|
|
128
|
+
});
|
|
123
129
|
await next();
|
|
124
130
|
};
|
|
125
131
|
};
|
|
@@ -66,6 +66,29 @@ export interface BootstrapAccountDeps {
|
|
|
66
66
|
/** Structured logger instance. */
|
|
67
67
|
log: Logger;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* The fewest bytes a bootstrap token holds, counted after its one optional
|
|
71
|
+
* trailing LF. A shorter file is read as unreadable: an empty or `"\n"` file
|
|
72
|
+
* would otherwise leave bootstrap advertised as open while nothing can ever
|
|
73
|
+
* match it, and a short token is guessable. Every generator writes at least
|
|
74
|
+
* this much (32 random bytes, base64url or hex encoded). Twin of the Rust
|
|
75
|
+
* `BOOTSTRAP_TOKEN_MIN_BYTES` (`fuz_auth`).
|
|
76
|
+
*/
|
|
77
|
+
export declare const BOOTSTRAP_TOKEN_MIN_BYTES = 32;
|
|
78
|
+
/**
|
|
79
|
+
* Read the bootstrap token the way both the availability check and the
|
|
80
|
+
* request-time compare need it: the hardened secure read, less one trailing
|
|
81
|
+
* LF, refused when shorter than `BOOTSTRAP_TOKEN_MIN_BYTES`. A short token
|
|
82
|
+
* logs an error naming the file before the throw — it is a misconfiguration
|
|
83
|
+
* the operator must fix, never a quiet "unavailable". Twin of the Rust
|
|
84
|
+
* `bootstrap_token_from_file`.
|
|
85
|
+
*
|
|
86
|
+
* @param deps - the secure read and a logger for the short-token error
|
|
87
|
+
* @param token_path - the bootstrap token file
|
|
88
|
+
* @returns the token bytes the provided token is compared against
|
|
89
|
+
* @throws Error when the secure read refuses the file or the token is too short
|
|
90
|
+
*/
|
|
91
|
+
export declare const read_bootstrap_token: (deps: Pick<BootstrapAccountDeps, "read_secure_file" | "log">, token_path: string) => Promise<Uint8Array>;
|
|
69
92
|
/**
|
|
70
93
|
* Bootstrap the first account with keeper and admin privileges.
|
|
71
94
|
*
|
|
@@ -73,7 +96,8 @@ export interface BootstrapAccountDeps {
|
|
|
73
96
|
* attempts (TOCTOU). The full flow runs in a single transaction:
|
|
74
97
|
*
|
|
75
98
|
* 1. Read and verify the bootstrap token (before transaction) — the file's
|
|
76
|
-
* raw bytes less one optional trailing LF,
|
|
99
|
+
* raw bytes less one optional trailing LF, at least
|
|
100
|
+
* `BOOTSTRAP_TOKEN_MIN_BYTES` long, compared in constant time
|
|
77
101
|
* 2. Hash the password (CPU-intensive, before transaction)
|
|
78
102
|
* 3. Acquire the bootstrap lock atomically (inside transaction)
|
|
79
103
|
* 4. Create account + act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AU,CAQpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,oBAAoB,EAC1B,gBAAgB,MAAM,EACtB,OAAO,qBAAqB,KAC1B,OAAO,CAAC,sBAAsB,CA8EhC,CAAC"}
|
|
@@ -22,6 +22,37 @@ import { query_create_role_grant } from './role_grant_queries.js';
|
|
|
22
22
|
* `strip_one_trailing_newline` (`fuz_auth`).
|
|
23
23
|
*/
|
|
24
24
|
const strip_one_trailing_newline = (bytes) => bytes.at(-1) === 0x0a ? bytes.subarray(0, -1) : bytes;
|
|
25
|
+
/**
|
|
26
|
+
* The fewest bytes a bootstrap token holds, counted after its one optional
|
|
27
|
+
* trailing LF. A shorter file is read as unreadable: an empty or `"\n"` file
|
|
28
|
+
* would otherwise leave bootstrap advertised as open while nothing can ever
|
|
29
|
+
* match it, and a short token is guessable. Every generator writes at least
|
|
30
|
+
* this much (32 random bytes, base64url or hex encoded). Twin of the Rust
|
|
31
|
+
* `BOOTSTRAP_TOKEN_MIN_BYTES` (`fuz_auth`).
|
|
32
|
+
*/
|
|
33
|
+
export const BOOTSTRAP_TOKEN_MIN_BYTES = 32;
|
|
34
|
+
/**
|
|
35
|
+
* Read the bootstrap token the way both the availability check and the
|
|
36
|
+
* request-time compare need it: the hardened secure read, less one trailing
|
|
37
|
+
* LF, refused when shorter than `BOOTSTRAP_TOKEN_MIN_BYTES`. A short token
|
|
38
|
+
* logs an error naming the file before the throw — it is a misconfiguration
|
|
39
|
+
* the operator must fix, never a quiet "unavailable". Twin of the Rust
|
|
40
|
+
* `bootstrap_token_from_file`.
|
|
41
|
+
*
|
|
42
|
+
* @param deps - the secure read and a logger for the short-token error
|
|
43
|
+
* @param token_path - the bootstrap token file
|
|
44
|
+
* @returns the token bytes the provided token is compared against
|
|
45
|
+
* @throws Error when the secure read refuses the file or the token is too short
|
|
46
|
+
*/
|
|
47
|
+
export const read_bootstrap_token = async (deps, token_path) => {
|
|
48
|
+
const token = strip_one_trailing_newline(await deps.read_secure_file(token_path));
|
|
49
|
+
if (token.length < BOOTSTRAP_TOKEN_MIN_BYTES) {
|
|
50
|
+
const message = `bootstrap token at ${token_path} is ${token.length} bytes, under the ${BOOTSTRAP_TOKEN_MIN_BYTES}-byte minimum — regenerate it`;
|
|
51
|
+
deps.log.error(message);
|
|
52
|
+
throw new Error(message);
|
|
53
|
+
}
|
|
54
|
+
return token;
|
|
55
|
+
};
|
|
25
56
|
/**
|
|
26
57
|
* Bootstrap the first account with keeper and admin privileges.
|
|
27
58
|
*
|
|
@@ -29,7 +60,8 @@ const strip_one_trailing_newline = (bytes) => bytes.at(-1) === 0x0a ? bytes.suba
|
|
|
29
60
|
* attempts (TOCTOU). The full flow runs in a single transaction:
|
|
30
61
|
*
|
|
31
62
|
* 1. Read and verify the bootstrap token (before transaction) — the file's
|
|
32
|
-
* raw bytes less one optional trailing LF,
|
|
63
|
+
* raw bytes less one optional trailing LF, at least
|
|
64
|
+
* `BOOTSTRAP_TOKEN_MIN_BYTES` long, compared in constant time
|
|
33
65
|
* 2. Hash the password (CPU-intensive, before transaction)
|
|
34
66
|
* 3. Acquire the bootstrap lock atomically (inside transaction)
|
|
35
67
|
* 4. Create account + actor
|
|
@@ -48,11 +80,12 @@ export const bootstrap_account = async (deps, provided_token, input) => {
|
|
|
48
80
|
const { db, token_path, read_secure_file, delete_file, password, log } = deps;
|
|
49
81
|
// 1. Read and verify token (non-destructive, before transaction). The
|
|
50
82
|
// secure read fails loud on a symlink / non-regular file / permissive mode /
|
|
51
|
-
// oversized file
|
|
52
|
-
//
|
|
83
|
+
// oversized file, and the read refuses a token under the minimum length —
|
|
84
|
+
// every refusal masks as the same TOKEN_FILE_MISSING the wire always
|
|
85
|
+
// carried, with the specific reason logged for the operator.
|
|
53
86
|
let expected_token;
|
|
54
87
|
try {
|
|
55
|
-
expected_token =
|
|
88
|
+
expected_token = await read_bootstrap_token({ read_secure_file, log }, token_path);
|
|
56
89
|
}
|
|
57
90
|
catch (err) {
|
|
58
91
|
log.warn(`bootstrap token file rejected: ${to_error_message(err)}`);
|
|
@@ -65,10 +65,11 @@ export interface CheckBootstrapStatusDeps {
|
|
|
65
65
|
* Bootstrap is available when:
|
|
66
66
|
* 1. A token path is configured
|
|
67
67
|
* 2. The token file passes the secure read (exists, not a symlink, mode
|
|
68
|
-
* `0600`/`0400`, within the size cap)
|
|
68
|
+
* `0600`/`0400`, within the size cap) and holds at least
|
|
69
|
+
* `BOOTSTRAP_TOKEN_MIN_BYTES` (a shorter one logs an error)
|
|
69
70
|
* 3. The `bootstrap_lock` table shows `bootstrapped = false`
|
|
70
71
|
*
|
|
71
|
-
* The probe **reads through the same `
|
|
72
|
+
* The probe **reads through the same `read_bootstrap_token` the request-time
|
|
72
73
|
* read uses**, so "bootstrap is available" and "the token file can actually
|
|
73
74
|
* be read" can't drift apart — an availability check laxer than the read it
|
|
74
75
|
* gates is the misconfiguration that reports green at boot and fails at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,
|
|
1
|
+
{"version":3,"file":"bootstrap_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OA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S,qBAAqB,KAC5B,KAAK,CAAC,SAAS,CA0HjB,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
10
10
|
import { create_session_and_set_cookie } from './session_middleware.js';
|
|
11
|
-
import { bootstrap_account } from './bootstrap_account.js';
|
|
11
|
+
import { bootstrap_account, read_bootstrap_token } from './bootstrap_account.js';
|
|
12
12
|
import { bootstrap_route_shape } from './bootstrap_route_schema.js';
|
|
13
13
|
import { get_route_input } from '../http/route_spec.js';
|
|
14
14
|
import { get_client_ip } from '../http/client_ip.js';
|
|
@@ -21,10 +21,11 @@ import { ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING } from '../http/er
|
|
|
21
21
|
* Bootstrap is available when:
|
|
22
22
|
* 1. A token path is configured
|
|
23
23
|
* 2. The token file passes the secure read (exists, not a symlink, mode
|
|
24
|
-
* `0600`/`0400`, within the size cap)
|
|
24
|
+
* `0600`/`0400`, within the size cap) and holds at least
|
|
25
|
+
* `BOOTSTRAP_TOKEN_MIN_BYTES` (a shorter one logs an error)
|
|
25
26
|
* 3. The `bootstrap_lock` table shows `bootstrapped = false`
|
|
26
27
|
*
|
|
27
|
-
* The probe **reads through the same `
|
|
28
|
+
* The probe **reads through the same `read_bootstrap_token` the request-time
|
|
28
29
|
* read uses**, so "bootstrap is available" and "the token file can actually
|
|
29
30
|
* be read" can't drift apart — an availability check laxer than the read it
|
|
30
31
|
* gates is the misconfiguration that reports green at boot and fails at
|
|
@@ -41,7 +42,7 @@ export const check_bootstrap_status = async (deps, options) => {
|
|
|
41
42
|
return { available: false, token_path: null };
|
|
42
43
|
}
|
|
43
44
|
try {
|
|
44
|
-
await read_secure_file
|
|
45
|
+
await read_bootstrap_token({ read_secure_file, log }, token_path);
|
|
45
46
|
}
|
|
46
47
|
catch (err) {
|
|
47
48
|
log.info(`Bootstrap unavailable: ${to_error_message(err)}`);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cell verbs' shared gates and audit emit.
|
|
3
|
+
*
|
|
4
|
+
* Every gate loads the cell, reads its grants where the tier consults them,
|
|
5
|
+
* applies the tier's predicate, and answers a miss and a denial with the same
|
|
6
|
+
* `cell_not_found` 404. A 403 on denial would confirm the row exists, so a
|
|
7
|
+
* caller with no authority could walk ids and read a private cell's existence
|
|
8
|
+
* off the difference; one wire shape for both is the IDOR mask. Each gate
|
|
9
|
+
* returns the loaded row, so a handler that needs it doesn't re-read it.
|
|
10
|
+
*
|
|
11
|
+
* Twins of the Rust `fuz_cell_actions` helpers; `require_viewable_cell`
|
|
12
|
+
* covers both of Rust's authenticated and `_optional_auth` read gates.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import type { ActionActorContext, ActionContext } from '../actions/action_types.js';
|
|
17
|
+
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
18
|
+
import type { QueryDeps } from '../db/query_deps.js';
|
|
19
|
+
import { type CellRow } from '../db/cell_queries.js';
|
|
20
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
21
|
+
import type { AuditLogInput } from './audit_log_schema.js';
|
|
22
|
+
import type { AuditEmitter } from './audit_emitter.js';
|
|
23
|
+
import type { RequestActorContext, RequestContext } from './request_context.js';
|
|
24
|
+
/**
|
|
25
|
+
* The 404 every cell gate answers for a miss and a denial alike.
|
|
26
|
+
*
|
|
27
|
+
* @returns the `cell_not_found` JSON-RPC error
|
|
28
|
+
*/
|
|
29
|
+
export declare const cell_not_found_error: () => ReturnType<typeof jsonrpc_errors.not_found>;
|
|
30
|
+
/**
|
|
31
|
+
* Load a cell and gate the caller on `can_view_cell`, 404-masking a miss and a
|
|
32
|
+
* denial alike.
|
|
33
|
+
*
|
|
34
|
+
* The read tier: a create's parent, a clone's source, the far endpoint a write
|
|
35
|
+
* links to (so a link is no existence oracle), and the endpoints of the
|
|
36
|
+
* public relation lists, where `auth` may be `null`.
|
|
37
|
+
*
|
|
38
|
+
* @param deps - query deps
|
|
39
|
+
* @param auth - the caller, or `null` when unauthenticated
|
|
40
|
+
* @param cell_id - the cell to load
|
|
41
|
+
* @returns the loaded row
|
|
42
|
+
* @throws the `cell_not_found` 404 on a miss or a denial
|
|
43
|
+
*/
|
|
44
|
+
export declare const require_viewable_cell: (deps: QueryDeps, auth: RequestContext | null, cell_id: Uuid) => Promise<CellRow>;
|
|
45
|
+
/**
|
|
46
|
+
* Load a cell and gate the caller on `can_edit_cell`, 404-masking a miss and a
|
|
47
|
+
* denial alike.
|
|
48
|
+
*
|
|
49
|
+
* The write tier: `cell_update` / `cell_delete`, the source a field write
|
|
50
|
+
* writes, and the parent every item mutation writes.
|
|
51
|
+
*
|
|
52
|
+
* @param deps - query deps
|
|
53
|
+
* @param auth - the caller
|
|
54
|
+
* @param cell_id - the cell to load
|
|
55
|
+
* @returns the loaded row
|
|
56
|
+
* @throws the `cell_not_found` 404 on a miss or a denial
|
|
57
|
+
*/
|
|
58
|
+
export declare const require_editable_cell: (deps: QueryDeps, auth: RequestActorContext, cell_id: Uuid) => Promise<CellRow>;
|
|
59
|
+
/**
|
|
60
|
+
* Load a cell and gate the caller on `can_manage_cell`, 404-masking a miss and
|
|
61
|
+
* a denial alike.
|
|
62
|
+
*
|
|
63
|
+
* The manage tier: `cell_audit_list`, `cell_grant_create`, `cell_grant_list`.
|
|
64
|
+
* Manage is admin-or-owner and not a grant level, so no grant is read. A
|
|
65
|
+
* viewer or an editor gets the same mask a stranger does: an audit timeline
|
|
66
|
+
* and a share list say who touched the cell, which is more sensitive than the
|
|
67
|
+
* content.
|
|
68
|
+
*
|
|
69
|
+
* @param deps - query deps
|
|
70
|
+
* @param auth - the caller
|
|
71
|
+
* @param cell_id - the cell to load
|
|
72
|
+
* @returns the loaded row
|
|
73
|
+
* @throws the `cell_not_found` 404 on a miss or a denial
|
|
74
|
+
*/
|
|
75
|
+
export declare const require_manageable_cell: (deps: QueryDeps, auth: RequestActorContext, cell_id: Uuid) => Promise<CellRow>;
|
|
76
|
+
/**
|
|
77
|
+
* Emit a cell-domain audit event for the caller, with `actor_id`,
|
|
78
|
+
* `account_id`, and `ip` lifted from `auth` and `ctx`. `metadata` is the
|
|
79
|
+
* event's own envelope.
|
|
80
|
+
*
|
|
81
|
+
* @param ctx - the action context
|
|
82
|
+
* @param audit - the bound audit emitter
|
|
83
|
+
* @param auth - the caller
|
|
84
|
+
* @param event_type - the cell event
|
|
85
|
+
* @param metadata - the event's metadata envelope
|
|
86
|
+
* @mutates `audit_log` table - inserts the row through `audit.emit`
|
|
87
|
+
*/
|
|
88
|
+
export declare const emit_cell_audit: <T extends string>(ctx: ActionContext | ActionActorContext, audit: AuditEmitter, auth: RequestActorContext, event_type: T, metadata: AuditLogInput<T>["metadata"]) => void;
|
|
89
|
+
//# sourceMappingURL=cell_action_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell_action_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/cell_action_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEhF;;;;GAIG;AACH,eAAO,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