@fuzdev/fuz_app 0.61.0 → 0.63.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 +43 -35
- package/dist/actions/action_rpc.d.ts +10 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +1 -1
- package/dist/actions/action_spec.d.ts +1 -1
- package/dist/actions/action_spec.js +1 -1
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +1 -0
- package/dist/auth/CLAUDE.md +47 -26
- package/dist/auth/account_action_specs.d.ts +6 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +11 -4
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -4
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +8 -4
- package/dist/auth/account_schema.d.ts +2 -2
- package/dist/auth/account_schema.js +2 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_lookup_queries.d.ts +1 -1
- package/dist/auth/actor_lookup_queries.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts +1 -1
- package/dist/auth/actor_search_action_specs.js +1 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +1 -1
- package/dist/auth/actor_search_queries.js +1 -1
- package/dist/auth/all_action_spec_registries.d.ts +2 -2
- package/dist/auth/all_action_spec_registries.js +2 -2
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +25 -0
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +16 -0
- package/dist/auth/request_context.d.ts +1 -1
- package/dist/env/update_env_variable.js +1 -1
- package/dist/http/CLAUDE.md +15 -15
- package/dist/server/app_server.d.ts +54 -6
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +32 -4
- package/dist/testing/CLAUDE.md +34 -50
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +17 -1
- package/dist/ui/CLAUDE.md +13 -18
- package/dist/ui/keyed_async_slot.svelte.d.ts +1 -1
- package/dist/ui/keyed_async_slot.svelte.js +1 -1
- package/package.json +1 -1
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -12,12 +12,13 @@ server-authoritative dispatch, role-grant-offer UI integration) see
|
|
|
12
12
|
../../docs/usage.md §Deriving Route/Event Specs, §Single JSON-RPC 2.0 Endpoint,
|
|
13
13
|
§WebSocket Endpoint. For DEV-only output validation semantics see
|
|
14
14
|
../../docs/architecture.md §DEV-only Output Validation. For the SAES
|
|
15
|
-
binding matrix and middleware ordering see the root
|
|
15
|
+
binding matrix and middleware ordering see the root ../../CLAUDE.md
|
|
16
16
|
§Action Spec System (SAES) and §Middleware Ordering.
|
|
17
17
|
|
|
18
18
|
IMPORTANT: Every exported Zod schema is paired with a same-named `z.infer`
|
|
19
|
-
type export
|
|
20
|
-
|
|
19
|
+
type export — the convention callers rely on for type imports. When adding
|
|
20
|
+
new schemas, keep the pair invariant (ecosystem-wide rule; see
|
|
21
|
+
Skill(fuz-stack) zod-schemas).
|
|
21
22
|
|
|
22
23
|
NOTE: `ActionRegistry` keeps a few pre-built getters (auth filters,
|
|
23
24
|
initiator-direction filters) that codegen doesn't consume today — kept
|
|
@@ -53,10 +54,10 @@ declarative metadata for consumers (codegen, UI form-state matching, docs)
|
|
|
53
54
|
to read off the spec instead of scanning handler code. No runtime
|
|
54
55
|
enforcement — drift between declared reasons and what handlers actually
|
|
55
56
|
throw is caught per-module by source-scanning unit tests (see
|
|
56
|
-
|
|
57
|
+
../../test/auth/role*grant_offer_actions.error_reasons.test.ts). Reuses
|
|
57
58
|
the same `as const` string constants the handler throws (e.g.
|
|
58
|
-
`
|
|
59
|
-
`ERROR_ROLE_GRANT_NOT_FOUND`
|
|
59
|
+
`ERROR_ROLE_GRANT_OFFER*\*`from`auth/role_grant_offer_action_specs.ts`,
|
|
60
|
+
`ERROR_ROLE_GRANT_NOT_FOUND`from`http/error_schemas.ts`) so call
|
|
60
61
|
sites can import either side. Standard transport errors (validation,
|
|
61
62
|
auth, rate-limit) stay implicit.
|
|
62
63
|
|
|
@@ -119,7 +120,7 @@ The remaining asymmetry today is runtime: there is no
|
|
|
119
120
|
`Promise<Result<{value}, {error}>>` shape `FrontendActionsApi` methods
|
|
120
121
|
return. Closing those gaps is on the deferred follow-up set in the
|
|
121
122
|
[SAES RPC closeout](https://github.com/ryanatkn/grimoire/blob/main/quests/HISTORY.md#saes-rpc-direction-2026-04)
|
|
122
|
-
(grimoire `lore/fuz_app/TODO.md` §
|
|
123
|
+
(grimoire `lore/fuz_app/TODO.md` §Future Directions tracks the symmetric
|
|
123
124
|
backend signature, backend RPC client, and local-call symmetry items) —
|
|
124
125
|
wait for a second backend runtime case.
|
|
125
126
|
|
|
@@ -217,7 +218,7 @@ and `FrontendActionHandlers`.
|
|
|
217
218
|
- `generate_action_event_datas(specs, imports, {same_file?, collections_path?, include_protocol_actions?})` — `ActionEventDatas` interface; per-spec variant by kind (`ActionEventRequestResponseData` / `ActionEventRemoteNotificationData` / `ActionEventLocalCallData`). `same_file` (default `true`) is the file-layout switch: when `true`, assumes `ActionInputs` / `ActionOutputs` are in the same module and adds no import (the zzz pattern); when `false`, adds the type imports from `collections_path` (default `'./action_collections.js'`). `collections_path` alone is a no-op — the surprising omit-vs-default behavior of earlier versions has been replaced.
|
|
218
219
|
- `generate_frontend_actions_api(specs, imports, {interface_name?, method_filter?, collections_path?, sync_returns_value?, include_protocol_actions?})` — emits the typed `FrontendActionsApi` interface (configurable via `interface_name`, default `'FrontendActionsApi'`). One method signature per spec via `generate_actions_api_method_signature`. Protocol actions filtered by default; `method_filter: (spec) => boolean` runs after the protocol-action filter. Renamed from `generate_actions_api` in API review III to make the side-of-the-wire intent visible at every consumer site.
|
|
219
220
|
- `generate_frontend_action_handlers(specs, imports, {collections_path?, include_protocol_actions?})` — `FrontendActionHandlers` interface (Tier 2 only — wraps `generate_phase_handlers` with `action_event_type: 'TypedActionEvent'`). Pair with `generate_typed_action_event_alias`.
|
|
220
|
-
- `generate_backend_actions_api(specs, imports, {interface_name?, spec_array_name?, specs_module?, collections_path?, qualify_spec?, include_protocol_actions?})` — `BackendActionsApi` interface AND `broadcast_action_specs: ReadonlyArray<ActionSpecUnion>` array (both names configurable). Filter: `kind === 'remote_notification' && initiator !== 'frontend'`, with `streams`-target methods (request-scoped progress notifications invoked via `ctx.notify`) excluded — the discriminator is `ActionSpec.streams`, not a manual list. Adds `ActionInputs` (from `collections_path`) + `ActionSpecUnion`, plus `* as specs` from `specs_module` unless `qualify_spec` is set. Method shape today is `(input) => Promise<void>` (matches `create_broadcast_api`'s fire-and-forget runtime); generalizing to per-kind shapes via `generate_actions_api_method_signature` is deferred until a second backend runtime constructor lands (tracked in grimoire `lore/fuz_app/TODO.md` §
|
|
221
|
+
- `generate_backend_actions_api(specs, imports, {interface_name?, spec_array_name?, specs_module?, collections_path?, qualify_spec?, include_protocol_actions?})` — `BackendActionsApi` interface AND `broadcast_action_specs: ReadonlyArray<ActionSpecUnion>` array (both names configurable). Filter: `kind === 'remote_notification' && initiator !== 'frontend'`, with `streams`-target methods (request-scoped progress notifications invoked via `ctx.notify`) excluded — the discriminator is `ActionSpec.streams`, not a manual list. Adds `ActionInputs` (from `collections_path`) + `ActionSpecUnion`, plus `* as specs` from `specs_module` unless `qualify_spec` is set. Method shape today is `(input) => Promise<void>` (matches `create_broadcast_api`'s fire-and-forget runtime); generalizing to per-kind shapes via `generate_actions_api_method_signature` is deferred until a second backend runtime constructor lands (tracked in grimoire `lore/fuz_app/TODO.md` §Future Directions, _Symmetric backend signature shape_).
|
|
221
222
|
- `generate_backend_action_handlers_map(imports, options?)` — emits the `BackendActionHandlers` mapped type (`{[K in BackendRequestResponseMethod]: (input: ActionInputs[K], ctx: BackendHandlerContext) => ActionOutputs[K] | Promise<ActionOutputs[K]>}`). Replaces the hand-maintained `Exclude<>` + parallel mapped-type pattern (zzz had this at `zzz/src/lib/server/zzz_action_handlers.ts:42-66`). Configurable type name, method enum name, and context type name; configurable `collections_path` / `metatypes_path` for the type imports.
|
|
222
223
|
|
|
223
224
|
### Wrapper + multi-source helper
|
|
@@ -225,6 +226,24 @@ and `FrontendActionHandlers`.
|
|
|
225
226
|
- `compose_gen_file({origin_path, imports, blocks})` — encapsulates the per-`*.gen.ts` boilerplate (banner + `imports.build()` + blocks join + template literal). Returns the full file body. Each consumer producer collapses to one `compose_gen_file` call wrapping the helper invocations.
|
|
226
227
|
- `create_namespace_qualifier(sources, imports)` — multi-source consumer helper. Takes `ReadonlyArray<{ns, module, specs}>`, registers `import * as ns from module` for each on `imports`, builds the `method_to_ns` lookup with duplicate-method detection, returns `{qualify_spec, all_specs}` ready to thread through the high-level helpers. Closes the per-file boilerplate gap that kept zap + visiones on hand-rolled template strings even after the `qualify_spec?` callback landed (the per-call callback wasn't enough — the import dance + dup-check was the real boilerplate).
|
|
227
228
|
|
|
229
|
+
## Registry compile (`compile_action_registry.ts`)
|
|
230
|
+
|
|
231
|
+
Shared registration loop called by both `create_rpc_endpoint` and
|
|
232
|
+
`register_action_ws`. Validates four invariants and returns the
|
|
233
|
+
`Map<method, RpcAction>` the dispatchers use:
|
|
234
|
+
|
|
235
|
+
1. Auth-shape biconditional (`assert_route_auth_acting_biconditional` —
|
|
236
|
+
`auth.actor !== 'none' ⟺ input declares acting?: ActingActor`).
|
|
237
|
+
2. Rate-limit / account axis — `rate_limit: 'account' | 'both'` requires
|
|
238
|
+
`auth.account === 'required'`.
|
|
239
|
+
3. JSON-RPC §4.2 wire validity — `request_response` specs with a handler
|
|
240
|
+
may not use `z.null()` for input (use `z.void()` for nullary).
|
|
241
|
+
4. Unique `method` across the array.
|
|
242
|
+
|
|
243
|
+
Only `request_response` specs with a handler reach the dispatch map;
|
|
244
|
+
`remote_notification` / handler-less specs (e.g. WS `cancel`) stay
|
|
245
|
+
registry-only.
|
|
246
|
+
|
|
228
247
|
## HTTP bridge (`action_bridge.ts`)
|
|
229
248
|
|
|
230
249
|
Derives transport-specific specs from action specs. HTTP-specific concerns
|
|
@@ -256,7 +275,7 @@ surface is published in `library.json` codegen anyway.
|
|
|
256
275
|
Shim responsibilities:
|
|
257
276
|
|
|
258
277
|
1. **Parse envelope** — POST body as `JsonrpcRequest` (parse errors → JSON-RPC `parse_error` 400). GET reads `method`, `id`, `params` from query string; missing `method`/`id` → 400 `invalid_request`. Integer `id` normalization: `?id=42` matches `{id: 42}`.
|
|
259
|
-
2. **Lookup method** — `Map<method, RpcAction
|
|
278
|
+
2. **Lookup method** — `Map<method, RpcAction>` built via `compile_action_registry` (which runs the registry-time invariants — see §Registry compile above). Unknown method → `method_not_found`.
|
|
260
279
|
3. **GET read restriction** — GET is rejected for `side_effects: true` actions (`invalid_request` with "must use POST"). HTTP-only.
|
|
261
280
|
4. **Build PerformActionInput** — read `account_id` / `credential_type` from `c.var`, resolve `client_ip` via `get_client_ip`, pass `c.req.raw.signal` as `signal`, build a DEV-warn-and-drop `notify`. Test-preset escape hatch reads `TEST_CONTEXT_PRESET_KEY` + `REQUEST_CONTEXT_KEY` and forwards as `preset.request_context`.
|
|
262
281
|
5. **Call `perform_action`** — runs steps 1–6 of the shared pipeline (see §Shared dispatch core below).
|
|
@@ -301,6 +320,7 @@ interface ActionContext {
|
|
|
301
320
|
pending_effects: Array<Promise<void>>; // eager pool writes already in flight — see http/CLAUDE.md §Pending Effects
|
|
302
321
|
post_commit_effects: Array<() => void | Promise<void>>; // deferred — push via `emit_after_commit`
|
|
303
322
|
client_ip: string;
|
|
323
|
+
credential_type: CredentialType | null; // session | api_token | daemon_token (or null for anonymous) — same value the credential_types gate consumed
|
|
304
324
|
log: Logger;
|
|
305
325
|
notify: (method, params) => void; // HTTP: DEV-mode warn + drop (no streaming channel); WS: socket-scoped
|
|
306
326
|
signal: AbortSignal; // HTTP: client-disconnect; WS: AbortSignal.any([socket_close, request_cancel])
|
|
@@ -358,19 +378,8 @@ narrowing — ideal when handlers are stateless free functions. fuz_app's
|
|
|
358
378
|
handlers close over factory-captured deps (`log`, `audit`,
|
|
359
379
|
`options.app_settings`, `options.max_tokens`), so per-pair typing via
|
|
360
380
|
`rpc_action()` is the right shape here: the binding happens at
|
|
361
|
-
construction time and the handler keeps its closure.
|
|
362
|
-
|
|
363
|
-
`role_grant_offer_actions.ts`, `self_service_role_actions.ts` (every
|
|
364
|
-
spec there is actor-implying), and `account_actions.ts` (account-grain).
|
|
365
|
-
The conditional auto-selects the right tier per spec; consumers don't
|
|
366
|
-
pick a binder.
|
|
367
|
-
|
|
368
|
-
The earlier two-binder split (`rpc_action` + `rpc_actor_action`) was
|
|
369
|
-
collapsed once the symmetric account-grain narrowing landed. Same
|
|
370
|
-
runtime; the second symbol no longer added information the spec
|
|
371
|
-
literal didn't already carry. Uniform binding keeps a future handler
|
|
372
|
-
that gains `ctx.auth.actor` reads from accidentally landing on a
|
|
373
|
-
looser narrow — the spec literal drives the type either way.
|
|
381
|
+
construction time and the handler keeps its closure. The conditional
|
|
382
|
+
auto-selects the right tier per spec; consumers don't pick a binder.
|
|
374
383
|
|
|
375
384
|
## Transports (`transports.ts`, `transports_http.ts`, `transports_ws.ts`, `transports_ws_backend.ts`)
|
|
376
385
|
|
|
@@ -451,7 +460,7 @@ Fan-out:
|
|
|
451
460
|
|
|
452
461
|
- `send(notification)` — broadcasts to every connection (current `send(request)` returns an internal_error "not yet implemented" — backend cannot initiate request-response).
|
|
453
462
|
- `broadcast_filtered(message, predicate)` — per-connection predicate over `ConnectionIdentity`; skips non-matching. Returns count.
|
|
454
|
-
- `send_to_account(account_id, message)` — targeted wrapper over `broadcast_filtered`. Mirrors `close_sockets_for_account` on the send side (every connection for the account). Structurally satisfies the `NotificationSender` interface from `auth/role_grant_offer_notifications.ts` (see
|
|
463
|
+
- `send_to_account(account_id, message)` — targeted wrapper over `broadcast_filtered`. Mirrors `close_sockets_for_account` on the send side (every connection for the account). Structurally satisfies the `NotificationSender` interface from `auth/role_grant_offer_notifications.ts` (see `auth/CLAUDE.md` §WS notifications).
|
|
455
464
|
- `get_connection_count()` — telemetry counter over the connection map.
|
|
456
465
|
|
|
457
466
|
Return values are bookkeeping, not delivery receipts — `0` means no live
|
|
@@ -520,7 +529,7 @@ and optional `required_role: RoleName`. Returns `{transport}`. Note:
|
|
|
520
529
|
`required_role` is a **coarse upgrade-time gate** — per-action `auth` in
|
|
521
530
|
each spec still applies at dispatch time via `perform_action`.
|
|
522
531
|
(`verify_request_source` and `require_auth` / `require_role` are from
|
|
523
|
-
|
|
532
|
+
`auth/`; see `auth/CLAUDE.md` §Middleware for their semantics.)
|
|
524
533
|
|
|
525
534
|
### `register_action_ws` (`register_action_ws.ts`) — lower-level
|
|
526
535
|
|
|
@@ -529,11 +538,11 @@ dispatcher without the origin/auth front-stack.
|
|
|
529
538
|
|
|
530
539
|
Actions are passed as `ReadonlyArray<Action>` — the composable
|
|
531
540
|
`{spec, handler?}` tuple shared with `create_rpc_client`. The dispatcher
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
541
|
+
builds its `action_map: Map<string, RpcAction>` via `compile_action_registry`
|
|
542
|
+
(see §Registry compile above) — only `request_response` specs with a
|
|
543
|
+
handler land in the map. Specs without a handler (client-only /
|
|
544
|
+
dispatcher-handled like `cancel`) surface as `method_not_found` if the
|
|
545
|
+
wire targets them.
|
|
537
546
|
|
|
538
547
|
Required deps: `db: Db` (pool-level, used by `perform_action` for both the
|
|
539
548
|
per-message authorization phase and the transactional dispatch wrap when
|
|
@@ -577,7 +586,7 @@ Per-message side-effect queues: `pending_effects: Array<Promise<void>>`
|
|
|
577
586
|
`flush_post_commit_effects`. Both flush in the same `try/finally` that
|
|
578
587
|
releases the request controller, so fire-and-forget audit / notification
|
|
579
588
|
effects pushed by the handler complete (or reject visibly) before the
|
|
580
|
-
next message dispatches. See
|
|
589
|
+
next message dispatches. See `http/CLAUDE.md` §Pending Effects.
|
|
581
590
|
|
|
582
591
|
Lifecycle hooks on `RegisterActionWsOptions`:
|
|
583
592
|
|
|
@@ -943,9 +952,9 @@ wiring (zzz-style reactive Cells observing `ActionEvent` lifecycle)
|
|
|
943
952
|
don't have to drop down to manual `create_rpc_client` construction
|
|
944
953
|
(which forfeits the bundled `api` / `api_result` pair).
|
|
945
954
|
|
|
946
|
-
`all_standard_action_specs` (in
|
|
955
|
+
`all_standard_action_specs` (in `auth/standard_action_specs.ts`) is
|
|
947
956
|
the matching aggregate spec list mirroring `create_standard_rpc_actions`
|
|
948
|
-
on the backend — see
|
|
957
|
+
on the backend — see `auth/CLAUDE.md` §`standard_rpc_actions.ts`.
|
|
949
958
|
|
|
950
959
|
## Broadcast API (`broadcast_api.ts`)
|
|
951
960
|
|
|
@@ -988,9 +997,8 @@ transport; `ActionHandler` is the single handler signature.
|
|
|
988
997
|
|
|
989
998
|
`RpcAction = Action<RequestResponseActionSpec> & {handler: ActionHandler}`
|
|
990
999
|
is the narrowing the HTTP RPC dispatcher accepts (`create_rpc_endpoint`)
|
|
991
|
-
and the `rpc_action` binder produces (the actor-axis narrowing
|
|
992
|
-
in `HandlerForSpec<TSpec>`
|
|
993
|
-
`rpc_actor_action`).
|
|
1000
|
+
and the `rpc_action` binder produces (the actor-axis narrowing lives
|
|
1001
|
+
in `HandlerForSpec<TSpec>`).
|
|
994
1002
|
|
|
995
1003
|
## Shared dispatch core (`perform_action.ts`)
|
|
996
1004
|
|
|
@@ -17,6 +17,7 @@ import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
|
17
17
|
import type { RequestResponseActionSpec } from './action_spec.js';
|
|
18
18
|
import { type RouteSpec } from '../http/route_spec.js';
|
|
19
19
|
import { type RequestActorContext, type RequestContext } from '../auth/request_context.js';
|
|
20
|
+
import { type CredentialType } from '../hono_context.js';
|
|
20
21
|
import type { Db } from '../db/db.js';
|
|
21
22
|
import { type JsonrpcRequestId } from '../http/jsonrpc.js';
|
|
22
23
|
import type { RateLimiter } from '../rate_limiter.js';
|
|
@@ -72,6 +73,15 @@ export interface ActionContext {
|
|
|
72
73
|
* `role_grant_offer_expire` cleanup sweep in `auth/cleanup.ts`).
|
|
73
74
|
*/
|
|
74
75
|
client_ip: string;
|
|
76
|
+
/**
|
|
77
|
+
* Credential channel the request arrived on (`'session'` | `'api_token'` |
|
|
78
|
+
* `'daemon_token'`), or `null` for anonymous requests. Same value the
|
|
79
|
+
* dispatcher's `credential_types` gate consumed at step 4 — exposed here
|
|
80
|
+
* so handlers can record it in audit metadata (defense in depth: the
|
|
81
|
+
* gate may be loosened or bypassed in a future refactor, but the audit
|
|
82
|
+
* row preserves what actually authenticated the request).
|
|
83
|
+
*/
|
|
84
|
+
credential_type: CredentialType | null;
|
|
75
85
|
/** Logger instance. */
|
|
76
86
|
log: Logger;
|
|
77
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib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 'esm-env';
|
|
|
16
16
|
import {} from '../http/route_spec.js';
|
|
17
17
|
import { get_client_ip } from '../http/proxy.js';
|
|
18
18
|
import { get_request_context, } from '../auth/request_context.js';
|
|
19
|
-
import { ACCOUNT_ID_KEY, CREDENTIAL_TYPE_KEY, TEST_CONTEXT_PRESET_KEY } from '../hono_context.js';
|
|
19
|
+
import { ACCOUNT_ID_KEY, CREDENTIAL_TYPE_KEY, TEST_CONTEXT_PRESET_KEY, } from '../hono_context.js';
|
|
20
20
|
import { compile_action_registry } from './compile_action_registry.js';
|
|
21
21
|
import { JSONRPC_VERSION, JsonrpcRequest, } from '../http/jsonrpc.js';
|
|
22
22
|
import { jsonrpc_error_messages, jsonrpc_error_code_to_http_status, JSONRPC_ERROR_CODES, } from '../http/jsonrpc_errors.js';
|
|
@@ -42,7 +42,7 @@ export declare const ActionSpec: z.ZodObject<{
|
|
|
42
42
|
* `null` for `remote_notification` and `local_call` — those don't
|
|
43
43
|
* dispatch through the request/response auth gate.
|
|
44
44
|
*
|
|
45
|
-
* See
|
|
45
|
+
* See `http/auth_shape.ts` for the design rationale (orthogonal
|
|
46
46
|
* authentication / account-resolution / actor-resolution / role-and-
|
|
47
47
|
* credential authorization axes).
|
|
48
48
|
*/
|
|
@@ -25,7 +25,7 @@ export const ActionSpec = z.strictObject({
|
|
|
25
25
|
* `null` for `remote_notification` and `local_call` — those don't
|
|
26
26
|
* dispatch through the request/response auth gate.
|
|
27
27
|
*
|
|
28
|
-
* See
|
|
28
|
+
* See `http/auth_shape.ts` for the design rationale (orthogonal
|
|
29
29
|
* authentication / account-resolution / actor-resolution / role-and-
|
|
30
30
|
* credential authorization axes).
|
|
31
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,KA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AI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAC1B,OAAO,kBAAkB,EACzB,MAAM,iBAAiB,KACrB,OAAO,CAAC,mBAAmB,CAwJ7B,CAAC;AA4EF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAC7C,IAAI,gBAAgB,EACpB,QAAQ,mBAAmB,KACzB;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,gBAAgB,CAAA;CAAC,GAAG,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,GAAG;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAC,CAK5F,CAAC"}
|
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
> Auth domain: identity, crypto primitives, schema + DDL, queries, middleware, routes, RPC actions, cleanup.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Grouped below by theme. For design rationale and threat model, see
|
|
6
|
+
../../../docs/identity.md and ../../../docs/security.md. For the
|
|
7
7
|
subsystem's place in server assembly and middleware ordering, see
|
|
8
|
-
|
|
8
|
+
../../../docs/architecture.md and the root ../../../CLAUDE.md. For
|
|
9
|
+
the workspace-wide DI vocabulary (capabilities / options / runtime
|
|
10
|
+
state), see Skill(fuz-stack) dependency-injection.
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
`
|
|
12
|
-
(
|
|
13
|
-
inline, never in `deps`. All `query_*` functions take
|
|
14
|
-
as their first arg.
|
|
12
|
+
Auth-specific instances: stateless capabilities in `AppDeps` /
|
|
13
|
+
`RouteFactoryDeps`; static config in `*Options`; runtime state
|
|
14
|
+
(`DaemonTokenState`, mutable `AppSettings` ref, `BootstrapStatus`) is
|
|
15
|
+
inline, never in `deps`. All `query_*` functions take
|
|
16
|
+
`deps: QueryDeps = {db}` as their first arg.
|
|
15
17
|
|
|
16
18
|
## Crypto primitives
|
|
17
19
|
|
|
@@ -789,7 +791,7 @@ Per-call `ctx` shape:
|
|
|
789
791
|
- `emit` requires `{pending_effects: Array<Promise<void>>}` — the eager
|
|
790
792
|
queue only. Both `RouteContext` and `ActionContext` satisfy this
|
|
791
793
|
structurally; `audit.emit` pushes its in-flight pool-write promise
|
|
792
|
-
onto the eager queue. See
|
|
794
|
+
onto the eager queue. See `http/CLAUDE.md` §Pending Effects for
|
|
793
795
|
the eager / deferred split.
|
|
794
796
|
- `emit_role_grant_target` adds `client_ip: string` (also on `ActionContext`;
|
|
795
797
|
REST handlers pass `{pending_effects, client_ip: get_client_ip(c)}`).
|
|
@@ -919,7 +921,7 @@ consciously violate the contract.
|
|
|
919
921
|
|
|
920
922
|
## Middleware
|
|
921
923
|
|
|
922
|
-
See the root
|
|
924
|
+
See the root ../../../CLAUDE.md §Middleware Ordering for the canonical
|
|
923
925
|
assembly order. Two-phase identity:
|
|
924
926
|
|
|
925
927
|
- **Authentication** runs in middleware (session / bearer / daemon
|
|
@@ -974,7 +976,7 @@ assembly order. Two-phase identity:
|
|
|
974
976
|
actor row was deleted between credential validation and the
|
|
975
977
|
follow-up read). The named per-error shape `AuthorizationFailureBody`
|
|
976
978
|
is still exported for callers that want to bind the failure body
|
|
977
|
-
by type. See the root
|
|
979
|
+
by type. See the root ../../../CLAUDE.md §Cleanest architecture
|
|
978
980
|
takes priority for the rationale.
|
|
979
981
|
|
|
980
982
|
Session parsing is separate from auth enforcement — login / bootstrap
|
|
@@ -1141,6 +1143,8 @@ Session-based auth route specs. Factory: `create_account_route_specs(deps, optio
|
|
|
1141
1143
|
- `POST /logout` — revokes session by hash, clears cookie.
|
|
1142
1144
|
- **`POST /password`** — `current_password: PasswordProvided` +
|
|
1143
1145
|
`new_password: Password`. Per-IP + per-account rate limited.
|
|
1146
|
+
Declares `credential_types: ['session']` (see
|
|
1147
|
+
`docs/security.md` §Credential-channel gating).
|
|
1144
1148
|
**Revokes all sessions + all API tokens** (force re-auth everywhere);
|
|
1145
1149
|
clears cookie.
|
|
1146
1150
|
- **`GET /verify`** — empty-body session-validity probe for nginx
|
|
@@ -1212,7 +1216,7 @@ gets `require_auth` when `account === 'required'` or `actor === 'required'`;
|
|
|
1212
1216
|
`post_authorization` gets `require_credential_types(types)` when
|
|
1213
1217
|
`credential_types?.length` and `require_role(roles)` when `roles?.length`.
|
|
1214
1218
|
Injected into `apply_route_specs` so the generic HTTP framework stays
|
|
1215
|
-
auth-agnostic (see
|
|
1219
|
+
auth-agnostic (see `http/CLAUDE.md` §Validation pipeline for where it plugs in).
|
|
1216
1220
|
|
|
1217
1221
|
### `audit_log_routes.ts`
|
|
1218
1222
|
|
|
@@ -1232,7 +1236,7 @@ module produces is now just the optional SSE stream:
|
|
|
1232
1236
|
## RPC actions (SAES)
|
|
1233
1237
|
|
|
1234
1238
|
Three action surfaces that mount on a consumer's JSON-RPC endpoint via
|
|
1235
|
-
`create_rpc_endpoint` (see
|
|
1239
|
+
`create_rpc_endpoint` (see `actions/CLAUDE.md` §Single JSON-RPC 2.0 endpoint).
|
|
1236
1240
|
Each surface is split across two files:
|
|
1237
1241
|
|
|
1238
1242
|
- `*_action_specs.ts` — Input/Output Zod schemas (paired with `z.infer` type
|
|
@@ -1413,16 +1417,16 @@ Error reason constants (exported as `as const` literals):
|
|
|
1413
1417
|
- `ERROR_ROLE_GRANT_OFFER_ACTOR_MISMATCH` (`'role_grant_offer_actor_mismatch'` —
|
|
1414
1418
|
actor-targeted offer was accepted by an actor other than `to_actor_id`)
|
|
1415
1419
|
|
|
1416
|
-
Plus re-uses from
|
|
1420
|
+
Plus re-uses from `http/error_schemas.ts`: `ERROR_ROLE_GRANT_NOT_FOUND`,
|
|
1417
1421
|
`ERROR_ROLE_NOT_WEB_GRANTABLE`, `ERROR_INSUFFICIENT_PERMISSIONS`,
|
|
1418
1422
|
`ERROR_ACCOUNT_NOT_FOUND`.
|
|
1419
1423
|
|
|
1420
1424
|
Each spec declares the reason codes its handler may surface (see
|
|
1421
|
-
|
|
1425
|
+
`actions/CLAUDE.md` §Action specs for the field semantics). Only
|
|
1422
1426
|
domain reasons returned via `error.data.reason` are listed; standard
|
|
1423
1427
|
transport errors (validation, auth, rate-limit) stay implicit. Drift
|
|
1424
1428
|
between declared reasons and handler throws is caught by
|
|
1425
|
-
|
|
1429
|
+
../../test/auth/role_grant_offer_actions.error_reasons.test.ts.
|
|
1426
1430
|
|
|
1427
1431
|
Failure-outcome audit events emitted (success and failure rows both carry
|
|
1428
1432
|
`ip: ctx.client_ip` — uniform with the admin and self-service surfaces):
|
|
@@ -1442,8 +1446,8 @@ Failure-outcome audit events emitted (success and failure rows both carry
|
|
|
1442
1446
|
role_grant).
|
|
1443
1447
|
|
|
1444
1448
|
WS notifications (post-commit via `emit_after_commit` from
|
|
1445
|
-
|
|
1446
|
-
can't starve others; see
|
|
1449
|
+
`http/pending_effects.js` — swallows exceptions so one failed send
|
|
1450
|
+
can't starve others; see `http/CLAUDE.md` §Pending Effects):
|
|
1447
1451
|
|
|
1448
1452
|
- Create → `role_grant_offer_received` to recipient.
|
|
1449
1453
|
- Retract → `role_grant_offer_retracted` to recipient.
|
|
@@ -1506,7 +1510,7 @@ Pair this with `create_app_server`'s `rpc_endpoints` factory form
|
|
|
1506
1510
|
(`(ctx) => Array<RpcEndpointSpec>`) so the combined action list gets
|
|
1507
1511
|
`ctx.deps` + `ctx.app_settings` — `create_app_server` auto-mounts the
|
|
1508
1512
|
endpoint via `create_rpc_endpoint`, so consumers don't need to mount it
|
|
1509
|
-
again in `create_route_specs`. See
|
|
1513
|
+
again in `create_route_specs`. See ../../../docs/usage.md §Server
|
|
1510
1514
|
Assembly.
|
|
1511
1515
|
|
|
1512
1516
|
Pre-bundle consumers spread `create_admin_actions` and
|
|
@@ -1519,7 +1523,7 @@ consumer wiring the admin surface without account actions will hit
|
|
|
1519
1523
|
`method not found` on first admin-suite run.
|
|
1520
1524
|
|
|
1521
1525
|
Frontend mirror: `all_standard_action_specs` (in
|
|
1522
|
-
|
|
1526
|
+
`auth/standard_action_specs.ts`) bundles `all_admin_action_specs +
|
|
1523
1527
|
all_role_grant_offer_action_specs + all_account_action_specs` into one
|
|
1524
1528
|
`ReadonlyArray<RequestResponseActionSpec>` for typed-client codegen
|
|
1525
1529
|
and `create_frontend_rpc_client({specs})` wiring. Self-service role
|
|
@@ -1530,9 +1534,9 @@ spread `all_self_service_role_action_specs` separately when needed.
|
|
|
1530
1534
|
|
|
1531
1535
|
`all_fuz_auth_action_spec_registries` — walker/codegen entry for every
|
|
1532
1536
|
fuz-auth action-spec bundle (`admin`, `role_grant_offer`, `account`,
|
|
1533
|
-
`self_service_role`, `actor_lookup`). Not a mounting
|
|
1534
|
-
specs are excluded. Iterated by
|
|
1535
|
-
|
|
1537
|
+
`self_service_role`, `actor_lookup`, `actor_search`). Not a mounting
|
|
1538
|
+
surface; protocol specs are excluded. Iterated by registry-wide
|
|
1539
|
+
invariant tests in ../../test/auth/.
|
|
1536
1540
|
|
|
1537
1541
|
### `account_action_specs.ts` + `account_actions.ts` — seven self-service RPC actions
|
|
1538
1542
|
|
|
@@ -1553,6 +1557,18 @@ operations are account-scoped via `query_session_revoke_for_account` /
|
|
|
1553
1557
|
or token id returns `revoked: false` rather than revealing whether the id
|
|
1554
1558
|
exists.
|
|
1555
1559
|
|
|
1560
|
+
**Credential-channel gating** — `account_token_create`,
|
|
1561
|
+
`account_token_revoke`, `account_session_revoke`, and
|
|
1562
|
+
`account_session_revoke_all` declare `credential_types: ['session']`
|
|
1563
|
+
on their `auth` axis (same gate as REST `POST /password`).
|
|
1564
|
+
`account_session_revoke` is gated alongside `_revoke_all` because a
|
|
1565
|
+
leaked bearer can otherwise compose `account_session_list` + N×revoke
|
|
1566
|
+
to reach the same lockout. Admin token/session revoke specs in
|
|
1567
|
+
`admin_action_specs.ts` deliberately stay unrestricted (admin
|
|
1568
|
+
scripting from CLI/bearer is legitimate operator workflow). For the
|
|
1569
|
+
threat model, the trust-bar rationale, and the defense-in-depth audit
|
|
1570
|
+
metadata see `docs/security.md` §Credential-channel gating.
|
|
1571
|
+
|
|
1556
1572
|
| Spec | Side effects | Rate limit | Input | Output |
|
|
1557
1573
|
| ---------------------------------------- | ------------ | ----------- | -------------- | ----------------------- |
|
|
1558
1574
|
| `account_verify_action_spec` | false | | `z.void()` | `SessionAccountJson` |
|
|
@@ -1577,7 +1593,12 @@ vector, so rate caps are symmetry-only and skipped.
|
|
|
1577
1593
|
Audit events emitted (via `deps.audit.emit` with `ip: ctx.client_ip`):
|
|
1578
1594
|
`session_revoke`, `session_revoke_all`, `token_create`, `token_revoke`. The
|
|
1579
1595
|
IP is the resolved trusted-proxy value from `ActionContext.client_ip`,
|
|
1580
|
-
matching the REST handler convention.
|
|
1596
|
+
matching the REST handler convention. Every gated event additionally
|
|
1597
|
+
records `credential_type` (read from `ActionContext.credential_type`)
|
|
1598
|
+
in metadata — defense in depth so forensics survive if the
|
|
1599
|
+
`credential_types: ['session']` spec gate is ever loosened or bypassed.
|
|
1600
|
+
The REST `password_change` audit row mirrors the same field on all
|
|
1601
|
+
three outcomes (success, wrong-password, concurrent-change).
|
|
1581
1602
|
|
|
1582
1603
|
Deps: `Pick<RouteFactoryDeps, 'log' | 'audit'>`.
|
|
1583
1604
|
Options: `{max_tokens?: number | null}` — defaults to `DEFAULT_MAX_TOKENS`
|
|
@@ -1698,7 +1719,7 @@ One static `request_response` action — `actor_search({query, scope_ids?, limit
|
|
|
1698
1719
|
powers person-target pickers. Sibling to `actor_lookup`: that resolves a
|
|
1699
1720
|
batch of known ids to labels; this resolves a partial name to candidate
|
|
1700
1721
|
actors. Reuses `ActorLookupEntryJson` from
|
|
1701
|
-
|
|
1722
|
+
`auth/actor_lookup_action_specs.ts` so the labels arc on the consumer side
|
|
1702
1723
|
stays uniform. Default limit `ACTOR_SEARCH_LIMIT_DEFAULT = 20`, hard cap
|
|
1703
1724
|
`ACTOR_SEARCH_LIMIT_MAX = 50`. Query string capped at
|
|
1704
1725
|
`ACTOR_SEARCH_QUERY_LENGTH_MAX = 50`.
|
|
@@ -1805,5 +1826,5 @@ resulting role_grant.
|
|
|
1805
1826
|
Action factories take `Pick<RouteFactoryDeps, 'log' | 'audit'>` directly
|
|
1806
1827
|
(role-grant-offer adds `notification_sender?` inline).
|
|
1807
1828
|
|
|
1808
|
-
See root
|
|
1829
|
+
See root ../../../CLAUDE.md §AppDeps Vocabulary for the
|
|
1809
1830
|
capability / options / runtime-state split across the whole project.
|
|
@@ -135,6 +135,7 @@ export declare const account_session_revoke_action_spec: {
|
|
|
135
135
|
auth: {
|
|
136
136
|
account: "required";
|
|
137
137
|
actor: "none";
|
|
138
|
+
credential_types: string[];
|
|
138
139
|
};
|
|
139
140
|
side_effects: true;
|
|
140
141
|
input: z.ZodObject<{
|
|
@@ -154,6 +155,7 @@ export declare const account_session_revoke_all_action_spec: {
|
|
|
154
155
|
auth: {
|
|
155
156
|
account: "required";
|
|
156
157
|
actor: "none";
|
|
158
|
+
credential_types: string[];
|
|
157
159
|
};
|
|
158
160
|
side_effects: true;
|
|
159
161
|
input: z.ZodVoid;
|
|
@@ -165,6 +167,8 @@ export declare const account_session_revoke_all_action_spec: {
|
|
|
165
167
|
description: string;
|
|
166
168
|
};
|
|
167
169
|
/**
|
|
170
|
+
* `credential_types: ['session']` — see `docs/security.md` §Credential-channel gating.
|
|
171
|
+
*
|
|
168
172
|
* `rate_limit: 'account'` bounds the burn rate of API-token creates. The
|
|
169
173
|
* outstanding-token count is already capped by `max_tokens` (via
|
|
170
174
|
* `query_api_token_enforce_limit`), but the per-account *rate* of churn
|
|
@@ -179,6 +183,7 @@ export declare const account_token_create_action_spec: {
|
|
|
179
183
|
auth: {
|
|
180
184
|
account: "required";
|
|
181
185
|
actor: "none";
|
|
186
|
+
credential_types: string[];
|
|
182
187
|
};
|
|
183
188
|
side_effects: true;
|
|
184
189
|
input: z.ZodPrefault<z.ZodObject<{
|
|
@@ -225,6 +230,7 @@ export declare const account_token_revoke_action_spec: {
|
|
|
225
230
|
auth: {
|
|
226
231
|
account: "required";
|
|
227
232
|
actor: "none";
|
|
233
|
+
credential_types: string[];
|
|
228
234
|
};
|
|
229
235
|
side_effects: true;
|
|
230
236
|
input: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAMzE,6EAA6E;AAC7E,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,yCAAyC;AACzC,eAAO,MAAM,iBAAiB;;;;;;;;kBAE5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB;;kBAE7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,iFAAiF;AACjF,eAAO,MAAM,mBAAmB;;;kBAG9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KA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AC,yBAAyB,CAQrE,CAAC"}
|
|
@@ -90,22 +90,26 @@ export const account_session_list_action_spec = {
|
|
|
90
90
|
async: true,
|
|
91
91
|
description: 'List auth sessions for the current account.',
|
|
92
92
|
};
|
|
93
|
+
// `credential_types: ['session']` — see `docs/security.md` §Credential-channel gating.
|
|
94
|
+
// A leaked bearer can otherwise compose `account_session_list` + N×revoke to
|
|
95
|
+
// reach the same effect as `account_session_revoke_all`.
|
|
93
96
|
export const account_session_revoke_action_spec = {
|
|
94
97
|
method: 'account_session_revoke',
|
|
95
98
|
kind: 'request_response',
|
|
96
99
|
initiator: 'frontend',
|
|
97
|
-
auth: { account: 'required', actor: 'none' },
|
|
100
|
+
auth: { account: 'required', actor: 'none', credential_types: ['session'] },
|
|
98
101
|
side_effects: true,
|
|
99
102
|
input: SessionRevokeInput,
|
|
100
103
|
output: SessionRevokeOutput,
|
|
101
104
|
async: true,
|
|
102
105
|
description: 'Revoke a single auth session for the current account (IDOR-guarded).',
|
|
103
106
|
};
|
|
107
|
+
// `credential_types: ['session']` — see `docs/security.md` §Credential-channel gating.
|
|
104
108
|
export const account_session_revoke_all_action_spec = {
|
|
105
109
|
method: 'account_session_revoke_all',
|
|
106
110
|
kind: 'request_response',
|
|
107
111
|
initiator: 'frontend',
|
|
108
|
-
auth: { account: 'required', actor: 'none' },
|
|
112
|
+
auth: { account: 'required', actor: 'none', credential_types: ['session'] },
|
|
109
113
|
side_effects: true,
|
|
110
114
|
input: SessionRevokeAllInput,
|
|
111
115
|
output: SessionRevokeAllOutput,
|
|
@@ -113,6 +117,8 @@ export const account_session_revoke_all_action_spec = {
|
|
|
113
117
|
description: 'Revoke every auth session for the current account.',
|
|
114
118
|
};
|
|
115
119
|
/**
|
|
120
|
+
* `credential_types: ['session']` — see `docs/security.md` §Credential-channel gating.
|
|
121
|
+
*
|
|
116
122
|
* `rate_limit: 'account'` bounds the burn rate of API-token creates. The
|
|
117
123
|
* outstanding-token count is already capped by `max_tokens` (via
|
|
118
124
|
* `query_api_token_enforce_limit`), but the per-account *rate* of churn
|
|
@@ -124,7 +130,7 @@ export const account_token_create_action_spec = {
|
|
|
124
130
|
method: 'account_token_create',
|
|
125
131
|
kind: 'request_response',
|
|
126
132
|
initiator: 'frontend',
|
|
127
|
-
auth: { account: 'required', actor: 'none' },
|
|
133
|
+
auth: { account: 'required', actor: 'none', credential_types: ['session'] },
|
|
128
134
|
side_effects: true,
|
|
129
135
|
input: TokenCreateInput,
|
|
130
136
|
output: TokenCreateOutput,
|
|
@@ -143,11 +149,12 @@ export const account_token_list_action_spec = {
|
|
|
143
149
|
async: true,
|
|
144
150
|
description: 'List API tokens for the current account. Hashes are never returned.',
|
|
145
151
|
};
|
|
152
|
+
// `credential_types: ['session']` — see `docs/security.md` §Credential-channel gating.
|
|
146
153
|
export const account_token_revoke_action_spec = {
|
|
147
154
|
method: 'account_token_revoke',
|
|
148
155
|
kind: 'request_response',
|
|
149
156
|
initiator: 'frontend',
|
|
150
|
-
auth: { account: 'required', actor: 'none' },
|
|
157
|
+
auth: { account: 'required', actor: 'none', credential_types: ['session'] },
|
|
151
158
|
side_effects: true,
|
|
152
159
|
input: TokenRevokeInput,
|
|
153
160
|
output: TokenRevokeOutput,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAqC,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAe5F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAwBhD,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,OAAO,CAAC,EAC7C,UAAS,oBAAyB,KAChC,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"account_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAqC,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAe5F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAwBhD,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,OAAO,CAAC,EAC7C,UAAS,oBAAyB,KAChC,KAAK,CAAC,SAAS,CA2GjB,CAAC"}
|
|
@@ -54,7 +54,8 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
54
54
|
outcome: revoked ? 'success' : 'failure',
|
|
55
55
|
account_id: ctx.auth.account.id,
|
|
56
56
|
ip: ctx.client_ip,
|
|
57
|
-
|
|
57
|
+
// `credential_type` defense in depth — see `docs/security.md` §Credential-channel gating.
|
|
58
|
+
metadata: { session_id: input.session_id, credential_type: ctx.credential_type ?? undefined },
|
|
58
59
|
});
|
|
59
60
|
return { ok: true, revoked };
|
|
60
61
|
};
|
|
@@ -64,7 +65,7 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
64
65
|
event_type: 'session_revoke_all',
|
|
65
66
|
account_id: ctx.auth.account.id,
|
|
66
67
|
ip: ctx.client_ip,
|
|
67
|
-
metadata: { count },
|
|
68
|
+
metadata: { count, credential_type: ctx.credential_type ?? undefined },
|
|
68
69
|
});
|
|
69
70
|
return { ok: true, count };
|
|
70
71
|
};
|
|
@@ -78,7 +79,11 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
78
79
|
event_type: 'token_create',
|
|
79
80
|
account_id: ctx.auth.account.id,
|
|
80
81
|
ip: ctx.client_ip,
|
|
81
|
-
metadata: {
|
|
82
|
+
metadata: {
|
|
83
|
+
token_id: id,
|
|
84
|
+
name: input.name,
|
|
85
|
+
credential_type: ctx.credential_type ?? undefined,
|
|
86
|
+
},
|
|
82
87
|
});
|
|
83
88
|
return { ok: true, token, id, name: input.name };
|
|
84
89
|
};
|
|
@@ -93,7 +98,7 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
93
98
|
outcome: revoked ? 'success' : 'failure',
|
|
94
99
|
account_id: ctx.auth.account.id,
|
|
95
100
|
ip: ctx.client_ip,
|
|
96
|
-
metadata: { token_id: input.token_id },
|
|
101
|
+
metadata: { token_id: input.token_id, credential_type: ctx.credential_type ?? undefined },
|
|
97
102
|
});
|
|
98
103
|
return { ok: true, revoked };
|
|
99
104
|
};
|