@fuzdev/fuz_app 0.140.0 → 0.142.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +72 -22
- package/dist/actions/action_rpc.d.ts +5 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +9 -1
- package/dist/actions/connection_closer.d.ts +44 -4
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +33 -3
- package/dist/actions/perform_action.d.ts +10 -0
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +23 -9
- package/dist/actions/register_action_ws.d.ts +42 -6
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +87 -19
- package/dist/actions/register_ws_endpoint.d.ts +15 -6
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +10 -4
- package/dist/actions/socket.svelte.d.ts +19 -4
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +31 -4
- package/dist/actions/transports.d.ts +30 -1
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +30 -1
- package/dist/actions/transports_ws_auth_guard.d.ts +13 -6
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +24 -10
- package/dist/actions/transports_ws_backend.d.ts +51 -5
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +62 -9
- package/dist/actions/ws_endpoint_spec.d.ts +11 -10
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/auth/CLAUDE.md +44 -22
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +12 -1
- package/dist/auth/account_route_schema.d.ts +1 -0
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +12 -0
- package/dist/auth/account_routes.d.ts +7 -2
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +240 -187
- package/dist/auth/admin_action_specs.d.ts +6 -1
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +6 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +14 -2
- package/dist/auth/api_token.d.ts +20 -0
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +21 -1
- package/dist/auth/api_token_queries.d.ts +22 -4
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +11 -6
- package/dist/auth/audit_log_routes.d.ts +10 -0
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +20 -0
- package/dist/auth/audit_log_schema.d.ts +30 -5
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +30 -0
- package/dist/auth/bearer_auth.d.ts +4 -2
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +19 -8
- package/dist/auth/bootstrap_route_schema.d.ts +1 -0
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +1 -0
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +85 -76
- package/dist/auth/cell_action_specs.d.ts +7 -3
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +9 -5
- package/dist/auth/cell_actions.d.ts +3 -3
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +67 -38
- package/dist/auth/cell_authorize.d.ts +69 -8
- package/dist/auth/cell_authorize.d.ts.map +1 -1
- package/dist/auth/cell_authorize.js +89 -9
- package/dist/auth/cell_field_action_specs.d.ts +5 -4
- package/dist/auth/cell_field_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_field_action_specs.js +7 -7
- package/dist/auth/cell_field_actions.d.ts +7 -5
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +24 -22
- package/dist/auth/cell_grant_action_specs.d.ts +6 -0
- package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_grant_action_specs.js +6 -0
- package/dist/auth/cell_grant_actions.d.ts +3 -1
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +16 -2
- package/dist/auth/cell_item_action_specs.d.ts +5 -4
- package/dist/auth/cell_item_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_item_action_specs.js +7 -7
- package/dist/auth/cell_item_actions.d.ts +6 -5
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +23 -22
- package/dist/auth/cell_relation_list_limit.d.ts +20 -0
- package/dist/auth/cell_relation_list_limit.d.ts.map +1 -0
- package/dist/auth/cell_relation_list_limit.js +27 -0
- package/dist/auth/cell_relation_visibility.d.ts +4 -3
- package/dist/auth/cell_relation_visibility.d.ts.map +1 -1
- package/dist/auth/cell_relation_visibility.js +6 -5
- package/dist/auth/cell_steward.d.ts +45 -0
- package/dist/auth/cell_steward.d.ts.map +1 -0
- package/dist/auth/cell_steward.js +53 -0
- package/dist/auth/cleanup.d.ts +9 -9
- package/dist/auth/cleanup.js +9 -9
- package/dist/auth/credential_deadline.d.ts +95 -0
- package/dist/auth/credential_deadline.d.ts.map +1 -0
- package/dist/auth/credential_deadline.js +139 -0
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +4 -1
- package/dist/auth/middleware.d.ts +90 -12
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +115 -16
- package/dist/auth/request_context.d.ts +8 -2
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +20 -4
- package/dist/auth/resolved_auth.d.ts +13 -2
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +5 -4
- package/dist/auth/role_grant_offer_action_specs.d.ts +5 -0
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +6 -1
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +23 -16
- package/dist/auth/role_grant_offer_queries.d.ts +8 -6
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +16 -8
- package/dist/auth/session_cookie.d.ts +4 -0
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +3 -2
- package/dist/auth/session_middleware.d.ts +1 -1
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +4 -1
- package/dist/auth/session_queries.d.ts +19 -2
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +8 -2
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +1 -0
- package/dist/auth/signup_routes.d.ts +4 -3
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +157 -134
- package/dist/auth/token_scope.d.ts +7 -1
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +8 -2
- package/dist/db/CLAUDE.md +32 -19
- package/dist/db/cell_ddl.d.ts +1 -2
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +1 -2
- package/dist/db/cell_field_queries.d.ts +20 -18
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +28 -22
- package/dist/db/cell_item_queries.d.ts +20 -14
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +28 -18
- package/dist/db/cell_moderation.d.ts +67 -0
- package/dist/db/cell_moderation.d.ts.map +1 -0
- package/dist/db/cell_moderation.js +66 -0
- package/dist/db/cell_queries.d.ts +44 -14
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +68 -45
- package/dist/db/cell_view_sql.d.ts +102 -0
- package/dist/db/cell_view_sql.d.ts.map +1 -0
- package/dist/db/cell_view_sql.js +112 -0
- package/dist/db/db_pg.d.ts +1 -1
- package/dist/db/db_pg.js +1 -1
- package/dist/hono_context.d.ts +23 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +19 -0
- package/dist/http/CLAUDE.md +41 -15
- package/dist/http/auth_shape.d.ts +5 -2
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +5 -2
- package/dist/http/ip_canonical.d.ts +30 -3
- package/dist/http/ip_canonical.d.ts.map +1 -1
- package/dist/http/ip_canonical.js +50 -3
- package/dist/http/middleware_spec.d.ts +16 -0
- package/dist/http/middleware_spec.d.ts.map +1 -1
- package/dist/http/origin.d.ts +113 -18
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +247 -127
- package/dist/http/route_spec.d.ts +21 -0
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/schema_helpers.d.ts +22 -0
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +24 -0
- package/dist/http/surface.d.ts +6 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +12 -5
- package/dist/primitive_schemas.d.ts +10 -1
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +11 -2
- package/dist/rate_limiter.d.ts +179 -12
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +352 -42
- package/dist/realtime/sse_auth_guard.d.ts +22 -6
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
- package/dist/realtime/sse_auth_guard.js +31 -12
- package/dist/realtime/subscriber_registry.d.ts +10 -1
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +10 -1
- package/dist/server/app_server.d.ts +20 -7
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +8 -3
- package/dist/server/env.d.ts +2 -1
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +7 -17
- package/dist/server/serve_fact_route.d.ts +8 -4
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +16 -6
- package/dist/testing/CLAUDE.md +164 -25
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +13 -6
- package/dist/testing/connection_closer_helpers.d.ts +6 -1
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +4 -0
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +37 -2
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +14 -65
- package/dist/testing/cross_backend/capabilities.d.ts +26 -2
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +9 -3
- package/dist/testing/cross_backend/cell_gated_create.d.ts +38 -0
- package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.js +401 -5
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +145 -2
- package/dist/testing/cross_backend/conformance_case.d.ts +11 -3
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +6 -0
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +20 -19
- package/dist/testing/cross_backend/credential_deadline.d.ts +25 -0
- package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_deadline.js +185 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +13 -2
- package/dist/testing/cross_backend/expected_schema.json +0 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +7 -1
- package/dist/testing/cross_backend/login_security.d.ts +16 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +154 -0
- package/dist/testing/cross_backend/narrowed_api_token.d.ts +23 -0
- package/dist/testing/cross_backend/narrowed_api_token.d.ts.map +1 -0
- package/dist/testing/cross_backend/narrowed_api_token.js +40 -0
- package/dist/testing/cross_backend/origin.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin.js +6 -26
- package/dist/testing/cross_backend/origin_conformance.d.ts +152 -0
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/origin_conformance.js +136 -0
- package/dist/testing/cross_backend/origin_conformance.json +1679 -0
- package/dist/testing/cross_backend/origin_scope.d.ts +16 -0
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -0
- package/dist/testing/cross_backend/origin_scope.js +140 -0
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +24 -2
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +35 -0
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -0
- package/dist/testing/cross_backend/role_grant_cross_helpers.js +64 -0
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +8 -0
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +44 -33
- package/dist/testing/cross_backend/role_grant_participation.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_participation.js +64 -0
- 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 +6 -4
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +20 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +23 -1
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +20 -7
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +180 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +154 -5
- package/dist/testing/cross_backend/token_scope_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_scope_surface.js +25 -21
- package/dist/testing/cross_backend/transport_composition.d.ts +60 -0
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -0
- package/dist/testing/cross_backend/transport_composition.js +364 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +21 -6
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +21 -1
- package/dist/testing/cross_backend/ws_role_gated.d.ts +38 -0
- package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_role_gated.js +142 -0
- package/dist/testing/entities.d.ts +23 -0
- package/dist/testing/entities.d.ts.map +1 -1
- package/dist/testing/entities.js +37 -0
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +3 -1
- package/dist/testing/middleware.d.ts +10 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +31 -7
- package/dist/testing/schema_introspect.js +1 -1
- package/dist/testing/schema_parity.d.ts +4 -3
- package/dist/testing/schema_parity.d.ts.map +1 -1
- package/dist/testing/schema_parity.js +4 -3
- package/dist/testing/schema_ready_fixture.d.ts +2 -4
- package/dist/testing/schema_ready_fixture.d.ts.map +1 -1
- package/dist/testing/schema_ready_fixture.js +2 -4
- package/dist/testing/stubs.d.ts +16 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +20 -7
- package/dist/testing/surface_invariants.js +2 -2
- package/dist/ui/auth_state.svelte.d.ts +10 -0
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +22 -4
- package/package.json +1 -1
- package/dist/db/cell_history_ddl.d.ts +0 -38
- package/dist/db/cell_history_ddl.d.ts.map +0 -1
- package/dist/db/cell_history_ddl.js +0 -61
|
@@ -165,7 +165,16 @@ export interface PendingSubscription {
|
|
|
165
165
|
* // first: a client that already left closes the stream, its listener runs at
|
|
166
166
|
* // once, and `admit` then refuses the removed registration
|
|
167
167
|
* stream.on_close(pending.unsubscribe);
|
|
168
|
-
* if (!registry.admit(pending, stream))
|
|
168
|
+
* if (!registry.admit(pending, stream)) {
|
|
169
|
+
* stream.close(); // the body is the connect comment alone
|
|
170
|
+
* } else {
|
|
171
|
+
* // expiry writes nothing a revocation closes on: end at the credential's deadline
|
|
172
|
+
* stream.on_close(
|
|
173
|
+
* schedule_credential_deadline(get_resolved_auth(c)?.credential_deadline ?? null, () =>
|
|
174
|
+
* stream.close()
|
|
175
|
+
* )
|
|
176
|
+
* );
|
|
177
|
+
* }
|
|
169
178
|
* return response;
|
|
170
179
|
* ```
|
|
171
180
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/subscriber_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,0EAA0E;AAC1E,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3B;AASD,wCAAwC;AACxC,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;CACxB;AAED
|
|
1
|
+
{"version":3,"file":"subscriber_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/subscriber_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,0EAA0E;AAC1E,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7B,mDAAmD;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qE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AE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO;IASlE;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IASzC;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM3C;;;;;;;;;;;;OAYG;IACH,SAAS,IAAI,MAAM;CAsFnB"}
|
|
@@ -105,7 +105,16 @@ import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
|
105
105
|
* // first: a client that already left closes the stream, its listener runs at
|
|
106
106
|
* // once, and `admit` then refuses the removed registration
|
|
107
107
|
* stream.on_close(pending.unsubscribe);
|
|
108
|
-
* if (!registry.admit(pending, stream))
|
|
108
|
+
* if (!registry.admit(pending, stream)) {
|
|
109
|
+
* stream.close(); // the body is the connect comment alone
|
|
110
|
+
* } else {
|
|
111
|
+
* // expiry writes nothing a revocation closes on: end at the credential's deadline
|
|
112
|
+
* stream.on_close(
|
|
113
|
+
* schedule_credential_deadline(get_resolved_auth(c)?.credential_deadline ?? null, () =>
|
|
114
|
+
* stream.close()
|
|
115
|
+
* )
|
|
116
|
+
* );
|
|
117
|
+
* }
|
|
109
118
|
* return response;
|
|
110
119
|
* ```
|
|
111
120
|
*/
|
|
@@ -23,7 +23,7 @@ import '../hono_context.js';
|
|
|
23
23
|
import { type ServeStaticFactory } from './static.js';
|
|
24
24
|
import { type AppSurfaceSpec, type AppSurfaceDiagnostic, type RpcEndpointSpec } from '../http/surface.js';
|
|
25
25
|
import { type RouteSpec } from '../http/route_spec.js';
|
|
26
|
-
import type { MiddlewareSpec } from '../http/middleware_spec.js';
|
|
26
|
+
import type { MiddlewareCarveOut, MiddlewareSpec } from '../http/middleware_spec.js';
|
|
27
27
|
import { type BootstrapStatus } from '../auth/bootstrap_routes.js';
|
|
28
28
|
import { type WsEndpointSpec } from '../actions/ws_endpoint_spec.js';
|
|
29
29
|
import type { BackendWebsocketTransport } from '../actions/transports_ws_backend.js';
|
|
@@ -90,6 +90,18 @@ export interface AppServerOptions {
|
|
|
90
90
|
session_options: SessionOptions<string>;
|
|
91
91
|
/** Parsed allowed origin patterns. */
|
|
92
92
|
allowed_origins: Array<RegExp>;
|
|
93
|
+
/**
|
|
94
|
+
* Paths the origin check skips, each with its reason. The check covers
|
|
95
|
+
* every path by default (`ORIGIN_MIDDLEWARE_PATH`) — a request with no
|
|
96
|
+
* `Origin` passes it anyway, so probes and CLI clients need no carve-out;
|
|
97
|
+
* one is for a path that refuses browser callers by other means. Copied at
|
|
98
|
+
* assembly, so a later change to this array changes nothing; assembly
|
|
99
|
+
* throws on a carve-out with no reason, or one that overlaps the auth
|
|
100
|
+
* middleware's scope (`AUTH_MIDDLEWARE_PATH`) — every route that reads or
|
|
101
|
+
* mints a credential, and every RPC, WS, and bootstrap endpoint, sits
|
|
102
|
+
* there (`assert_origin_carve_outs_valid`).
|
|
103
|
+
*/
|
|
104
|
+
origin_carve_outs?: Array<MiddlewareCarveOut>;
|
|
93
105
|
/** Trusted proxy options. */
|
|
94
106
|
proxy: {
|
|
95
107
|
trusted_proxies: Array<string>;
|
|
@@ -212,7 +224,8 @@ export interface AppServerOptions {
|
|
|
212
224
|
* Add layers anywhere (before the proxy spec, between it and the auth
|
|
213
225
|
* stack, between the auth layers, or after), but keep each of those specs
|
|
214
226
|
* — its `handler`, not just its `name` — mounted once at its original path
|
|
215
|
-
* (`'*'` for the proxy, `AUTH_MIDDLEWARE_PATH` for
|
|
227
|
+
* (`'*'` for the proxy and the origin check, `AUTH_MIDDLEWARE_PATH` for the
|
|
228
|
+
* rest of the auth stack) in its original
|
|
216
229
|
* order: the endpoint auth-scope check (`assert_endpoint_in_auth_scope`)
|
|
217
230
|
* and client-IP rate limiting (`get_client_ip`) assume it, so assembly
|
|
218
231
|
* throws (`assert_middleware_stack_mounted`) if the transform moves, drops,
|
|
@@ -249,11 +262,11 @@ export interface AppServerOptions {
|
|
|
249
262
|
* audits each newly expired role_grant offer once.
|
|
250
263
|
*
|
|
251
264
|
* **Off by default; a production server should turn it on.** Without it
|
|
252
|
-
* nothing sweeps: expired session rows accumulate
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
265
|
+
* nothing sweeps: expired session rows accumulate and an offer's expiry is
|
|
266
|
+
* never audited. Connections do not depend on it — each closes at its
|
|
267
|
+
* credential's deadline (`auth/credential_deadline.ts`), and the sweep's
|
|
268
|
+
* close repeats that one. The Rust spine's servers all schedule the twin
|
|
269
|
+
* (`spawn_auth_cleanup`).
|
|
257
270
|
*
|
|
258
271
|
* Pass `true` for the default interval
|
|
259
272
|
* (`DEFAULT_AUTH_CLEANUP_INTERVAL_MS`), or `{interval_ms}` for another.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACN,WAAW,EAMX,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB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G;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAEpC,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC,2DAA2D;IAC3D,IAAI,EAAE,eAAe,CAAC;IACtB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9D;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,IAAI,CAAC,gBAAgB,EAAE,uBAAuB,GAAG,eAAe,CAAC,KACxE,oBAkBF,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;IAC1D,2CAA2C;IAC3C,iBAAiB,EAAE,eAAe,CAAC;IACnC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;CACnE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACtC,OAAO,sBAAsB,KAC3B,KAAK,CAAC,oBAAoB,CAiD5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
|
|
@@ -25,7 +25,7 @@ import { apply_middleware_specs, apply_route_specs, prefix_route_specs } from '.
|
|
|
25
25
|
import { check_bootstrap_status, create_bootstrap_route_specs } from '../auth/bootstrap_routes.js';
|
|
26
26
|
import { create_surface_route_spec } from './surface_route.js';
|
|
27
27
|
import { flush_pending_effects, flush_post_commit_effects } from '../http/pending_effects.js';
|
|
28
|
-
import { assert_endpoint_in_auth_scope, assert_middleware_stack_mounted, create_auth_middleware_specs } from '../auth/middleware.js';
|
|
28
|
+
import { assert_credential_routes_in_auth_scope, assert_endpoint_in_auth_scope, assert_middleware_stack_mounted, create_auth_middleware_specs } from '../auth/middleware.js';
|
|
29
29
|
import { fuz_auth_guard_resolver } from '../auth/auth_guard_resolver.js';
|
|
30
30
|
import { create_fuz_authorization_handler } from '../auth/request_context.js';
|
|
31
31
|
import { create_body_limit_middleware } from '../http/body_limit.js';
|
|
@@ -270,7 +270,7 @@ const assemble_app_server = async (options, releases) => {
|
|
|
270
270
|
})
|
|
271
271
|
: null;
|
|
272
272
|
if (audit_sse) {
|
|
273
|
-
releases.push(deps.connection_closer.add(create_sse_connection_closer(audit_sse.registry)));
|
|
273
|
+
releases.push(deps.connection_closer.add(create_sse_connection_closer(audit_sse.registry, audit_sse.required_role)));
|
|
274
274
|
releases.push(deps.audit.add_listener(audit_sse.on_audit_event));
|
|
275
275
|
}
|
|
276
276
|
// Proxy middleware
|
|
@@ -279,7 +279,8 @@ const assemble_app_server = async (options, releases) => {
|
|
|
279
279
|
const auth_middleware = await create_auth_middleware_specs(deps, {
|
|
280
280
|
allowed_origins: options.allowed_origins,
|
|
281
281
|
session_options: options.session_options,
|
|
282
|
-
daemon_token_state: options.daemon_token_state
|
|
282
|
+
daemon_token_state: options.daemon_token_state,
|
|
283
|
+
origin_carve_outs: options.origin_carve_outs
|
|
283
284
|
});
|
|
284
285
|
const stack_specs = [proxy_spec, ...auth_middleware];
|
|
285
286
|
let middleware_specs = stack_specs;
|
|
@@ -384,6 +385,10 @@ const assemble_app_server = async (options, releases) => {
|
|
|
384
385
|
factory_routes.push(create_surface_route_spec(surface_ref));
|
|
385
386
|
}
|
|
386
387
|
const route_specs = [...consumer_routes, ...factory_routes];
|
|
388
|
+
// a route that reads or mints a credential outside the auth scope would
|
|
389
|
+
// skip session parsing or fall under an origin carve-out — consumer
|
|
390
|
+
// prefixes included (account and signup specs are relative)
|
|
391
|
+
assert_credential_routes_in_auth_scope(route_specs);
|
|
387
392
|
// WS path checks — pure data, so they run before anything mounts.
|
|
388
393
|
// `register_ws_endpoint` mounts a `GET path` upgrade route: a duplicate
|
|
389
394
|
// path, or one a `RouteSpec` already registered as `GET path`, would be
|
package/dist/server/env.d.ts
CHANGED
|
@@ -60,7 +60,8 @@ export type ServerEnvOptionsResult = ServerEnvOptions | ServerEnvOptionsError;
|
|
|
60
60
|
/**
|
|
61
61
|
* Validate a loaded `BaseServerEnv` and produce the artifacts needed for server init.
|
|
62
62
|
*
|
|
63
|
-
* Handles keyring validation, origin parsing
|
|
63
|
+
* Handles keyring validation, origin parsing (every refused allowlist entry is
|
|
64
|
+
* reported, each on its own line), and bootstrap token path extraction.
|
|
64
65
|
* Returns a Result so callers handle errors their own way (exit, logging, etc).
|
|
65
66
|
*
|
|
66
67
|
* @param env - a loaded and Zod-validated `BaseServerEnv`
|
package/dist/server/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA4B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG5E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;kBAoDxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,wBAAwB,GAAG,qBAAqB,CAAC;IACxD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;AAE9E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,aAAa,KAAG,sBAmBxD,CAAC"}
|
package/dist/server/env.js
CHANGED
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
-
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
13
12
|
import { create_validated_keyring } from '../auth/keyring.js';
|
|
14
|
-
import { parse_allowed_origins } from '../http/origin.js';
|
|
13
|
+
import { format_allowed_origins_error, parse_allowed_origins } from '../http/origin.js';
|
|
15
14
|
/**
|
|
16
15
|
* Base Zod schema for server environment variables.
|
|
17
16
|
*
|
|
@@ -76,7 +75,8 @@ export const BaseServerEnv = z.strictObject({
|
|
|
76
75
|
/**
|
|
77
76
|
* Validate a loaded `BaseServerEnv` and produce the artifacts needed for server init.
|
|
78
77
|
*
|
|
79
|
-
* Handles keyring validation, origin parsing
|
|
78
|
+
* Handles keyring validation, origin parsing (every refused allowlist entry is
|
|
79
|
+
* reported, each on its own line), and bootstrap token path extraction.
|
|
80
80
|
* Returns a Result so callers handle errors their own way (exit, logging, etc).
|
|
81
81
|
*
|
|
82
82
|
* @param env - a loaded and Zod-validated `BaseServerEnv`
|
|
@@ -87,28 +87,18 @@ export const validate_server_env = (env) => {
|
|
|
87
87
|
if (!keyring_result.ok) {
|
|
88
88
|
return { ok: false, field: 'SECRET_FUZ_COOKIE_KEYS', errors: keyring_result.errors };
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
allowed_origins = parse_allowed_origins(env.FUZ_ALLOWED_ORIGINS);
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
return {
|
|
96
|
-
ok: false,
|
|
97
|
-
field: 'FUZ_ALLOWED_ORIGINS',
|
|
98
|
-
errors: [to_error_message(err, 'Invalid FUZ_ALLOWED_ORIGINS')]
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (allowed_origins.length === 0) {
|
|
90
|
+
const origins_result = parse_allowed_origins(env.FUZ_ALLOWED_ORIGINS);
|
|
91
|
+
if (!origins_result.ok) {
|
|
102
92
|
return {
|
|
103
93
|
ok: false,
|
|
104
94
|
field: 'FUZ_ALLOWED_ORIGINS',
|
|
105
|
-
errors:
|
|
95
|
+
errors: origins_result.errors.map(format_allowed_origins_error)
|
|
106
96
|
};
|
|
107
97
|
}
|
|
108
98
|
return {
|
|
109
99
|
ok: true,
|
|
110
100
|
keyring: keyring_result.keyring,
|
|
111
|
-
allowed_origins,
|
|
101
|
+
allowed_origins: origins_result.origins,
|
|
112
102
|
bootstrap_token_path: env.FUZ_BOOTSTRAP_TOKEN_PATH ?? null
|
|
113
103
|
};
|
|
114
104
|
};
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* - `GET /api/cells/:cell_id/facts/:hash` — the **per-reference read**.
|
|
7
7
|
* The request names the referencing cell. Authz is scoped to that one
|
|
8
|
-
* reference: `can_view_cell(caller, cell)
|
|
9
|
-
*
|
|
8
|
+
* reference: `(can_view_cell(caller, cell) OR the steward arm) AND
|
|
9
|
+
* cell.refs includes hash`, the steward arm being the governing root's
|
|
10
|
+
* manager reading a pending or rejected contribution
|
|
11
|
+
* (`auth/cell_steward.ts`). This is the path non-admin callers use, and the only path for
|
|
10
12
|
* confidential content.
|
|
11
13
|
* - `GET /api/facts/:hash` — the **bare-hash read**, restricted to admins.
|
|
12
14
|
*
|
|
@@ -52,7 +54,8 @@
|
|
|
52
54
|
* (populated by the `/api/*` session middleware) by resolving the caller's
|
|
53
55
|
* single actor and loading their role_grants. Unauthed callers pass through
|
|
54
56
|
* with `req_ctx: null` and are admitted only by a `cell.visibility ===
|
|
55
|
-
* 'public'` cell
|
|
57
|
+
* 'public'` cell whose `moderation` admits an audience (unmoderated or
|
|
58
|
+
* `'approved'`). Multi-actor accounts fall through with `req_ctx: null`
|
|
56
59
|
* — there's no `acting?` slot on a pure-public route, so multi-actor
|
|
57
60
|
* callers are treated as anonymous.
|
|
58
61
|
*
|
|
@@ -121,7 +124,8 @@ export interface CreateServeFactRouteSpecOptions {
|
|
|
121
124
|
* — the per-reference read.
|
|
122
125
|
*
|
|
123
126
|
* Resolves the named cell (404 if missing / soft-deleted), requires
|
|
124
|
-
* `can_view_cell(caller, cell)`
|
|
127
|
+
* `can_view_cell(caller, cell)` — or the steward arm,
|
|
128
|
+
* `cell_steward_admits` — AND `cell.refs` to include the hash
|
|
125
129
|
* (else 404, masked), then serves the bytes. Authz is scoped to this one
|
|
126
130
|
* `(cell, hash)` edge — never unioned across the fact's other referrers.
|
|
127
131
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAetD,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAO/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkEjD,MAAM,WAAW,+BAA+B;IAC/C;;;;;;OAMG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAkHD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS,+BAA+B,KACtC,SAuDF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,SA2CF,CAAC"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* - `GET /api/cells/:cell_id/facts/:hash` — the **per-reference read**.
|
|
7
7
|
* The request names the referencing cell. Authz is scoped to that one
|
|
8
|
-
* reference: `can_view_cell(caller, cell)
|
|
9
|
-
*
|
|
8
|
+
* reference: `(can_view_cell(caller, cell) OR the steward arm) AND
|
|
9
|
+
* cell.refs includes hash`, the steward arm being the governing root's
|
|
10
|
+
* manager reading a pending or rejected contribution
|
|
11
|
+
* (`auth/cell_steward.ts`). This is the path non-admin callers use, and the only path for
|
|
10
12
|
* confidential content.
|
|
11
13
|
* - `GET /api/facts/:hash` — the **bare-hash read**, restricted to admins.
|
|
12
14
|
*
|
|
@@ -52,7 +54,8 @@
|
|
|
52
54
|
* (populated by the `/api/*` session middleware) by resolving the caller's
|
|
53
55
|
* single actor and loading their role_grants. Unauthed callers pass through
|
|
54
56
|
* with `req_ctx: null` and are admitted only by a `cell.visibility ===
|
|
55
|
-
* 'public'` cell
|
|
57
|
+
* 'public'` cell whose `moderation` admits an audience (unmoderated or
|
|
58
|
+
* `'approved'`). Multi-actor accounts fall through with `req_ctx: null`
|
|
56
59
|
* — there's no `acting?` slot on a pure-public route, so multi-actor
|
|
57
60
|
* callers are treated as anonymous.
|
|
58
61
|
*
|
|
@@ -106,6 +109,7 @@ import { query_get_fact, query_get_fact_meta } from '../db/fact_queries.js';
|
|
|
106
109
|
import { query_cell_get } from '../db/cell_queries.js';
|
|
107
110
|
import { query_cell_grant_list_for_cell } from '../db/cell_grant_queries.js';
|
|
108
111
|
import { can_view_cell } from '../auth/cell_authorize.js';
|
|
112
|
+
import { cell_steward_admits } from '../auth/cell_steward.js';
|
|
109
113
|
import { parse_file_fact_url } from '../db/file_fact_url.js';
|
|
110
114
|
/** `Cache-Control` for fact responses — 5 min revocation window. */
|
|
111
115
|
const CACHE_CONTROL = 'private, max-age=300';
|
|
@@ -254,7 +258,8 @@ const build_public_request_context = async (c, route) => {
|
|
|
254
258
|
* — the per-reference read.
|
|
255
259
|
*
|
|
256
260
|
* Resolves the named cell (404 if missing / soft-deleted), requires
|
|
257
|
-
* `can_view_cell(caller, cell)`
|
|
261
|
+
* `can_view_cell(caller, cell)` — or the steward arm,
|
|
262
|
+
* `cell_steward_admits` — AND `cell.refs` to include the hash
|
|
258
263
|
* (else 404, masked), then serves the bytes. Authz is scoped to this one
|
|
259
264
|
* `(cell, hash)` edge — never unioned across the fact's other referrers.
|
|
260
265
|
*
|
|
@@ -268,7 +273,8 @@ export const create_serve_cell_fact_route_spec = (options) => {
|
|
|
268
273
|
method: 'GET',
|
|
269
274
|
path: '/api/cells/:cell_id/facts/:hash',
|
|
270
275
|
auth: { account: 'none', actor: 'none' },
|
|
271
|
-
|
|
276
|
+
reads_credential: true,
|
|
277
|
+
description: "Serve content-addressed fact bytes through a named referencing cell. 404 unless the cell admits the caller via can_view_cell (or the steward arm: the governing root's manager reading a pending or rejected contribution) AND references the hash (per-reference, never union-of-referrers).",
|
|
272
278
|
params: cell_fact_params_schema,
|
|
273
279
|
input: z.null(),
|
|
274
280
|
// The body is a binary stream; no JSON output schema applies.
|
|
@@ -297,7 +303,11 @@ export const create_serve_cell_fact_route_spec = (options) => {
|
|
|
297
303
|
const grants = req_ctx
|
|
298
304
|
? await query_cell_grant_list_for_cell({ db: route.db }, cell.id)
|
|
299
305
|
: null;
|
|
300
|
-
|
|
306
|
+
// The governing root's manager also reads a pending or rejected
|
|
307
|
+
// contribution's facts (the steward arm, `auth/cell_steward.ts`),
|
|
308
|
+
// checked only once the view check denies.
|
|
309
|
+
if (!can_view_cell(req_ctx, cell, grants) &&
|
|
310
|
+
!(await cell_steward_admits({ db: route.db }, req_ctx, cell))) {
|
|
301
311
|
// 404 (not 403) so an unviewable cell→fact edge doesn't leak.
|
|
302
312
|
return c.body(null, 404);
|
|
303
313
|
}
|