@fuzdev/fuz_app 0.54.0 → 0.55.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 +68 -13
- package/dist/actions/action_codegen.d.ts +13 -0
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +15 -1
- package/dist/actions/action_rpc.d.ts +60 -7
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +158 -44
- package/dist/actions/register_action_ws.d.ts +4 -4
- package/dist/actions/register_action_ws.js +6 -6
- package/dist/actions/register_ws_endpoint.d.ts +20 -7
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +30 -5
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +0 -4
- package/dist/auth/CLAUDE.md +219 -66
- package/dist/auth/account_actions.d.ts +6 -6
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +8 -11
- package/dist/auth/account_queries.d.ts +6 -3
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +14 -5
- package/dist/auth/account_routes.d.ts +7 -10
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +70 -23
- package/dist/auth/account_schema.d.ts +19 -0
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +20 -0
- package/dist/auth/admin_action_specs.d.ts +45 -11
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +23 -8
- package/dist/auth/admin_actions.d.ts +8 -7
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +11 -18
- package/dist/auth/audit_log_queries.d.ts +53 -14
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +45 -2
- package/dist/auth/audit_log_schema.d.ts +55 -1
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +19 -3
- package/dist/auth/bearer_auth.d.ts +9 -7
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +13 -21
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +5 -0
- package/dist/auth/daemon_token_middleware.d.ts +23 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +26 -20
- package/dist/auth/deps.d.ts +14 -0
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +4 -2
- package/dist/auth/migrations.d.ts +15 -7
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +15 -7
- package/dist/auth/permit_offer_action_specs.d.ts +45 -6
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +38 -7
- package/dist/auth/permit_offer_actions.d.ts +2 -2
- package/dist/auth/permit_offer_actions.d.ts.map +1 -1
- package/dist/auth/permit_offer_actions.js +98 -90
- package/dist/auth/permit_offer_notifications.d.ts +10 -0
- package/dist/auth/permit_offer_notifications.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.d.ts +68 -9
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +147 -35
- package/dist/auth/permit_offer_schema.d.ts +23 -1
- package/dist/auth/permit_offer_schema.d.ts.map +1 -1
- package/dist/auth/permit_offer_schema.js +5 -0
- package/dist/auth/permit_queries.d.ts +17 -5
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +19 -8
- package/dist/auth/request_context.d.ts +321 -38
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +393 -66
- package/dist/auth/route_guards.d.ts +10 -4
- package/dist/auth/route_guards.d.ts.map +1 -1
- package/dist/auth/route_guards.js +14 -8
- package/dist/auth/self_service_role_action_specs.d.ts +2 -0
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +2 -0
- package/dist/auth/self_service_role_actions.d.ts +6 -5
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +18 -8
- package/dist/db/migrate.d.ts +11 -7
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +9 -6
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +5 -3
- package/dist/hono_context.d.ts +77 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +50 -0
- package/dist/http/CLAUDE.md +80 -17
- package/dist/http/error_schemas.d.ts +92 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +73 -16
- package/dist/http/jsonrpc_errors.d.ts +27 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +26 -2
- package/dist/http/route_spec.d.ts +62 -4
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +117 -21
- package/dist/http/schema_helpers.d.ts +13 -1
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +21 -2
- package/dist/http/surface.d.ts +10 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +2 -2
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +11 -1
- package/dist/testing/CLAUDE.md +23 -17
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +15 -13
- package/dist/testing/adversarial_headers.js +1 -1
- package/dist/testing/app_server.js +2 -2
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +21 -7
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +6 -3
- package/dist/testing/entities.d.ts +2 -1
- package/dist/testing/entities.d.ts.map +1 -1
- package/dist/testing/entities.js +1 -0
- package/dist/testing/integration_helpers.d.ts +4 -2
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +9 -5
- package/dist/testing/middleware.d.ts +12 -8
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +67 -25
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +3 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +5 -1
- package/dist/ui/CLAUDE.md +16 -10
- package/dist/ui/PermitOfferForm.svelte +14 -0
- package/dist/ui/PermitOfferForm.svelte.d.ts +6 -0
- package/dist/ui/PermitOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +8 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +14 -3
- package/dist/ui/permit_offers_state.svelte.d.ts +9 -1
- package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/permit_offers_state.svelte.js +7 -1
- package/package.json +1 -1
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
* The consumer is responsible for rejecting unauthenticated upgrades *before*
|
|
24
24
|
* routing to this handler (fuz_app's `require_auth` middleware, or
|
|
25
25
|
* `register_ws_endpoint` which wires it for you). Inside the dispatcher,
|
|
26
|
-
* `
|
|
27
|
-
* auth is enforced on each message.
|
|
26
|
+
* `require_request_context(c)` enforces the dispatcher invariant and
|
|
27
|
+
* per-action auth is enforced on each message.
|
|
28
28
|
*
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
|
31
31
|
import { DEV } from 'esm-env';
|
|
32
32
|
import { wait } from '@fuzdev/fuz_util/async.js';
|
|
33
33
|
import { Logger } from '@fuzdev/fuz_util/log.js';
|
|
34
|
-
import {
|
|
34
|
+
import { has_role, require_request_context } from '../auth/request_context.js';
|
|
35
35
|
import { hash_session_token } from '../auth/session_queries.js';
|
|
36
36
|
import { ROLE_KEEPER } from '../auth/role_schema.js';
|
|
37
37
|
import { get_client_ip } from '../http/proxy.js';
|
|
@@ -95,7 +95,7 @@ export const register_action_ws = (options) => {
|
|
|
95
95
|
// Upgrade-time auth extraction — `require_auth` middleware has already
|
|
96
96
|
// rejected unauthenticated requests, so request_context is guaranteed
|
|
97
97
|
// non-null by the time we get here.
|
|
98
|
-
const request_context =
|
|
98
|
+
const request_context = require_request_context(c);
|
|
99
99
|
const account_id = request_context.account.id;
|
|
100
100
|
// Resolved at upgrade — every message on this socket shares the
|
|
101
101
|
// same client IP, so we capture once and reuse for rate-limit
|
|
@@ -277,7 +277,7 @@ export const register_action_ws = (options) => {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
if (account_check) {
|
|
280
|
-
const result = action_account_rate_limiter.check(request_context.
|
|
280
|
+
const result = action_account_rate_limiter.check(request_context.account.id);
|
|
281
281
|
if (!result.allowed) {
|
|
282
282
|
send_rate_limited(result.retry_after);
|
|
283
283
|
return;
|
|
@@ -286,7 +286,7 @@ export const register_action_ws = (options) => {
|
|
|
286
286
|
if (ip_check)
|
|
287
287
|
action_ip_rate_limiter.record(client_ip);
|
|
288
288
|
if (account_check)
|
|
289
|
-
action_account_rate_limiter.record(request_context.
|
|
289
|
+
action_account_rate_limiter.record(request_context.account.id);
|
|
290
290
|
}
|
|
291
291
|
// Look up handler — method is validated against spec_by_method above.
|
|
292
292
|
const handler = handlers[method];
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
* 1. `verify_request_source(allowed_origins)` — reject disallowed origins
|
|
8
8
|
* before the upgrade handshake runs.
|
|
9
9
|
* 2. `require_auth` — reject unauthenticated upgrades.
|
|
10
|
-
* 3.
|
|
10
|
+
* 3. **Authorization phase** — resolve the acting actor against the
|
|
11
|
+
* authenticated account plus an optional `?acting=<uuid>` query string,
|
|
12
|
+
* and build the `RequestContext` that per-message dispatch reads.
|
|
13
|
+
* Multi-actor accounts must supply `?acting` to pick a persona;
|
|
14
|
+
* single-actor accounts work without it.
|
|
15
|
+
* 4. Optional `require_role(required_role)` — for endpoints gated to a
|
|
11
16
|
* specific role.
|
|
12
17
|
*
|
|
13
18
|
* Then delegates to `register_action_ws` for per-message JSON-RPC
|
|
@@ -16,6 +21,7 @@
|
|
|
16
21
|
* @module
|
|
17
22
|
*/
|
|
18
23
|
import type { RoleName } from '../auth/role_schema.js';
|
|
24
|
+
import type { Db } from '../db/db.js';
|
|
19
25
|
import { type RegisterActionWsOptions, type RegisterActionWsResult } from './register_action_ws.js';
|
|
20
26
|
import type { BaseHandlerContext } from './action_types.js';
|
|
21
27
|
/** Options for `register_ws_endpoint`. */
|
|
@@ -27,22 +33,29 @@ export interface RegisterWsEndpointOptions<TCtx extends BaseHandlerContext> exte
|
|
|
27
33
|
*/
|
|
28
34
|
allowed_origins: Array<RegExp>;
|
|
29
35
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
36
|
+
* Pool-level database used for upgrade-time actor resolution + permit
|
|
37
|
+
* load. Ran once per connection, then the result is reused for every
|
|
38
|
+
* message on the socket.
|
|
39
|
+
*/
|
|
40
|
+
db: Db;
|
|
41
|
+
/**
|
|
42
|
+
* Role required to upgrade. Omit for any authenticated account
|
|
43
|
+
* (`require_auth` + actor resolution alone); set to e.g. `ROLE_ADMIN`
|
|
44
|
+
* to gate the endpoint behind a role. The per-action `auth` in each
|
|
45
|
+
* spec still applies at dispatch time — this is a coarse upgrade-time
|
|
46
|
+
* gate.
|
|
34
47
|
*/
|
|
35
48
|
required_role?: RoleName;
|
|
36
49
|
}
|
|
37
50
|
/**
|
|
38
51
|
* Mount a WebSocket endpoint with the standard upgrade stack (origin check
|
|
39
|
-
* + auth + optional role) and JSON-RPC dispatch.
|
|
52
|
+
* + auth + actor resolution + optional role) and JSON-RPC dispatch.
|
|
40
53
|
*
|
|
41
54
|
* Returns the `BackendWebsocketTransport` (supplied or freshly
|
|
42
55
|
* created), same as `register_action_ws` — retain it to wire
|
|
43
56
|
* `create_ws_auth_guard` on `on_audit_event` or to broadcast.
|
|
44
57
|
*
|
|
45
|
-
* @mutates options.app - applies origin/auth/role middleware via `app.use`,
|
|
58
|
+
* @mutates options.app - applies origin/auth/authorization/role middleware via `app.use`,
|
|
46
59
|
* then registers the `GET path` route via the inner `register_action_ws`
|
|
47
60
|
*/
|
|
48
61
|
export declare const register_ws_endpoint: <TCtx extends BaseHandlerContext>(options: RegisterWsEndpointOptions<TCtx>) => RegisterActionWsResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_ws_endpoint.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_ws_endpoint.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"register_ws_endpoint.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_ws_endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAEN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAE1D,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB,CACzC,IAAI,SAAS,kBAAkB,CAC9B,SAAQ,uBAAuB,CAAC,IAAI,CAAC;IACtC;;;;OAIG;IACH,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;OAIG;IACH,EAAE,EAAE,EAAE,CAAC;IACP;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB;AAqBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,kBAAkB,EACnE,SAAS,yBAAyB,CAAC,IAAI,CAAC,KACtC,sBAmBF,CAAC"}
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
* 1. `verify_request_source(allowed_origins)` — reject disallowed origins
|
|
8
8
|
* before the upgrade handshake runs.
|
|
9
9
|
* 2. `require_auth` — reject unauthenticated upgrades.
|
|
10
|
-
* 3.
|
|
10
|
+
* 3. **Authorization phase** — resolve the acting actor against the
|
|
11
|
+
* authenticated account plus an optional `?acting=<uuid>` query string,
|
|
12
|
+
* and build the `RequestContext` that per-message dispatch reads.
|
|
13
|
+
* Multi-actor accounts must supply `?acting` to pick a persona;
|
|
14
|
+
* single-actor accounts work without it.
|
|
15
|
+
* 4. Optional `require_role(required_role)` — for endpoints gated to a
|
|
11
16
|
* specific role.
|
|
12
17
|
*
|
|
13
18
|
* Then delegates to `register_action_ws` for per-message JSON-RPC
|
|
@@ -16,24 +21,44 @@
|
|
|
16
21
|
* @module
|
|
17
22
|
*/
|
|
18
23
|
import { Logger } from '@fuzdev/fuz_util/log.js';
|
|
19
|
-
import { require_auth, require_role } from '../auth/request_context.js';
|
|
24
|
+
import { apply_authorization_phase, require_auth, require_role } from '../auth/request_context.js';
|
|
20
25
|
import { verify_request_source } from '../http/origin.js';
|
|
21
26
|
import { register_action_ws, } from './register_action_ws.js';
|
|
27
|
+
/**
|
|
28
|
+
* Upgrade-time authorization middleware. Resolves the acting actor for
|
|
29
|
+
* the WS connection (single-actor default; multi-actor must supply
|
|
30
|
+
* `?acting=<uuid>`) and builds the `RequestContext` that per-message
|
|
31
|
+
* dispatch reads. Returns 400 on resolution failure.
|
|
32
|
+
*/
|
|
33
|
+
const create_ws_authorization_middleware = (db) => {
|
|
34
|
+
return async (c, next) => {
|
|
35
|
+
const acting_param = c.req.query('acting');
|
|
36
|
+
// `apply_authorization_phase` is a no-op when the test-harness flag
|
|
37
|
+
// `TEST_CONTEXT_PRESET_KEY` is set (escape hatch for pre-baked
|
|
38
|
+
// `RequestContext`). Failure shape is `{status, body}`; the WS
|
|
39
|
+
// upgrade is a plain HTTP response, so bind it the same way REST does.
|
|
40
|
+
const failure = await apply_authorization_phase({ db }, c, true, acting_param ?? undefined);
|
|
41
|
+
if (failure)
|
|
42
|
+
return c.json(failure.body, failure.status);
|
|
43
|
+
await next();
|
|
44
|
+
};
|
|
45
|
+
};
|
|
22
46
|
/**
|
|
23
47
|
* Mount a WebSocket endpoint with the standard upgrade stack (origin check
|
|
24
|
-
* + auth + optional role) and JSON-RPC dispatch.
|
|
48
|
+
* + auth + actor resolution + optional role) and JSON-RPC dispatch.
|
|
25
49
|
*
|
|
26
50
|
* Returns the `BackendWebsocketTransport` (supplied or freshly
|
|
27
51
|
* created), same as `register_action_ws` — retain it to wire
|
|
28
52
|
* `create_ws_auth_guard` on `on_audit_event` or to broadcast.
|
|
29
53
|
*
|
|
30
|
-
* @mutates options.app - applies origin/auth/role middleware via `app.use`,
|
|
54
|
+
* @mutates options.app - applies origin/auth/authorization/role middleware via `app.use`,
|
|
31
55
|
* then registers the `GET path` route via the inner `register_action_ws`
|
|
32
56
|
*/
|
|
33
57
|
export const register_ws_endpoint = (options) => {
|
|
34
|
-
const { app, path, allowed_origins, required_role, log = new Logger('[ws]'), ...rest } = options;
|
|
58
|
+
const { app, path, allowed_origins, db, required_role, log = new Logger('[ws]'), ...rest } = options;
|
|
35
59
|
app.use(path, verify_request_source(allowed_origins));
|
|
36
60
|
app.use(path, require_auth);
|
|
61
|
+
app.use(path, create_ws_authorization_middleware(db));
|
|
37
62
|
if (required_role !== undefined) {
|
|
38
63
|
app.use(path, require_role(required_role));
|
|
39
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EACX,gCAAgC,EAChC,gCAAgC,EAChC,m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AS,GAAG,IAAI;IAQ9C;;;;;OAKG;IACH,qBAAqB,CAAC,cAAc,EAAE,aAAa,GAAG,IAAI;IAM1D;;;;;;OAMG;IACH,aAAa,CAAC,cAAc,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;IAO/D,QAAQ,IAAI,OAAO,GAAG,IAAI;IAM1B,qBAAqB,IAAI,SAAS,GAAG,IAAI;IAIzC,0BAA0B,IAAI,aAAa,GAAG,IAAI;IAIlD,qBAAqB,CAAC,cAAc,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;CAwCtE"}
|
|
@@ -32,7 +32,6 @@ export class Transports {
|
|
|
32
32
|
*/
|
|
33
33
|
register_transport(transport) {
|
|
34
34
|
this.#transport_by_name.set(transport.transport_name, transport); // TODO maybe ensure unregistering of any previous transport?
|
|
35
|
-
// Set current transport if not already set
|
|
36
35
|
if (!this.#current_transport) {
|
|
37
36
|
this.#current_transport = transport;
|
|
38
37
|
}
|
|
@@ -87,7 +86,6 @@ export class Transports {
|
|
|
87
86
|
return null;
|
|
88
87
|
}
|
|
89
88
|
#get_first_ready(transport_name) {
|
|
90
|
-
// First try the specified transport(s) if provided
|
|
91
89
|
if (transport_name) {
|
|
92
90
|
const transport_names = Array.isArray(transport_name) ? transport_name : [transport_name];
|
|
93
91
|
for (const transport_name of transport_names) {
|
|
@@ -97,11 +95,9 @@ export class Transports {
|
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
// Then try the current transport if it's ready
|
|
101
98
|
if (this.#current_transport?.is_ready()) {
|
|
102
99
|
return this.#current_transport;
|
|
103
100
|
}
|
|
104
|
-
// Finally, try any other available transport
|
|
105
101
|
for (const transport of this.#transport_by_name.values()) {
|
|
106
102
|
if (transport.is_ready()) {
|
|
107
103
|
return transport;
|