@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
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { ROLE_KEEPER } from '../../auth/role_schema.js';
|
|
3
2
|
import { AUTH_SESSION_LIFETIME_MS, query_session_revoke_for_account } from '../../auth/session_queries.js';
|
|
4
3
|
import { generate_api_token } from '../../auth/api_token.js';
|
|
5
4
|
import { query_create_api_token, query_revoke_api_token_for_account } from '../../auth/api_token_queries.js';
|
|
6
5
|
import { token_scope_full } from '../../auth/token_scope.js';
|
|
7
6
|
import { create_test_extra_actor } from '../db_entities.js';
|
|
8
|
-
import {
|
|
7
|
+
import { create_test_account_with_credentials, DEFAULT_TEST_KEEPER_ROLES, mint_test_session } from '../app_server.js';
|
|
8
|
+
import { create_test_app } from '../test_app.js';
|
|
9
9
|
import { create_test_app_surface_spec } from '../stubs.js';
|
|
10
|
+
import { validate_db_invariant_exclusions } from '../db_invariant_queries.js';
|
|
10
11
|
import { find_rpc_action, http_transport, resolve_rpc_endpoints_for_setup } from '../rpc_helpers.js';
|
|
11
12
|
import { query_shorten_credential_expiry } from './testing_reset_actions.js';
|
|
12
13
|
import { in_process_capabilities } from './capabilities.js';
|
|
@@ -37,143 +38,158 @@ const in_process_fetch_transport = (app) => {
|
|
|
37
38
|
* `_testing_reset` cradle so suite bodies read
|
|
38
39
|
* `fixture.extra_accounts[username]` uniformly regardless of transport.
|
|
39
40
|
*
|
|
41
|
+
* The keeper holds `options.roles`, or `create_test_app`'s default when
|
|
42
|
+
* omitted (`DEFAULT_TEST_KEEPER_ROLES` — keeper and admin, as a production
|
|
43
|
+
* bootstrap and the cross-process reset seed it). The database invariant
|
|
44
|
+
* check is the test app's: registered when the fixture is built inside a
|
|
45
|
+
* test, less `options.exclude_db_invariants`, and run on demand by
|
|
46
|
+
* `fixture.assert_db_invariants`. The exclusions are validated here, before
|
|
47
|
+
* any test runs.
|
|
48
|
+
*
|
|
40
49
|
* The describe-level `auth_integration_truncate_tables` / WASM database
|
|
41
|
-
* cache lifecycle stays in `create_default_db_factory` /
|
|
42
|
-
* (`testing/
|
|
50
|
+
* cache lifecycle stays in `create_default_db_factory` (`testing/db.ts`) /
|
|
51
|
+
* `create_describe_db` (`testing/describe_db.ts`) — `default_in_process_setup` doesn't manage db state
|
|
43
52
|
* beyond what `create_test_app` already does.
|
|
44
53
|
*/
|
|
45
|
-
export const default_in_process_setup = (options) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
session_options: options.session_options,
|
|
72
|
-
password: test_app.backend.deps.password,
|
|
73
|
-
username: spec.username,
|
|
74
|
-
password_value: spec.password_value,
|
|
75
|
-
roles: [...spec.roles]
|
|
76
|
-
});
|
|
77
|
-
extra_accounts[spec.username] = to_test_account(seeded, cookie_name);
|
|
78
|
-
}
|
|
79
|
-
// Seed additional keeper actors directly against the same DB. Mirrors
|
|
80
|
-
// the cross-process `_testing_reset` `extra_actors` path; no production
|
|
81
|
-
// wire mints a second actor, so this bootstrap-cradle insert is the
|
|
82
|
-
// only way into a multi-actor keeper state. Seeded at the wall clock,
|
|
83
|
-
// like the reset, so they sort after the bootstrap actor.
|
|
84
|
-
const extra_actors = [];
|
|
85
|
-
for (const name of options.extra_actors ?? []) {
|
|
86
|
-
const seeded_actor = await create_test_extra_actor(test_app.backend.deps.db, test_app.backend.account.id, name);
|
|
87
|
-
extra_actors.push({ id: seeded_actor.id, name: seeded_actor.name });
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
transport: in_process_fetch_transport(test_app.app),
|
|
91
|
-
// In-process the wrapper is stateless and never auto-adds Origin —
|
|
92
|
-
// `options` is accepted for API symmetry with cross-process but
|
|
93
|
-
// has no observable effect.
|
|
94
|
-
fresh_transport: () => in_process_fetch_transport(test_app.app),
|
|
95
|
-
account: test_app.backend.account,
|
|
96
|
-
actor: test_app.backend.actor,
|
|
97
|
-
create_session_headers: test_app.create_session_headers,
|
|
98
|
-
create_bearer_headers: test_app.create_bearer_headers,
|
|
99
|
-
create_daemon_token_headers: test_app.create_daemon_token_headers,
|
|
100
|
-
create_account: test_app.create_account,
|
|
101
|
-
extra_accounts,
|
|
102
|
-
extra_actors,
|
|
103
|
-
reject_unknown_audit_metadata_keys: options.reject_unknown_audit_metadata_keys ?? false,
|
|
104
|
-
// Forge directly against the live backend's DB + keyring — no wire
|
|
105
|
-
// hop needed in-process.
|
|
106
|
-
mint_expired_session: async () => {
|
|
107
|
-
const { session_cookie } = await mint_test_session({
|
|
54
|
+
export const default_in_process_setup = (options) => {
|
|
55
|
+
validate_db_invariant_exclusions(options.exclude_db_invariants, 'default_in_process_setup');
|
|
56
|
+
return async () => {
|
|
57
|
+
// Per-test fresh db. When `options.migration_namespaces` is set,
|
|
58
|
+
// `create_test_app` provisions an auth+extras database (e.g. the cell
|
|
59
|
+
// layer); otherwise the auth-only default. Either way the factory
|
|
60
|
+
// resets + re-migrates on each `create`, so the per-test keeper
|
|
61
|
+
// bootstrap below lands on a clean DB.
|
|
62
|
+
const test_app = await create_test_app(options);
|
|
63
|
+
// Seed bootstrap-time secondaries against the same DB the keeper
|
|
64
|
+
// just landed on. Direct-insert is the only path for roles whose
|
|
65
|
+
// `grant_paths` excludes `'admin'` (e.g. `ROLE_KEEPER`) — see
|
|
66
|
+
// `ExtraAccountSpec` for why this bypass is bootstrap-cradle-only.
|
|
67
|
+
const extra_accounts = {};
|
|
68
|
+
const { cookie_name } = options.session_options;
|
|
69
|
+
// where `account_verify` is mounted, for the liveness checks of the
|
|
70
|
+
// dead-credential mints; read only when one runs
|
|
71
|
+
const account_verify_rpc_path = (accessor) => {
|
|
72
|
+
const found = find_rpc_action(resolve_rpc_endpoints_for_setup(options.rpc_endpoints ?? [], options.session_options), 'account_verify');
|
|
73
|
+
if (!found) {
|
|
74
|
+
throw new Error(`${accessor}: the in-process app mounts no account_verify to prove the credential live`);
|
|
75
|
+
}
|
|
76
|
+
return found.path;
|
|
77
|
+
};
|
|
78
|
+
for (const spec of options.extra_accounts ?? []) {
|
|
79
|
+
const seeded = await create_test_account_with_credentials({
|
|
108
80
|
db: test_app.backend.deps.db,
|
|
109
81
|
keyring: test_app.backend.keyring,
|
|
110
82
|
session_options: options.session_options,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
// The mints, revocations and the expiry go through the queries the
|
|
117
|
-
// production paths (and the expiry backdoor) write with, so the rows
|
|
118
|
-
// match what the cross-process accessors leave; each credential is
|
|
119
|
-
// proven live first, so its refusal can only be the revocation or the
|
|
120
|
-
// expiry.
|
|
121
|
-
mint_revoked_session: async () => {
|
|
122
|
-
const db = test_app.backend.deps.db;
|
|
123
|
-
const account_id = test_app.backend.account.id;
|
|
124
|
-
const { session_cookie, session_hash } = await mint_test_session({
|
|
125
|
-
db,
|
|
126
|
-
keyring: test_app.backend.keyring,
|
|
127
|
-
session_options: options.session_options,
|
|
128
|
-
account_id,
|
|
129
|
-
expires_in_seconds: AUTH_SESSION_LIFETIME_MS / 1000
|
|
83
|
+
password: test_app.backend.deps.password,
|
|
84
|
+
username: spec.username,
|
|
85
|
+
password_value: spec.password_value,
|
|
86
|
+
roles: [...spec.roles]
|
|
130
87
|
});
|
|
131
|
-
|
|
132
|
-
await assert_credential_authenticates({
|
|
133
|
-
transport: in_process_fetch_transport(test_app.app),
|
|
134
|
-
rpc_path: account_verify_rpc_path('mint_revoked_session'),
|
|
135
|
-
headers: { cookie },
|
|
136
|
-
account_id,
|
|
137
|
-
accessor: 'mint_revoked_session'
|
|
138
|
-
});
|
|
139
|
-
if (!(await query_session_revoke_for_account({ db }, session_hash, account_id))) {
|
|
140
|
-
throw new Error('mint_revoked_session: the revoke removed no session row');
|
|
141
|
-
}
|
|
142
|
-
return cookie;
|
|
143
|
-
},
|
|
144
|
-
mint_revoked_token: async () => {
|
|
145
|
-
const deps = { db: test_app.backend.deps.db };
|
|
146
|
-
const account_id = test_app.backend.account.id;
|
|
147
|
-
const { token, id, token_hash } = generate_api_token();
|
|
148
|
-
await query_create_api_token(deps, id, account_id, 'conformance revoked token', token_hash, token_scope_full());
|
|
149
|
-
await assert_credential_authenticates({
|
|
150
|
-
transport: in_process_fetch_transport(test_app.app),
|
|
151
|
-
rpc_path: account_verify_rpc_path('mint_revoked_token'),
|
|
152
|
-
headers: { authorization: `Bearer ${token}` },
|
|
153
|
-
account_id,
|
|
154
|
-
accessor: 'mint_revoked_token'
|
|
155
|
-
});
|
|
156
|
-
if (!(await query_revoke_api_token_for_account(deps, id, account_id))) {
|
|
157
|
-
throw new Error('mint_revoked_token: the revoke removed no token row');
|
|
158
|
-
}
|
|
159
|
-
return token;
|
|
160
|
-
},
|
|
161
|
-
mint_expired_token: async () => {
|
|
162
|
-
const other = await test_app.create_account();
|
|
163
|
-
await assert_credential_authenticates({
|
|
164
|
-
transport: in_process_fetch_transport(test_app.app),
|
|
165
|
-
rpc_path: account_verify_rpc_path('mint_expired_token'),
|
|
166
|
-
headers: { authorization: `Bearer ${other.api_token}` },
|
|
167
|
-
account_id: other.account.id,
|
|
168
|
-
accessor: 'mint_expired_token'
|
|
169
|
-
});
|
|
170
|
-
const shortened = await query_shorten_credential_expiry(test_app.backend.deps.db, other.account.id, EXPIRED_TOKEN_SHORTEN_SECONDS);
|
|
171
|
-
if (shortened.api_tokens < 1) {
|
|
172
|
-
throw new Error('mint_expired_token: the expiry rewrote no token row');
|
|
173
|
-
}
|
|
174
|
-
await new Promise((resolve) => setTimeout(resolve, EXPIRED_TOKEN_WAIT_MS));
|
|
175
|
-
return other.api_token;
|
|
88
|
+
extra_accounts[spec.username] = to_test_account(seeded, cookie_name);
|
|
176
89
|
}
|
|
90
|
+
// Seed additional keeper actors directly against the same DB. Mirrors
|
|
91
|
+
// the cross-process `_testing_reset` `extra_actors` path; no production
|
|
92
|
+
// wire mints a second actor, so this bootstrap-cradle insert is the
|
|
93
|
+
// only way into a multi-actor keeper state. Seeded at the wall clock,
|
|
94
|
+
// like the reset, so they sort after the bootstrap actor.
|
|
95
|
+
const extra_actors = [];
|
|
96
|
+
for (const name of options.extra_actors ?? []) {
|
|
97
|
+
const seeded_actor = await create_test_extra_actor(test_app.backend.deps.db, test_app.backend.account.id, name);
|
|
98
|
+
extra_actors.push({ id: seeded_actor.id, name: seeded_actor.name });
|
|
99
|
+
}
|
|
100
|
+
const fixture = {
|
|
101
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
102
|
+
// In-process the wrapper is stateless and never auto-adds Origin —
|
|
103
|
+
// `options` is accepted for API symmetry with cross-process but
|
|
104
|
+
// has no observable effect.
|
|
105
|
+
fresh_transport: () => in_process_fetch_transport(test_app.app),
|
|
106
|
+
account: test_app.backend.account,
|
|
107
|
+
actor: test_app.backend.actor,
|
|
108
|
+
create_session_headers: test_app.create_session_headers,
|
|
109
|
+
create_bearer_headers: test_app.create_bearer_headers,
|
|
110
|
+
create_daemon_token_headers: test_app.create_daemon_token_headers,
|
|
111
|
+
create_account: test_app.create_account,
|
|
112
|
+
extra_accounts,
|
|
113
|
+
extra_actors,
|
|
114
|
+
reject_unknown_audit_metadata_keys: options.reject_unknown_audit_metadata_keys ?? false,
|
|
115
|
+
assert_db_invariants: test_app.assert_db_invariants,
|
|
116
|
+
// Forge directly against the live backend's DB + keyring — no wire
|
|
117
|
+
// hop needed in-process.
|
|
118
|
+
mint_expired_session: async () => {
|
|
119
|
+
const { session_cookie } = await mint_test_session({
|
|
120
|
+
db: test_app.backend.deps.db,
|
|
121
|
+
keyring: test_app.backend.keyring,
|
|
122
|
+
session_options: options.session_options,
|
|
123
|
+
account_id: test_app.backend.account.id,
|
|
124
|
+
expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS
|
|
125
|
+
});
|
|
126
|
+
return `${cookie_name}=${session_cookie}`;
|
|
127
|
+
},
|
|
128
|
+
// The session mint writes what the Rust `_testing_mint_session` writes
|
|
129
|
+
// (`mint_test_session`: a full lifetime past the database's `NOW()`);
|
|
130
|
+
// the token mints, the revocations and the expiry go through the
|
|
131
|
+
// queries the production paths (and the expiry backdoor) write with,
|
|
132
|
+
// so the rows match what the cross-process accessors leave. Each
|
|
133
|
+
// credential is proven live first, so its refusal can only be the
|
|
134
|
+
// revocation or the expiry.
|
|
135
|
+
mint_revoked_session: async () => {
|
|
136
|
+
const db = test_app.backend.deps.db;
|
|
137
|
+
const account_id = test_app.backend.account.id;
|
|
138
|
+
const { session_cookie, session_hash } = await mint_test_session({
|
|
139
|
+
db,
|
|
140
|
+
keyring: test_app.backend.keyring,
|
|
141
|
+
session_options: options.session_options,
|
|
142
|
+
account_id,
|
|
143
|
+
expires_in_seconds: AUTH_SESSION_LIFETIME_MS / 1000
|
|
144
|
+
});
|
|
145
|
+
const cookie = `${cookie_name}=${session_cookie}`;
|
|
146
|
+
await assert_credential_authenticates({
|
|
147
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
148
|
+
rpc_path: account_verify_rpc_path('mint_revoked_session'),
|
|
149
|
+
headers: { cookie },
|
|
150
|
+
account_id,
|
|
151
|
+
accessor: 'mint_revoked_session'
|
|
152
|
+
});
|
|
153
|
+
if (!(await query_session_revoke_for_account({ db }, session_hash, account_id))) {
|
|
154
|
+
throw new Error('mint_revoked_session: the revoke removed no session row');
|
|
155
|
+
}
|
|
156
|
+
return cookie;
|
|
157
|
+
},
|
|
158
|
+
mint_revoked_token: async () => {
|
|
159
|
+
const deps = { db: test_app.backend.deps.db };
|
|
160
|
+
const account_id = test_app.backend.account.id;
|
|
161
|
+
const { token, id, token_hash } = generate_api_token();
|
|
162
|
+
await query_create_api_token(deps, id, account_id, 'conformance revoked token', token_hash, token_scope_full());
|
|
163
|
+
await assert_credential_authenticates({
|
|
164
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
165
|
+
rpc_path: account_verify_rpc_path('mint_revoked_token'),
|
|
166
|
+
headers: { authorization: `Bearer ${token}` },
|
|
167
|
+
account_id,
|
|
168
|
+
accessor: 'mint_revoked_token'
|
|
169
|
+
});
|
|
170
|
+
if (!(await query_revoke_api_token_for_account(deps, id, account_id))) {
|
|
171
|
+
throw new Error('mint_revoked_token: the revoke removed no token row');
|
|
172
|
+
}
|
|
173
|
+
return token;
|
|
174
|
+
},
|
|
175
|
+
mint_expired_token: async () => {
|
|
176
|
+
const other = await test_app.create_account();
|
|
177
|
+
await assert_credential_authenticates({
|
|
178
|
+
transport: in_process_fetch_transport(test_app.app),
|
|
179
|
+
rpc_path: account_verify_rpc_path('mint_expired_token'),
|
|
180
|
+
headers: { authorization: `Bearer ${other.api_token}` },
|
|
181
|
+
account_id: other.account.id,
|
|
182
|
+
accessor: 'mint_expired_token'
|
|
183
|
+
});
|
|
184
|
+
const shortened = await query_shorten_credential_expiry(test_app.backend.deps.db, other.account.id, EXPIRED_TOKEN_SHORTEN_SECONDS);
|
|
185
|
+
if (shortened.api_tokens < 1) {
|
|
186
|
+
throw new Error('mint_expired_token: the expiry rewrote no token row');
|
|
187
|
+
}
|
|
188
|
+
await new Promise((resolve) => setTimeout(resolve, EXPIRED_TOKEN_WAIT_MS));
|
|
189
|
+
return other.api_token;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return fixture;
|
|
177
193
|
};
|
|
178
194
|
};
|
|
179
195
|
// NOTE: bootstrap config is read from `options.bootstrap` — top-level slot,
|
|
@@ -205,7 +221,7 @@ export const default_in_process_setup = (options) => async () => {
|
|
|
205
221
|
* describe_standard_admin_integration_tests({
|
|
206
222
|
* ...default_in_process_suite_options({
|
|
207
223
|
* session_options, create_route_specs, rpc_endpoints,
|
|
208
|
-
* extra_keeper_roles: [
|
|
224
|
+
* extra_keeper_roles: [MY_APP_ROLE],
|
|
209
225
|
* }),
|
|
210
226
|
* roles,
|
|
211
227
|
* });
|
|
@@ -223,10 +239,11 @@ export const default_in_process_suite_options = (options) => ({
|
|
|
223
239
|
rpc_endpoints: options.rpc_endpoints,
|
|
224
240
|
bootstrap: options.bootstrap,
|
|
225
241
|
app_options: options.app_options,
|
|
226
|
-
roles: [
|
|
242
|
+
roles: [...new Set([...DEFAULT_TEST_KEEPER_ROLES, ...(options.extra_keeper_roles ?? [])])],
|
|
227
243
|
extra_accounts: options.extra_accounts,
|
|
228
244
|
extra_actors: options.extra_actors,
|
|
229
|
-
reject_unknown_audit_metadata_keys: options.reject_unknown_audit_metadata_keys
|
|
245
|
+
reject_unknown_audit_metadata_keys: options.reject_unknown_audit_metadata_keys,
|
|
246
|
+
exclude_db_invariants: options.exclude_db_invariants
|
|
230
247
|
}),
|
|
231
248
|
surface_source: options.surface_source ??
|
|
232
249
|
create_test_app_surface_spec({
|
|
@@ -8,6 +8,18 @@ export interface LoginSecurityCrossTestOptions {
|
|
|
8
8
|
readonly login_path?: string;
|
|
9
9
|
/** REST password-change route path. Default `/api/account/password`. */
|
|
10
10
|
readonly password_path?: string;
|
|
11
|
+
/**
|
|
12
|
+
* JSON-RPC endpoint path, for the burst-of-correct-logins case's session
|
|
13
|
+
* count. Default `SPINE_RPC_PATH`.
|
|
14
|
+
*/
|
|
15
|
+
readonly rpc_path?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The per-account session cap the backend enforces, which the
|
|
18
|
+
* burst-of-correct-logins case holds the account to. Defaults to
|
|
19
|
+
* `DEFAULT_MAX_SESSIONS` — the TS route default and the Rust `const`. A
|
|
20
|
+
* backend that overrides `max_sessions` on the TS side passes its value here.
|
|
21
|
+
*/
|
|
22
|
+
readonly max_sessions?: number;
|
|
11
23
|
/**
|
|
12
24
|
* Whether the backend serves concurrent logins — each its own database
|
|
13
25
|
* transaction — at once, for the burst-of-correct-logins case. Default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_security.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/login_security.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"login_security.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/login_security.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAgG9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAU5C,mDAAmD;AACnD,MAAM,WAAW,6BAA6B;IAC7C,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAmDD,eAAO,MAAM,mCAAmC,GAC/C,SAAS,6BAA6B,KACpC,IA0XF,CAAC"}
|
|
@@ -38,7 +38,10 @@ import '../assert_dev_env.js';
|
|
|
38
38
|
* - **a burst of correct logins past the cap waits, then succeeds** — attempts
|
|
39
39
|
* count while in flight whatever their outcome, so `2 × ip_limit` correct
|
|
40
40
|
* logins at once from one address meet the cap; the ones past it wait for a
|
|
41
|
-
* slot (at most the cap of them) and all answer `200`.
|
|
41
|
+
* slot (at most the cap of them) and all answer `200`. Afterward the account
|
|
42
|
+
* holds exactly the session cap (`max_sessions`): concurrent mints of one
|
|
43
|
+
* account take turns on its row lock, each evicting against the sessions
|
|
44
|
+
* committed before it, so none commits above the cap. Runs on a backend
|
|
42
45
|
* that serves concurrent transactions (`concurrent_transactions`).
|
|
43
46
|
* - **every `X-Forwarded-For` line is read** — a client that sends its own
|
|
44
47
|
* line ahead of the one the trusted proxy appended can't choose its bucket:
|
|
@@ -76,11 +79,15 @@ import '../assert_dev_env.js';
|
|
|
76
79
|
* @module
|
|
77
80
|
*/
|
|
78
81
|
import { describe, test, assert } from 'vitest';
|
|
82
|
+
import { SessionListOutput } from '../../auth/account_action_specs.js';
|
|
83
|
+
import { DEFAULT_MAX_SESSIONS } from '../../auth/account_route_schema.js';
|
|
79
84
|
import { ERROR_RATE_LIMIT_EXCEEDED } from '../../http/error_schemas.js';
|
|
80
85
|
import { raw_http_exchange, raw_http_parse_response, raw_http_request } from '../transports/raw_http.js';
|
|
81
86
|
import { default_login_account_rate_limit, default_login_ip_rate_limit } from '../../rate_limiter.js';
|
|
82
87
|
import { list_audit_events } from './audit_cross_helpers.js';
|
|
83
|
-
import {
|
|
88
|
+
import { test_if } from './capabilities.js';
|
|
89
|
+
import { cross_rpc_call, expect_output } from './cross_rpc.js';
|
|
90
|
+
import { SPINE_ACCOUNT_LOGIN_PATH, SPINE_ACCOUNT_PASSWORD_PATH, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
84
91
|
/**
|
|
85
92
|
* RFC 5737 TEST-NET-3 (`203.0.113.0/24`) documentation addresses — guaranteed
|
|
86
93
|
* non-routable, so they never collide with a real client IP. One per bucket the
|
|
@@ -123,6 +130,8 @@ export const describe_login_security_cross_tests = (options) => {
|
|
|
123
130
|
const { setup_test } = options;
|
|
124
131
|
const login_path = options.login_path ?? SPINE_ACCOUNT_LOGIN_PATH;
|
|
125
132
|
const password_path = options.password_path ?? SPINE_ACCOUNT_PASSWORD_PATH;
|
|
133
|
+
const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
|
|
134
|
+
const max_sessions = options.max_sessions ?? DEFAULT_MAX_SESSIONS;
|
|
126
135
|
const concurrent_transactions = options.concurrent_transactions ?? false;
|
|
127
136
|
const base_url = options.base_url ?? null;
|
|
128
137
|
/** Per-IP cap shared by both impls (TS `default_login_ip_rate_limit`, Rust `DEFAULT_LOGIN_IP_RATE_LIMIT`). */
|
|
@@ -134,6 +143,8 @@ export const describe_login_security_cross_tests = (options) => {
|
|
|
134
143
|
// Assert the ordering so a future cap change fails loud here instead of as a
|
|
135
144
|
// confusing 429-instead-of-401 mid-case.
|
|
136
145
|
assert(default_login_account_rate_limit.max_attempts > ip_limit, 'login-security XFF segregation needs the per-account cap above the per-IP cap');
|
|
146
|
+
// The concurrent correct-login burst counts on filling the session cap.
|
|
147
|
+
assert(ip_limit * 2 >= max_sessions, `the login burst (${ip_limit * 2}) must reach the session cap (${max_sessions})`);
|
|
137
148
|
/**
|
|
138
149
|
* POST a login with the given `X-Forwarded-For` on a fresh (cookie-jar-free)
|
|
139
150
|
* transport — wrong password against a non-existent username, so the handler
|
|
@@ -284,7 +295,7 @@ export const describe_login_security_cross_tests = (options) => {
|
|
|
284
295
|
const after = await attempt(fixture, XFF_BURST, 'probe_burst');
|
|
285
296
|
assert.strictEqual(after.status, 429, 'the burst must leave the per-IP bucket full');
|
|
286
297
|
});
|
|
287
|
-
|
|
298
|
+
test_if(concurrent_transactions, `a concurrent burst of ${ip_limit * 2} correct logins all succeed past the per-IP cap`, async () => {
|
|
288
299
|
const fixture = await setup_test();
|
|
289
300
|
const account = await fixture.create_account({
|
|
290
301
|
username: 'burst_correct',
|
|
@@ -292,8 +303,14 @@ export const describe_login_security_cross_tests = (options) => {
|
|
|
292
303
|
});
|
|
293
304
|
const statuses = await Promise.all(Array.from({ length: ip_limit * 2 }, () => succeed(fixture, XFF_CORRECT_BURST, account.account.username, 'burst_correct_password')));
|
|
294
305
|
assert.deepStrictEqual(statuses, Array(ip_limit * 2).fill(200), 'the logins past the cap wait for a slot rather than being refused');
|
|
306
|
+
// The burst alone fills the session cap (asserted at collection), so
|
|
307
|
+
// whatever the account held before it, exactly the cap remains. Listed
|
|
308
|
+
// with the account's API token, which no session eviction touches.
|
|
309
|
+
const { sessions } = expect_output(await cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, 'account_session_list', undefined, account.create_bearer_headers()), SessionListOutput);
|
|
310
|
+
assert.strictEqual(sessions.length, max_sessions, `the account must hold exactly ${max_sessions} sessions after a concurrent burst ` +
|
|
311
|
+
'of logins — each mint evicting against the sessions committed before it');
|
|
295
312
|
});
|
|
296
|
-
|
|
313
|
+
test_if(base_url !== null, 'every X-Forwarded-For line is read (a spoofed first line picks no bucket)', async () => {
|
|
297
314
|
assert.ok(base_url !== null);
|
|
298
315
|
const fixture = await setup_test();
|
|
299
316
|
for (let i = 0; i < ip_limit; i++) {
|
|
@@ -19,8 +19,6 @@ export interface RequestTargetConformanceWireCrossTestOptions {
|
|
|
19
19
|
readonly rpc_path?: string;
|
|
20
20
|
/** WebSocket endpoint path. Default `SPINE_WS_PATH`. */
|
|
21
21
|
readonly ws_path?: string;
|
|
22
|
-
/** Account status route path. Default `SPINE_ACCOUNT_STATUS_PATH`. */
|
|
23
|
-
readonly account_status_path?: string;
|
|
24
22
|
/** Login route path, the `POST`-only route. Default `SPINE_ACCOUNT_LOGIN_PATH`. */
|
|
25
23
|
readonly account_login_path?: string;
|
|
26
24
|
/** Audit stream path, the SSE route. Default `SPINE_SSE_PATH`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_target_conformance_wire.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/request_target_conformance_wire.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA8D9B,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AASzD,0EAA0E;AAC1E,MAAM,WAAW,4CAA4C;IAC5D,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"request_target_conformance_wire.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/request_target_conformance_wire.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA8D9B,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AASzD,0EAA0E;AAC1E,MAAM,WAAW,4CAA4C;IAC5D,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AA6HD,eAAO,MAAM,oDAAoD,GAChE,SAAS,4CAA4C,KACnD,IAkKF,CAAC"}
|
|
@@ -151,7 +151,9 @@ export const describe_request_target_conformance_wire_cross_tests = (options) =>
|
|
|
151
151
|
const placeholders = {
|
|
152
152
|
rpc_path: options.rpc_path ?? SPINE_RPC_PATH,
|
|
153
153
|
ws_path: options.ws_path ?? SPINE_WS_PATH,
|
|
154
|
-
|
|
154
|
+
// the spine's, as `query_shape` and `token_scope_surface` send to and the
|
|
155
|
+
// mount suite probes: the one path `capabilities.account_status` names
|
|
156
|
+
account_status_path: SPINE_ACCOUNT_STATUS_PATH,
|
|
155
157
|
account_login_path: options.account_login_path ?? SPINE_ACCOUNT_LOGIN_PATH,
|
|
156
158
|
sse_path: options.sse_path ?? SPINE_SSE_PATH,
|
|
157
159
|
health_path: options.health_path ?? '/health'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import type { BackendCapabilities } from './capabilities.js';
|
|
3
|
-
import type { TestAccount } from '../
|
|
3
|
+
import type { TestAccount } from '../test_app.js';
|
|
4
4
|
import type { TestFixture } from './setup.js';
|
|
5
5
|
/**
|
|
6
6
|
* POST a JSON body to a REST route on `account`'s session, asserting `200`.
|
|
@@ -30,7 +30,17 @@ export declare const cross_admin_token_revoke_all: (fixture: TestFixture, rpc_pa
|
|
|
30
30
|
* @param account_id - the account to purge
|
|
31
31
|
*/
|
|
32
32
|
export declare const cross_account_purge: (fixture: TestFixture, rpc_path: string, account_id: string) => Promise<void>;
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* What a revocation row closes:
|
|
35
|
+
*
|
|
36
|
+
* - `account` — every connection of the target account, whatever credential
|
|
37
|
+
* opened it
|
|
38
|
+
* - `session` — only the connections of the session the revocation was sent on
|
|
39
|
+
* (`TestAccount.create_session_headers`'s); the account's other sessions, its
|
|
40
|
+
* API tokens, and the daemon token stay valid, and their connections open
|
|
41
|
+
*/
|
|
42
|
+
export type AccountRevocationCloses = 'account' | 'session';
|
|
43
|
+
/** One revocation of a target account's credentials, as a row both transport suites iterate. */
|
|
34
44
|
export interface AccountRevocation {
|
|
35
45
|
/** Names the revocation in a case name and a failure message. */
|
|
36
46
|
readonly label: string;
|
|
@@ -41,6 +51,8 @@ export interface AccountRevocation {
|
|
|
41
51
|
readonly slug: string;
|
|
42
52
|
/** Whether the backend serves the revocation (beyond `rpc_path`, which every row needs). */
|
|
43
53
|
readonly gate: boolean;
|
|
54
|
+
/** Which of the target's connections the revocation closes. */
|
|
55
|
+
readonly closes: AccountRevocationCloses;
|
|
44
56
|
/**
|
|
45
57
|
* Revoke `target`'s credentials and assert the revocation succeeded.
|
|
46
58
|
* `target` must have been created with `DEFAULT_TEST_PASSWORD`, which the
|
|
@@ -60,9 +72,10 @@ export interface AccountRevocationsOptions {
|
|
|
60
72
|
readonly password_path: string;
|
|
61
73
|
}
|
|
62
74
|
/**
|
|
63
|
-
* The
|
|
64
|
-
*
|
|
65
|
-
*
|
|
75
|
+
* The revocations of a target account's credentials both transport suites
|
|
76
|
+
* drive: `admin_token_revoke_all`, `POST /password`, and `account_purge`
|
|
77
|
+
* (gated on `capabilities.account_lifecycle`) close every connection of the
|
|
78
|
+
* account; `POST /logout` closes only the connections of the session it ends.
|
|
66
79
|
*
|
|
67
80
|
* @param options - the backend's capabilities and route paths
|
|
68
81
|
* @returns the revocation rows, in a stable order
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation_drivers.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/revocation_drivers.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"revocation_drivers.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/revocation_drivers.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA+B9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GACzB,SAAS,WAAW,EACpB,SAAS,WAAW,EACpB,MAAM,MAAM,EACZ,MAAM,OAAO,KACX,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,WAAW,EACpB,UAAU,MAAM,EAChB,YAAY,MAAM,KAChB,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAC/B,SAAS,WAAW,EACpB,UAAU,MAAM,EAChB,YAAY,MAAM,KAChB,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D,gGAAgG;AAChG,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E;AAED,sDAAsD;AACtD,MAAM,WAAW,yBAAyB;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8BAA8B;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACtC,SAAS,yBAAyB,KAChC,aAAa,CAAC,iBAAiB,CAqCjC,CAAC"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
/**
|
|
3
|
-
* The account
|
|
4
|
-
*
|
|
5
|
-
* covered on both transports.
|
|
3
|
+
* The revocations sent on a target account's own session or by an admin that
|
|
4
|
+
* the cross-process WS and SSE round-trip suites both close a live connection
|
|
5
|
+
* on — one table, so a revocation added here is covered on both transports.
|
|
6
6
|
*
|
|
7
7
|
* Each row drives one revocation of a target account's credentials and asserts
|
|
8
8
|
* it succeeded; the suite opens the target's connections first and asserts
|
|
9
|
-
* their close after. `
|
|
9
|
+
* their close after. Each row says what it closes (`AccountRevocation.closes`):
|
|
10
|
+
* the whole account, or only the session the revocation was sent on
|
|
11
|
+
* (`POST /logout`), which leaves the account's other credentials' connections
|
|
12
|
+
* open. `describe_cross_process_ws_tests` and
|
|
10
13
|
* `describe_cross_process_sse_tests` iterate `create_account_revocations`. The
|
|
11
|
-
* revocations
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
+
* revocations that name a credential in their input (one session, one token),
|
|
15
|
+
* a cap eviction, and those a suite drives differently (session revoke-all,
|
|
16
|
+
* account delete) stay in their suites.
|
|
14
17
|
*
|
|
15
18
|
* The drivers are exported on their own for a consumer suite that closes a
|
|
16
19
|
* transport of its own on the same revocations.
|
|
@@ -63,9 +66,10 @@ export const cross_account_purge = async (fixture, rpc_path, account_id) => {
|
|
|
63
66
|
assert.ok(res.ok, `account_purge failed: ${JSON.stringify(res.error)}`);
|
|
64
67
|
};
|
|
65
68
|
/**
|
|
66
|
-
* The
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
+
* The revocations of a target account's credentials both transport suites
|
|
70
|
+
* drive: `admin_token_revoke_all`, `POST /password`, and `account_purge`
|
|
71
|
+
* (gated on `capabilities.account_lifecycle`) close every connection of the
|
|
72
|
+
* account; `POST /logout` closes only the connections of the session it ends.
|
|
69
73
|
*
|
|
70
74
|
* @param options - the backend's capabilities and route paths
|
|
71
75
|
* @returns the revocation rows, in a stable order
|
|
@@ -77,18 +81,21 @@ export const create_account_revocations = (options) => {
|
|
|
77
81
|
label: 'admin_token_revoke_all',
|
|
78
82
|
slug: 'token_revoke_all',
|
|
79
83
|
gate: true,
|
|
84
|
+
closes: 'account',
|
|
80
85
|
revoke: (fixture, target) => cross_admin_token_revoke_all(fixture, rpc_path, target.account.id)
|
|
81
86
|
},
|
|
82
87
|
{
|
|
83
88
|
label: 'POST /logout',
|
|
84
89
|
slug: 'logout',
|
|
85
90
|
gate: true,
|
|
91
|
+
closes: 'session',
|
|
86
92
|
revoke: (fixture, target) => cross_post_as(fixture, target, logout_path, {})
|
|
87
93
|
},
|
|
88
94
|
{
|
|
89
95
|
label: 'POST /password',
|
|
90
96
|
slug: 'password',
|
|
91
97
|
gate: true,
|
|
98
|
+
closes: 'account',
|
|
92
99
|
revoke: (fixture, target) => cross_post_as(fixture, target, password_path, {
|
|
93
100
|
current_password: DEFAULT_TEST_PASSWORD,
|
|
94
101
|
new_password: 'revoked-new-password-456'
|
|
@@ -98,6 +105,7 @@ export const create_account_revocations = (options) => {
|
|
|
98
105
|
label: 'account_purge',
|
|
99
106
|
slug: 'purge',
|
|
100
107
|
gate: capabilities.account_lifecycle,
|
|
108
|
+
closes: 'account',
|
|
101
109
|
revoke: (fixture, target) => cross_account_purge(fixture, rpc_path, target.account.id)
|
|
102
110
|
}
|
|
103
111
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import type { TestAccount } from '../
|
|
2
|
+
import type { TestAccount } from '../test_app.js';
|
|
3
3
|
import type { TestFixture } from './setup.js';
|
|
4
4
|
/** Options for the role-grant fixtures. */
|
|
5
5
|
export interface RoleGrantFixtureOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_cross_helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_cross_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAoB9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"role_grant_cross_helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_cross_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAoB9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACvC,qFAAqF;IACrF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,GAC3C,SAAS,WAAW,EACpB,eAAe,MAAM,EACrB,kBAAiB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAoC,EAC1E,UAAS,uBAA4B,KACnC,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAWxB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACpC,SAAS,WAAW,EACpB,WAAW,WAAW,EACtB,UAAS,uBAA4B,KACnC,OAAO,CAAC,MAAM,CAgBhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqG9B,OAAO,KAAK,EAAE,wBAAwB,EAAe,MAAM,YAAY,CAAC;AAMxE,qEAAqE;AACrE,MAAM,WAAW,uCAAwC,SAAQ,wBAAwB;IACxF;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,+CAA+C,GAC3D,SAAS,uCAAuC,KAC9C,IAqsBF,CAAC"}
|