@fuzdev/fuz_app 0.181.0 → 0.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/actions/CLAUDE.md +28 -10
- package/dist/actions/action_rpc.d.ts +11 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +3 -2
- package/dist/actions/action_types.d.ts +16 -1
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +1 -1
- package/dist/actions/notification_sender.d.ts +83 -0
- package/dist/actions/notification_sender.d.ts.map +1 -0
- package/dist/actions/notification_sender.js +85 -0
- package/dist/actions/perform_action.d.ts +9 -0
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +22 -13
- package/dist/actions/register_action_ws.d.ts +14 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +3 -2
- package/dist/actions/ws_socket_session.d.ts +3 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +2 -1
- package/dist/auth/CLAUDE.md +113 -70
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +13 -3
- package/dist/auth/account_queries.d.ts +158 -16
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +189 -18
- package/dist/auth/account_routes.d.ts +6 -4
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +98 -92
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +93 -45
- package/dist/auth/api_token_queries.d.ts +13 -5
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +24 -9
- package/dist/auth/audit_emitter.d.ts +75 -84
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +83 -71
- package/dist/auth/audit_log_schema.d.ts +10 -5
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +22 -6
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +3 -2
- package/dist/auth/bootstrap_account.d.ts +31 -13
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +34 -15
- package/dist/auth/bootstrap_routes.d.ts +1 -1
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +7 -14
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +12 -1
- package/dist/auth/deps.d.ts +18 -5
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/deps.js +3 -2
- package/dist/auth/request_context.d.ts +73 -73
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +78 -96
- package/dist/auth/resolved_auth.d.ts +16 -11
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +6 -6
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +2 -1
- package/dist/auth/role_grant_offer_actions.d.ts +32 -12
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +91 -116
- package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +75 -22
- package/dist/auth/role_grant_offer_queries.d.ts +155 -18
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +262 -73
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/role_grant_queries.d.ts +43 -52
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +50 -74
- package/dist/auth/role_grant_sql.d.ts +21 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -1
- package/dist/auth/role_grant_sql.js +21 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +17 -21
- package/dist/auth/session_queries.d.ts +40 -16
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +68 -29
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +90 -38
- package/dist/auth/standard_rpc_actions.d.ts +6 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +5 -6
- package/dist/auth/token_scope.d.ts +1 -1
- package/dist/auth/token_scope.js +1 -1
- package/dist/db/sql_columns.d.ts +1 -1
- package/dist/db/sql_columns.js +1 -1
- package/dist/http/CLAUDE.md +22 -16
- package/dist/http/auth_shape.d.ts +1 -1
- package/dist/http/db_routes.d.ts +7 -22
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +72 -72
- package/dist/http/error_schemas.d.ts +9 -21
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +14 -24
- package/dist/http/pending_effects.d.ts +42 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +34 -4
- package/dist/http/route_spec.d.ts +2 -2
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +3 -1
- package/dist/server/app_server.d.ts +69 -18
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +74 -10
- package/dist/server/serve_fact_route.d.ts +3 -3
- package/dist/server/serve_fact_route.js +12 -12
- package/dist/testing/CLAUDE.md +259 -790
- package/dist/testing/adversarial_404.d.ts +6 -1
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +38 -17
- package/dist/testing/app_server.d.ts +20 -140
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +48 -125
- package/dist/testing/audit_drift_guard.d.ts +11 -6
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +15 -8
- package/dist/testing/auth_apps.js +1 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +43 -0
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
- package/dist/testing/cross_backend/capabilities.d.ts +9 -6
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +11 -7
- package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
- package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
- package/dist/testing/cross_backend/capability_mounts.js +423 -0
- package/dist/testing/cross_backend/cell_moderate.js +2 -2
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +12 -11
- package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
- package/dist/testing/cross_backend/conformance_principal.js +283 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +2 -50
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +2 -270
- package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_deadline.js +2 -0
- package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
- package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
- package/dist/testing/cross_backend/db_state_diff.js +444 -0
- package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
- package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
- package/dist/testing/cross_backend/declared_skips.js +132 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -6
- package/dist/testing/cross_backend/differential.d.ts +11 -2
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +35 -11
- package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +16 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -10
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +4 -4
- package/dist/testing/cross_backend/in_process_setup.d.ts +22 -12
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +151 -134
- package/dist/testing/cross_backend/login_security.d.ts +12 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +21 -4
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
- package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +18 -10
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
- 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 +183 -30
- package/dist/testing/cross_backend/role_grant_participation.js +4 -4
- package/dist/testing/cross_backend/rpc_adversarial.js +1 -1
- package/dist/testing/cross_backend/session_cap.d.ts +2 -2
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +48 -16
- package/dist/testing/cross_backend/setup.d.ts +31 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +32 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +123 -12
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +454 -57
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +123 -27
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -2
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +59 -27
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +66 -42
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +7 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +54 -8
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -0
- package/dist/testing/db.d.ts +0 -32
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +0 -86
- package/dist/testing/db_entities.d.ts +14 -0
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +17 -0
- package/dist/testing/db_invariant_queries.d.ts +259 -0
- package/dist/testing/db_invariant_queries.d.ts.map +1 -0
- package/dist/testing/db_invariant_queries.js +400 -0
- package/dist/testing/db_invariants.d.ts +106 -0
- package/dist/testing/db_invariants.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
- package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.js +13 -0
- package/dist/testing/db_invariants.js +141 -0
- package/dist/testing/db_invariants.sql +152 -0
- package/dist/testing/describe_db.d.ts +36 -0
- package/dist/testing/describe_db.d.ts.map +1 -0
- package/dist/testing/describe_db.js +71 -0
- package/dist/testing/integration.d.ts +6 -9
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +9 -13
- package/dist/testing/integration_helpers.d.ts +1 -1
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/middleware.d.ts +1 -1
- package/dist/testing/middleware.js +5 -5
- package/dist/testing/rate_limiting.d.ts +1 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -2
- package/dist/testing/resolved_auth.d.ts +3 -1
- package/dist/testing/resolved_auth.d.ts.map +1 -1
- package/dist/testing/resolved_auth.js +4 -4
- package/dist/testing/role_grant_helpers.d.ts +1 -1
- package/dist/testing/role_grant_helpers.d.ts.map +1 -1
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +3 -0
- package/dist/testing/rpc_attack_surface.d.ts +8 -6
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +69 -6
- package/dist/testing/rpc_round_trip.d.ts +1 -1
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +3 -0
- package/dist/testing/sse_round_trip.d.ts +1 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +13 -4
- package/dist/testing/stubs.d.ts +4 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +15 -7
- package/dist/testing/test_app.d.ts +166 -0
- package/dist/testing/test_app.d.ts.map +1 -0
- package/dist/testing/test_app.js +124 -0
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +8 -4
- package/package.json +1 -1
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
* schema declared `acting?: ActingActor` (reference equality with the
|
|
16
16
|
* canonical `ActingActor` schema) or the auth requires role_grants
|
|
17
17
|
* (`role` / `keeper`), `apply_authorization_phase` resolves the actor
|
|
18
|
-
* against the resolved account
|
|
18
|
+
* against the resolved account plus the validated `acting` value via
|
|
19
19
|
* `resolve_acting_actor`, builds the `{account, actor, role_grants}`
|
|
20
20
|
* context via `build_request_context`, and sets it on
|
|
21
21
|
* `REQUEST_CONTEXT_KEY` before auth guards fire. Authenticated routes
|
|
22
|
-
* that don't need an actor still get an account-only context
|
|
23
|
-
*
|
|
22
|
+
* that don't need an actor still get an account-only context, so handler
|
|
23
|
+
* signatures stay uniform. The account is the row the credential leg
|
|
24
|
+
* read (`ResolvedAuth.account`) — the phase does not read it again.
|
|
24
25
|
*
|
|
25
26
|
* Account-grain operations (logout, password_change, account_verify,
|
|
26
27
|
* etc.) declare neither `acting` nor role_grant-requiring auth, so no actor
|
|
@@ -29,15 +30,15 @@
|
|
|
29
30
|
* which is what makes multi-actor logout work without first picking a
|
|
30
31
|
* persona.
|
|
31
32
|
*
|
|
32
|
-
* `build_request_context` loads
|
|
33
|
-
* the
|
|
34
|
-
* reloads role_grants on an existing context.
|
|
33
|
+
* `build_request_context` loads the acting actor's role_grants onto the
|
|
34
|
+
* account and the actor `resolve_acting_actor` read off that account.
|
|
35
|
+
* `refresh_role_grants` reloads role_grants on an existing context.
|
|
35
36
|
*
|
|
36
37
|
* @module
|
|
37
38
|
*/
|
|
38
39
|
import { is_role_grant_active } from './account_schema.js';
|
|
39
40
|
import { hash_session_token, query_session_get_valid } from './session_queries.js';
|
|
40
|
-
import { query_account_by_id,
|
|
41
|
+
import { query_account_by_id, query_active_actors_by_account } from './account_queries.js';
|
|
41
42
|
import { query_role_grant_find_active_for_actor } from './role_grant_queries.js';
|
|
42
43
|
import { has_test_context_preset, RESOLVED_AUTH_KEY, SESSION_COOKIE_EXPIRES_AT_KEY, SESSION_TOKEN_KEY } from '../hono_context.js';
|
|
43
44
|
import { credential_deadline_after } from './credential_deadline.js';
|
|
@@ -46,7 +47,7 @@ import { get_resolved_auth, resolved_auth_scope } from './resolved_auth.js';
|
|
|
46
47
|
import { is_route_scope_capability, token_scope_admits_non_rpc, token_scope_denied_body } from './token_scope.js';
|
|
47
48
|
import { is_public_auth, needs_actor, parse_acting } from '../http/auth_shape.js';
|
|
48
49
|
import { is_null_schema } from '../http/schema_helpers.js';
|
|
49
|
-
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT
|
|
50
|
+
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT } from '../http/error_schemas.js';
|
|
50
51
|
import { read_json_body } from '../http/json_text.js';
|
|
51
52
|
/** Hono context variable name for the request context. */
|
|
52
53
|
export const REQUEST_CONTEXT_KEY = 'request_context';
|
|
@@ -144,9 +145,10 @@ export const has_any_scoped_role = (ctx, roles, scope_id, now = new Date()) => {
|
|
|
144
145
|
* (from the request payload). Applies the uniform resolution rules:
|
|
145
146
|
*
|
|
146
147
|
* - `acting_actor_id` omitted + 1 actor → use it.
|
|
147
|
-
* -
|
|
148
|
+
* - 0 actors → `no_actors` when the account is still live (defensive —
|
|
148
149
|
* signup / bootstrap always create an actor in the same tx, so this
|
|
149
|
-
* is a server error)
|
|
150
|
+
* is a server error), `account_removed` when it is tombstoned or gone:
|
|
151
|
+
* removed since its credential was read, its actors with it.
|
|
150
152
|
* - `acting_actor_id` omitted + multiple actors → `actor_required` with
|
|
151
153
|
* the available list so the client can prompt; never pick silently.
|
|
152
154
|
* - `acting_actor_id` present + matches an actor on the account → use it.
|
|
@@ -154,6 +156,10 @@ export const has_any_scoped_role = (ctx, roles, scope_id, now = new Date()) => {
|
|
|
154
156
|
* The available list is intentionally not echoed in this branch (treat
|
|
155
157
|
* as opaque rejection).
|
|
156
158
|
*
|
|
159
|
+
* The actor comes back as the row the account's actor list read, so the
|
|
160
|
+
* caller builds on it without reading it again — one read, as on the Rust
|
|
161
|
+
* spine, which leaves no window for the actor to vanish between two.
|
|
162
|
+
*
|
|
157
163
|
* `acting_actor_id` is compared lowercased, the form actor ids are stored and
|
|
158
164
|
* read back in, so a caller passing an id that skipped the `Uuid` schema
|
|
159
165
|
* still matches its actor whatever its case.
|
|
@@ -164,11 +170,16 @@ export const has_any_scoped_role = (ctx, roles, scope_id, now = new Date()) => {
|
|
|
164
170
|
*/
|
|
165
171
|
export const resolve_acting_actor = async (deps, account_id, acting_actor_id) => {
|
|
166
172
|
const actors = await query_active_actors_by_account(deps, account_id);
|
|
167
|
-
if (actors.length === 0)
|
|
168
|
-
|
|
173
|
+
if (actors.length === 0) {
|
|
174
|
+
// a live account with no actor, or one removed since its credential was
|
|
175
|
+
// read — one read, on this path alone, tells them apart
|
|
176
|
+
return (await query_account_by_id(deps, account_id))
|
|
177
|
+
? { ok: false, reason: 'no_actors' }
|
|
178
|
+
: { ok: false, reason: 'account_removed' };
|
|
179
|
+
}
|
|
169
180
|
if (acting_actor_id == null) {
|
|
170
181
|
if (actors.length === 1)
|
|
171
|
-
return { ok: true,
|
|
182
|
+
return { ok: true, actor: actors[0] };
|
|
172
183
|
return {
|
|
173
184
|
ok: false,
|
|
174
185
|
reason: 'actor_required',
|
|
@@ -179,7 +190,7 @@ export const resolve_acting_actor = async (deps, account_id, acting_actor_id) =>
|
|
|
179
190
|
const match = actors.find((a) => a.id === acting);
|
|
180
191
|
if (!match)
|
|
181
192
|
return { ok: false, reason: 'actor_not_on_account' };
|
|
182
|
-
return { ok: true,
|
|
193
|
+
return { ok: true, actor: match };
|
|
183
194
|
};
|
|
184
195
|
/**
|
|
185
196
|
* Create middleware that authenticates the account from a session cookie —
|
|
@@ -234,7 +245,8 @@ export const create_request_context_middleware = (deps, options = {}) => {
|
|
|
234
245
|
}
|
|
235
246
|
// a tombstoned account authenticates nothing — its session resolves as
|
|
236
247
|
// no credential, the anonymous caller, as on the Rust spine
|
|
237
|
-
|
|
248
|
+
const account = await query_account_by_id(deps, session.account_id);
|
|
249
|
+
if (!account) {
|
|
238
250
|
await next();
|
|
239
251
|
return;
|
|
240
252
|
}
|
|
@@ -243,7 +255,7 @@ export const create_request_context_middleware = (deps, options = {}) => {
|
|
|
243
255
|
const cookie_expires_at = c.get(SESSION_COOKIE_EXPIRES_AT_KEY) ?? null;
|
|
244
256
|
c.set(RESOLVED_AUTH_KEY, {
|
|
245
257
|
credential_type: 'session',
|
|
246
|
-
|
|
258
|
+
account,
|
|
247
259
|
session_hash,
|
|
248
260
|
credential_deadline: credential_deadline_after([
|
|
249
261
|
cookie_expires_at === null ? null : cookie_expires_at * 1000 - Date.now(),
|
|
@@ -288,10 +300,10 @@ export const token_scope_surface_denial = (c, capability) => {
|
|
|
288
300
|
return null;
|
|
289
301
|
};
|
|
290
302
|
/**
|
|
291
|
-
* The account
|
|
292
|
-
* the credential (`reads_credential`) — may act on
|
|
293
|
-
* caller **and for a scope-narrowed API token**.
|
|
294
|
-
* anonymous-admitting disposition — the downgrade the Rust
|
|
303
|
+
* The account a public route — one that answers anonymous callers and reads
|
|
304
|
+
* the credential (`reads_credential`) — may act on, as the credential leg read
|
|
305
|
+
* it: `null` for the anonymous caller **and for a scope-narrowed API token**.
|
|
306
|
+
* Rule 3 in its anonymous-admitting disposition — the downgrade the Rust
|
|
295
307
|
* `AuthGate::public_request_context` applies.
|
|
296
308
|
*
|
|
297
309
|
* A narrowed token reaches no non-RPC surface that reads account data
|
|
@@ -307,15 +319,15 @@ export const token_scope_surface_denial = (c, capability) => {
|
|
|
307
319
|
* the scope, so it reads the full credential.
|
|
308
320
|
*
|
|
309
321
|
* @param route - the handler's `RouteContext`, or anything carrying its `credential`
|
|
310
|
-
* @returns the account
|
|
322
|
+
* @returns the account the credential resolved, or `null` for an anonymous caller or a narrowed token
|
|
311
323
|
*/
|
|
312
|
-
export const
|
|
324
|
+
export const get_public_account = (route) => {
|
|
313
325
|
const auth = route.credential;
|
|
314
326
|
if (auth === null)
|
|
315
327
|
return null;
|
|
316
328
|
if (!token_scope_admits_non_rpc(resolved_auth_scope(auth)))
|
|
317
329
|
return null;
|
|
318
|
-
return auth.
|
|
330
|
+
return auth.account;
|
|
319
331
|
};
|
|
320
332
|
/**
|
|
321
333
|
* Create middleware refusing a route to a credential whose scope does not admit
|
|
@@ -454,60 +466,29 @@ export const refresh_role_grants = async (ctx, deps) => {
|
|
|
454
466
|
return { ...ctx, role_grants };
|
|
455
467
|
};
|
|
456
468
|
/**
|
|
457
|
-
* Build
|
|
458
|
-
*
|
|
469
|
+
* Build an actor-bound `RequestContext` from the account the credential
|
|
470
|
+
* resolved and the actor `resolve_acting_actor` read off it, loading the
|
|
471
|
+
* actor's active role_grants.
|
|
459
472
|
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
473
|
+
* Reads only the grants: the account is the credential leg's row
|
|
474
|
+
* (`ResolvedAuth.account`) and the actor the account's own actor list read,
|
|
475
|
+
* so neither is read twice in a request and there is no torn read between
|
|
476
|
+
* the reads — a delete landing after them is the handler's to meet, as on
|
|
477
|
+
* the Rust spine.
|
|
465
478
|
*
|
|
466
|
-
* Called by the
|
|
467
|
-
*
|
|
468
|
-
* `
|
|
479
|
+
* Called by the dispatcher's authorization phase for routes that need an
|
|
480
|
+
* acting actor; account-grain routes get `{account, actor: null,
|
|
481
|
+
* role_grants: []}` with no read at all.
|
|
469
482
|
*
|
|
470
483
|
* @param deps - query dependencies
|
|
471
|
-
* @param
|
|
472
|
-
* @param
|
|
473
|
-
* @returns
|
|
484
|
+
* @param account - the account the credential resolved
|
|
485
|
+
* @param actor - the acting actor, one of `account`'s active actors
|
|
486
|
+
* @returns the actor-bound request context
|
|
474
487
|
*/
|
|
475
|
-
export const build_request_context = async (deps,
|
|
476
|
-
const account = await query_account_by_id(deps, account_id);
|
|
477
|
-
if (!account)
|
|
478
|
-
return null;
|
|
479
|
-
const actor = await query_actor_by_id(deps, actor_id);
|
|
480
|
-
if (!actor)
|
|
481
|
-
return null;
|
|
482
|
-
if (actor.account_id !== account.id)
|
|
483
|
-
return null;
|
|
488
|
+
export const build_request_context = async (deps, account, actor) => {
|
|
484
489
|
const role_grants = await query_role_grant_find_active_for_actor(deps, actor.id);
|
|
485
490
|
return { account, actor, role_grants };
|
|
486
491
|
};
|
|
487
|
-
/**
|
|
488
|
-
* Build an account-only `RequestContext` (no actor, no role_grants) from
|
|
489
|
-
* an account id.
|
|
490
|
-
*
|
|
491
|
-
* Used by the dispatcher's authorization phase for authenticated routes
|
|
492
|
-
* that don't need an acting actor — account-grain operations (logout,
|
|
493
|
-
* password change, account self-service). Lets handlers read
|
|
494
|
-
* `auth.account.id` / `auth.account.username` uniformly with role_grant-bound
|
|
495
|
-
* routes; the cost is one extra `query_account_by_id` per request.
|
|
496
|
-
*
|
|
497
|
-
* Returns `null` when the account row is missing (e.g. deleted between
|
|
498
|
-
* the auth middleware's session lookup and the dispatcher) — caller
|
|
499
|
-
* surfaces that as a 500 since it represents a torn read.
|
|
500
|
-
*
|
|
501
|
-
* @param deps - query dependencies
|
|
502
|
-
* @param account_id - the account to build context for
|
|
503
|
-
* @returns an account-only request context, or `null` if the account is missing
|
|
504
|
-
*/
|
|
505
|
-
export const build_account_context = async (deps, account_id) => {
|
|
506
|
-
const account = await query_account_by_id(deps, account_id);
|
|
507
|
-
if (!account)
|
|
508
|
-
return null;
|
|
509
|
-
return { account, actor: null, role_grants: [] };
|
|
510
|
-
};
|
|
511
492
|
/**
|
|
512
493
|
* Apply the dispatcher's authorization phase against the flat-record
|
|
513
494
|
* `RouteAuth` shape. Shared by the route-spec wrapper, the HTTP RPC
|
|
@@ -516,57 +497,57 @@ export const build_account_context = async (deps, account_id) => {
|
|
|
516
497
|
* input validation 400.
|
|
517
498
|
*
|
|
518
499
|
* Pure data — the function does not touch a Hono context. Each transport
|
|
519
|
-
* passes
|
|
500
|
+
* passes the account its credential resolved (`ResolvedAuth.account`) and
|
|
520
501
|
* binds the returned `AuthorizationResult` to its wire shape. The REST
|
|
521
502
|
* pipeline additionally writes `REQUEST_CONTEXT_KEY` on `c` for downstream
|
|
522
503
|
* `require_role` / `require_credential_types` middleware that still reads
|
|
523
504
|
* the resolved context off the Hono context.
|
|
524
505
|
*
|
|
506
|
+
* The account is never read here: the context is built on the credential
|
|
507
|
+
* leg's row, so a request reads its account once, as on the Rust spine,
|
|
508
|
+
* whose `apply_authorization_phase` takes the resolved account the same way.
|
|
509
|
+
*
|
|
525
510
|
* Branching by `auth.account` × `auth.actor`:
|
|
526
511
|
*
|
|
527
512
|
* - Both `'none'` → `{ok: true, request_context: null}`. Public actions
|
|
528
513
|
* never see a `RequestContext`.
|
|
529
|
-
* - `
|
|
514
|
+
* - `account == null` on any non-public route → same null
|
|
530
515
|
* `request_context`. The `'required'` callers were already rejected at
|
|
531
516
|
* the pre-authorization gate in the dispatcher; only genuine anonymous
|
|
532
517
|
* access on an `'optional'` axis lands here.
|
|
533
|
-
* - `actor === 'none'` →
|
|
534
|
-
*
|
|
518
|
+
* - `actor === 'none'` → an account-only context, `{account, actor: null,
|
|
519
|
+
* role_grants: []}`.
|
|
535
520
|
* - `actor === 'required'` → resolves the actor from `acting_value` (or
|
|
536
|
-
* single-actor account); failures map to 400 / 500.
|
|
521
|
+
* single-actor account); failures map to 400 / 401 / 500.
|
|
537
522
|
* - `actor === 'optional'` → same as `'required'` except multi-actor
|
|
538
523
|
* accounts without an `acting` value fall back to account-only context
|
|
539
524
|
* (no `actor_required` 400). Bad `acting` ids still 400.
|
|
540
525
|
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
526
|
+
* An account removed since the credential leg read it takes its actors with
|
|
527
|
+
* it: an actor-grain route then finds none, and answers the dead credential's
|
|
528
|
+
* 401 `ERROR_AUTHENTICATION_REQUIRED`, as a request that arrived after the
|
|
529
|
+
* removal does. The one 500 is `ERROR_NO_ACTORS_ON_ACCOUNT`: a live account
|
|
530
|
+
* with no active actor, a signup invariant violation.
|
|
544
531
|
*/
|
|
545
|
-
export const apply_authorization_phase = async (deps,
|
|
532
|
+
export const apply_authorization_phase = async (deps, account, auth, acting_value) => {
|
|
546
533
|
if (is_public_auth(auth))
|
|
547
534
|
return { ok: true, request_context: null };
|
|
548
|
-
if (
|
|
535
|
+
if (account === null) {
|
|
549
536
|
// Optional-auth route hit without a credential — leave `RequestContext`
|
|
550
537
|
// null so the handler can branch on it. `'required'` callers already
|
|
551
538
|
// got rejected at the pre-authorization gate.
|
|
552
539
|
return { ok: true, request_context: null };
|
|
553
540
|
}
|
|
554
541
|
if (!needs_actor(auth)) {
|
|
555
|
-
|
|
556
|
-
if (!ctx)
|
|
557
|
-
return { ok: false, status: 500, body: { error: ERROR_ACCOUNT_VANISHED } };
|
|
558
|
-
return { ok: true, request_context: ctx };
|
|
542
|
+
return { ok: true, request_context: { account, actor: null, role_grants: [] } };
|
|
559
543
|
}
|
|
560
544
|
// actor 'required' or 'optional' — resolve.
|
|
561
|
-
const acting = await resolve_acting_actor(deps,
|
|
545
|
+
const acting = await resolve_acting_actor(deps, account.id, acting_value);
|
|
562
546
|
if (!acting.ok) {
|
|
563
547
|
if (acting.reason === 'actor_required') {
|
|
564
548
|
if (auth.actor === 'optional') {
|
|
565
549
|
// Multi-actor account, no pick — fall back to account-only context.
|
|
566
|
-
|
|
567
|
-
if (!ctx)
|
|
568
|
-
return { ok: false, status: 500, body: { error: ERROR_ACCOUNT_VANISHED } };
|
|
569
|
-
return { ok: true, request_context: ctx };
|
|
550
|
+
return { ok: true, request_context: { account, actor: null, role_grants: [] } };
|
|
570
551
|
}
|
|
571
552
|
return {
|
|
572
553
|
ok: false,
|
|
@@ -577,12 +558,12 @@ export const apply_authorization_phase = async (deps, account_id, auth, acting_v
|
|
|
577
558
|
if (acting.reason === 'actor_not_on_account') {
|
|
578
559
|
return { ok: false, status: 400, body: { error: ERROR_ACTOR_NOT_ON_ACCOUNT } };
|
|
579
560
|
}
|
|
561
|
+
if (acting.reason === 'account_removed') {
|
|
562
|
+
return { ok: false, status: 401, body: { error: ERROR_AUTHENTICATION_REQUIRED } };
|
|
563
|
+
}
|
|
580
564
|
return { ok: false, status: 500, body: { error: ERROR_NO_ACTORS_ON_ACCOUNT } };
|
|
581
565
|
}
|
|
582
|
-
|
|
583
|
-
if (!ctx)
|
|
584
|
-
return { ok: false, status: 500, body: { error: ERROR_ACCOUNT_VANISHED } };
|
|
585
|
-
return { ok: true, request_context: ctx };
|
|
566
|
+
return { ok: true, request_context: await build_request_context(deps, account, acting.actor) };
|
|
586
567
|
};
|
|
587
568
|
/**
|
|
588
569
|
* Run the authorization phase on a Hono request: resolve the acting actor from
|
|
@@ -606,16 +587,17 @@ export const apply_authorization_phase = async (deps, account_id, auth, acting_v
|
|
|
606
587
|
* @param deps - query deps for actor resolution
|
|
607
588
|
* @param auth - the route's auth shape
|
|
608
589
|
* @param acting - the `acting` selector, already through `parse_acting`; `undefined` when absent
|
|
609
|
-
* @returns the refusal to answer (`400` actor selection, `
|
|
610
|
-
*
|
|
590
|
+
* @returns the refusal to answer (`400` actor selection, `401` an account
|
|
591
|
+
* removed since its credential was read, `500` a live account with no active
|
|
592
|
+
* actor), or nothing when the request may proceed
|
|
611
593
|
*/
|
|
612
594
|
export const run_authorization_phase = async (c, deps, auth, acting) => {
|
|
613
595
|
if (has_test_context_preset(c))
|
|
614
596
|
return;
|
|
615
597
|
if (is_public_auth(auth))
|
|
616
598
|
return;
|
|
617
|
-
const
|
|
618
|
-
const result = await apply_authorization_phase(deps,
|
|
599
|
+
const account = get_resolved_auth(c)?.account ?? null;
|
|
600
|
+
const result = await apply_authorization_phase(deps, account, auth, acting);
|
|
619
601
|
if (!result.ok)
|
|
620
602
|
return c.json(result.body, result.status);
|
|
621
603
|
if (result.request_context !== null) {
|
|
@@ -15,17 +15,22 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { Context } from 'hono';
|
|
17
17
|
import type { QueryDeps } from '../db/query_deps.js';
|
|
18
|
+
import type { Account, SessionId } from './account_schema.js';
|
|
18
19
|
import { type RequestContext } from './request_context.js';
|
|
19
20
|
import { type TokenScope } from './token_scope.js';
|
|
20
21
|
/** The fields every resolved credential carries. */
|
|
21
22
|
interface ResolvedAuthBase {
|
|
22
23
|
/**
|
|
23
|
-
* The authenticated account
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* The authenticated account, as the credential leg read it — live, not
|
|
25
|
+
* tombstoned. The authorization phase builds its request context on this
|
|
26
|
+
* row rather than reading the account again, so a request reads its account
|
|
27
|
+
* once, and an account removed after the leg is no torn read. On a
|
|
28
|
+
* long-lived connection it is the row read at the upgrade: a revocation
|
|
29
|
+
* closes the connection after its commit, and a re-read would race the
|
|
30
|
+
* revocation the same way. The twin of the Rust spine's
|
|
31
|
+
* `ResolvedAuth::account`.
|
|
27
32
|
*/
|
|
28
|
-
readonly
|
|
33
|
+
readonly account: Account;
|
|
29
34
|
/**
|
|
30
35
|
* When the credential stops authenticating, as a monotonic
|
|
31
36
|
* `performance.now()` timestamp — the moment a long-lived connection opened
|
|
@@ -42,7 +47,7 @@ interface ResolvedAuthBase {
|
|
|
42
47
|
export interface ResolvedSessionAuth extends ResolvedAuthBase {
|
|
43
48
|
readonly credential_type: 'session';
|
|
44
49
|
/** Blake3 hash of the session token — the `auth_session.id`. */
|
|
45
|
-
readonly session_hash:
|
|
50
|
+
readonly session_hash: SessionId;
|
|
46
51
|
}
|
|
47
52
|
/** An `Authorization: Bearer` API token — the only credential a scope narrows. */
|
|
48
53
|
export interface ResolvedApiTokenAuth extends ResolvedAuthBase {
|
|
@@ -85,7 +90,7 @@ export declare const resolved_auth_scope: (auth: ResolvedAuth | null) => TokenSc
|
|
|
85
90
|
* @param auth - the resolved credential, or `null` for an anonymous caller
|
|
86
91
|
* @returns the `auth_session.id`, or `null`
|
|
87
92
|
*/
|
|
88
|
-
export declare const resolved_auth_session_hash: (auth: ResolvedAuth | null) =>
|
|
93
|
+
export declare const resolved_auth_session_hash: (auth: ResolvedAuth | null) => SessionId | null;
|
|
89
94
|
/**
|
|
90
95
|
* The token id of an API token credential, `null` for any other (or none).
|
|
91
96
|
*
|
|
@@ -135,10 +140,10 @@ export declare const get_resolved_auth: (c: Context) => ResolvedAuth | null;
|
|
|
135
140
|
* - **Every credential** — the account row still exists and is not
|
|
136
141
|
* soft-deleted.
|
|
137
142
|
*
|
|
138
|
-
* It re-checks the **credential**, not what a revocation chose to close:
|
|
139
|
-
* `
|
|
140
|
-
*
|
|
141
|
-
* check and is refused only if that account-wide close found its pending
|
|
143
|
+
* It re-checks the **credential**, not what a revocation chose to close: an
|
|
144
|
+
* `admin_token_revoke_all` closes every connection of the account but deletes
|
|
145
|
+
* only its API tokens, so a session's connection opening concurrently passes
|
|
146
|
+
* this check and is refused only if that account-wide close found its pending
|
|
142
147
|
* registration — the same two outcomes an already-open connection has.
|
|
143
148
|
*
|
|
144
149
|
* **No side effects.** Unlike the bearer middleware this never touches
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolved_auth.d.ts","sourceRoot":"","sources":["../../src/lib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olved_auth = (c) => c.get(RESOLVED_AUTH_KEY) ?? null;
|
|
|
91
91
|
* - **Every credential** — the account row still exists and is not
|
|
92
92
|
* soft-deleted.
|
|
93
93
|
*
|
|
94
|
-
* It re-checks the **credential**, not what a revocation chose to close:
|
|
95
|
-
* `
|
|
96
|
-
*
|
|
97
|
-
* check and is refused only if that account-wide close found its pending
|
|
94
|
+
* It re-checks the **credential**, not what a revocation chose to close: an
|
|
95
|
+
* `admin_token_revoke_all` closes every connection of the account but deletes
|
|
96
|
+
* only its API tokens, so a session's connection opening concurrently passes
|
|
97
|
+
* this check and is refused only if that account-wide close found its pending
|
|
98
98
|
* registration — the same two outcomes an already-open connection has.
|
|
99
99
|
*
|
|
100
100
|
* **No side effects.** Unlike the bearer middleware this never touches
|
|
@@ -110,7 +110,7 @@ export const get_resolved_auth = (c) => c.get(RESOLVED_AUTH_KEY) ?? null;
|
|
|
110
110
|
* unchecked credential is not a valid one.
|
|
111
111
|
*/
|
|
112
112
|
export const revalidate_resolved_auth = async (deps, resolved) => {
|
|
113
|
-
const
|
|
113
|
+
const account_id = resolved.account.id;
|
|
114
114
|
let credential_is_live;
|
|
115
115
|
switch (resolved.credential_type) {
|
|
116
116
|
case 'session': {
|
|
@@ -163,7 +163,7 @@ export const recheck_admission = async (deps, input) => {
|
|
|
163
163
|
return 'credential_revoked';
|
|
164
164
|
const acting_actor = request_context.actor;
|
|
165
165
|
if (acting_actor) {
|
|
166
|
-
const active = await query_active_actors_by_account(deps, resolved.
|
|
166
|
+
const active = await query_active_actors_by_account(deps, resolved.account.id);
|
|
167
167
|
if (!active.some((a) => a.id === acting_actor.id))
|
|
168
168
|
return 'actor_inactive';
|
|
169
169
|
}
|
|
@@ -465,7 +465,7 @@ export declare const role_grant_offer_accept_action_spec: {
|
|
|
465
465
|
}>;
|
|
466
466
|
async: true;
|
|
467
467
|
description: string;
|
|
468
|
-
error_reasons: ("role_grant_offer_terminal" | "role_grant_offer_expired" | "role_grant_offer_not_found" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_mismatch" | "role_grant_builtin_scoped")[];
|
|
468
|
+
error_reasons: ("role_grant_offer_terminal" | "role_grant_offer_expired" | "role_grant_offer_not_found" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_mismatch" | "role_grant_builtin_scoped" | "authentication_required")[];
|
|
469
469
|
rate_limit: "account";
|
|
470
470
|
};
|
|
471
471
|
export declare const role_grant_offer_decline_action_spec: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_action_specs.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAkB3E,oEAAoE;AACpE,eAAO,MAAM,kCAAkC,EAAG,8BAAuC,CAAC;AAC1F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAClF,wGAAwG;AACxG,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF,uIAAuI;AACvI,eAAO,MAAM,yCAAyC,EACrD,qCAA8C,CAAC;AAChD,gKAAgK;AAChK,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,6FAA6F;AAC7F,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,wHAAwH;AACxH,eAAO,MAAM,6CAA6C,EACzD,yCAAkD,CAAC;AACpD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF;;;;;;G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AAM,qBAAqB;;;EAGhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAIxE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBX,CAAC;AAEtC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_action_specs.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAkB3E,oEAAoE;AACpE,eAAO,MAAM,kCAAkC,EAAG,8BAAuC,CAAC;AAC1F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAClF,wGAAwG;AACxG,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF,uIAAuI;AACvI,eAAO,MAAM,yCAAyC,EACrD,qCAA8C,CAAC;AAChD,gKAAgK;AAChK,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,6FAA6F;AAC7F,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,wHAAwH;AACxH,eAAO,MAAM,6CAA6C,EACzD,yCAAkD,CAAC;AACpD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF;;;;;;G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_OFFER_NOT_AUTHORIZED,
|
|
316
|
+
ERROR_AUTHENTICATION_REQUIRED
|
|
316
317
|
],
|
|
317
318
|
rate_limit: 'account'
|
|
318
319
|
};
|
|
@@ -44,24 +44,42 @@
|
|
|
44
44
|
* transaction, a failure row on the pool). `audit.notify` (SSE/WS broadcast)
|
|
45
45
|
* fires post-commit in both paths.
|
|
46
46
|
*
|
|
47
|
-
* WS notifications
|
|
48
|
-
* `notification_sender`
|
|
47
|
+
* WS notifications go through the handler context's sender
|
|
48
|
+
* (`ctx.notification_sender`), queued post-commit (`queue_offer_notification`,
|
|
49
|
+
* `queue_supersede_notifications`): offer lifecycle transitions notify the
|
|
49
50
|
* counterparty, `role_grant_revoke` notifies the revokee (`role_grant_revoked`)
|
|
50
|
-
* plus each superseded
|
|
51
|
-
*
|
|
52
|
-
* against its spec's schema before it is sent, a mismatch logged
|
|
53
|
-
* (`create_validated_notification_sender`). `role_grant_revoke` of a global
|
|
51
|
+
* plus both parties of each superseded pending offer, and an accept each
|
|
52
|
+
* superseded sibling's grantor. `role_grant_revoke` of a global
|
|
54
53
|
* grant also closes the revokee's connections gated on the role through
|
|
55
54
|
* `deps.connection_closer`, after the commit.
|
|
56
55
|
*
|
|
57
56
|
* @module
|
|
58
57
|
*/
|
|
58
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
59
59
|
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
60
|
-
import { type ActionContext, type RpcAction } from '../actions/action_types.js';
|
|
60
|
+
import { type ActionActorContext, type ActionContext, type RpcAction } from '../actions/action_types.js';
|
|
61
61
|
import { type RoleRegistry } from './role_schema.js';
|
|
62
|
+
import { type SupersededOffer } from './role_grant_offer_schema.js';
|
|
62
63
|
import { type RequestContext } from './request_context.js';
|
|
63
64
|
import type { RevokingActionFactoryDeps } from './deps.js';
|
|
64
|
-
import {
|
|
65
|
+
import type { AuditEmitter } from './audit_emitter.js';
|
|
66
|
+
import { type RoleGrantOfferSupersedeParams } from './role_grant_offer_notifications.js';
|
|
67
|
+
/**
|
|
68
|
+
* Emit one `role_grant_offer_supersede` audit row per offer a cascade ended —
|
|
69
|
+
* the revokes (`role_grant_revoke` and the self-service disable, both
|
|
70
|
+
* `'role_grant_revoked'` with the revoked grant as `cause_id`) and account
|
|
71
|
+
* removal (`'account_deleted'`, the removed account). The acting pair is the
|
|
72
|
+
* caller's; the target pair is the offer's recipient (`to_account_id`, and
|
|
73
|
+
* `to_actor_id` when the offer named an actor). Twin of the Rust
|
|
74
|
+
* `emit_supersede_audits`.
|
|
75
|
+
*
|
|
76
|
+
* @param ctx - the handler context; the rows are the caller's
|
|
77
|
+
* @param audit - the emitter
|
|
78
|
+
* @param superseded - the offers the cascade ended
|
|
79
|
+
* @param reason - why they were superseded
|
|
80
|
+
* @param cause_id - the row that caused it
|
|
81
|
+
*/
|
|
82
|
+
export declare const emit_supersede_audits: (ctx: ActionActorContext, audit: AuditEmitter, superseded: ReadonlyArray<SupersededOffer>, reason: RoleGrantOfferSupersedeParams["reason"], cause_id: Uuid) => Promise<void>;
|
|
65
83
|
/**
|
|
66
84
|
* Authorization callback for `role_grant_offer_create` and `role_grant_assign`.
|
|
67
85
|
* Returns `true` to allow, `false` to reject (handler converts to `forbidden`
|
|
@@ -75,6 +93,10 @@ import { type NotificationSender } from './role_grant_offer_notifications.js';
|
|
|
75
93
|
* role that must be scoped, a scope that must be real) holds on both paths.
|
|
76
94
|
* Twin of the Rust `OfferCreateAuthorize`.
|
|
77
95
|
*
|
|
96
|
+
* An offer authorized by a scoped grant must stay at that grant's scope: a
|
|
97
|
+
* scope teardown (`query_role_grant_revoke_for_scope`) supersedes only that
|
|
98
|
+
* scope's offers, so a revokee's offers elsewhere survive it.
|
|
99
|
+
*
|
|
78
100
|
* `ctx` is the request's: both verbs have side effects, so `ctx.db` is the
|
|
79
101
|
* request transaction, and a callback needing the database (a scope-existence
|
|
80
102
|
* check, say) reads through it. **Read-only** — the callback decides, it never
|
|
@@ -115,11 +137,9 @@ export interface RoleGrantOfferActionOptions {
|
|
|
115
137
|
* Create the role-grant-offer RPC actions: the offer-lifecycle methods plus
|
|
116
138
|
* `role_grant_revoke` and the immediate `role_grant_assign`.
|
|
117
139
|
*
|
|
118
|
-
* @param deps - `RevokingActionFactoryDeps
|
|
140
|
+
* @param deps - `RevokingActionFactoryDeps`: `log`, `audit`, and the `connection_closer` a revoked global grant closes the revokee's role-gated connections through. WS notifications go through the handler context's `notification_sender`, not a dep
|
|
119
141
|
* @param options - role registry, default TTL, authorization override
|
|
120
142
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
121
143
|
*/
|
|
122
|
-
export declare const create_role_grant_offer_actions: (deps: RevokingActionFactoryDeps
|
|
123
|
-
notification_sender?: NotificationSender | null;
|
|
124
|
-
}, options?: RoleGrantOfferActionOptions) => Array<RpcAction>;
|
|
144
|
+
export declare const create_role_grant_offer_actions: (deps: RevokingActionFactoryDeps, options?: RoleGrantOfferActionOptions) => Array<RpcAction>;
|
|
125
145
|
//# sourceMappingURL=role_grant_offer_actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_actions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"role_grant_offer_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAMN,KAAK,YAAY,EACjB,MAAM,kBAAkB,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