@fuzdev/fuz_app 0.162.0 → 0.163.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/CLAUDE.md +38 -35
- package/dist/auth/account_action_specs.d.ts +441 -115
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +47 -46
- package/dist/auth/account_route_schema.d.ts +120 -60
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +50 -36
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +54 -27
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +16 -18
- package/dist/auth/admin_action_specs.d.ts +20 -20
- package/dist/auth/admin_action_specs.js +2 -4
- package/dist/auth/admin_actions.d.ts +4 -4
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +3 -3
- package/dist/auth/all_cell_actions.d.ts +3 -3
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token.d.ts +4 -4
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +3 -3
- package/dist/auth/audit_log_schema.d.ts +28 -48
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +34 -30
- package/dist/auth/bootstrap_route_schema.d.ts +173 -50
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +35 -16
- package/dist/auth/cell_grant_action_specs.d.ts +1 -1
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_actions.d.ts +4 -4
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +1 -1
- package/dist/auth/credential_type_schema.d.ts +16 -29
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +14 -18
- package/dist/auth/grant_path_schema.d.ts +15 -29
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +13 -17
- package/dist/auth/migrations.js +1 -1
- package/dist/auth/name_schema.d.ts +7 -6
- package/dist/auth/name_schema.d.ts.map +1 -1
- package/dist/auth/name_schema.js +8 -9
- package/dist/auth/password.d.ts +15 -7
- package/dist/auth/password.d.ts.map +1 -1
- package/dist/auth/password.js +16 -9
- package/dist/auth/role_grant_offer_action_specs.js +2 -2
- package/dist/auth/role_grant_offer_actions.d.ts +4 -4
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +3 -3
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_offer_schema.d.ts +2 -2
- package/dist/auth/role_grant_offer_schema.js +2 -2
- package/dist/auth/role_schema.d.ts +47 -55
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +29 -35
- package/dist/auth/scope_kind_schema.d.ts +22 -26
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +19 -19
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +6 -6
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +7 -6
- package/dist/auth/signup_route_schema.d.ts +71 -21
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +18 -16
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.js +1 -1
- package/dist/auth/token_lifetime.d.ts +33 -9
- package/dist/auth/token_lifetime.d.ts.map +1 -1
- package/dist/auth/token_lifetime.js +8 -7
- package/dist/auth/token_scope.d.ts +99 -25
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +57 -35
- package/dist/primitive_schemas.d.ts +2 -19
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +2 -20
- package/dist/primitive_schemas_fuz.d.ts +22 -2
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +23 -4
- package/dist/testing/CLAUDE.md +22 -5
- package/dist/testing/admin_integration.d.ts +3 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +1 -1
- package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +39 -6
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +45 -42
- package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.d.ts +4 -4
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +34 -1
- package/dist/testing/integration.js +1 -1
- package/dist/testing/token_scope_fixtures.d.ts +24 -0
- package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
- package/dist/testing/token_scope_fixtures.js +49 -0
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +13 -12
- package/dist/ui/BootstrapForm.svelte +4 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +4 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/auth/audit_log_schema_fuz.d.ts +0 -53
- package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
- package/dist/auth/audit_log_schema_fuz.js +0 -50
- package/dist/auth/role_schema_fuz.d.ts +0 -30
- package/dist/auth/role_schema_fuz.d.ts.map +0 -1
- package/dist/auth/role_schema_fuz.js +0 -30
- package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
- package/dist/auth/scope_kind_schema_fuz.js +0 -31
|
@@ -18,7 +18,7 @@ import '../assert_dev_env.js';
|
|
|
18
18
|
*/
|
|
19
19
|
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
20
20
|
import type { NotificationSender } from '../../auth/role_grant_offer_notifications.js';
|
|
21
|
-
import { type
|
|
21
|
+
import { type RoleRegistry } from '../../auth/role_schema.js';
|
|
22
22
|
import { type SessionOptions } from '../../auth/session_cookie.js';
|
|
23
23
|
import { type RouteSpec } from '../../http/route_spec.js';
|
|
24
24
|
import type { AppSurfaceSpec, RpcEndpointSpec } from '../../http/surface.js';
|
|
@@ -39,7 +39,7 @@ export declare const spine_session_options: SessionOptions<string>;
|
|
|
39
39
|
* entry also gives the admin suite real app-role grant-path coverage
|
|
40
40
|
* (`admin_account_list.grantable_roles` carries it on both spines).
|
|
41
41
|
*/
|
|
42
|
-
export declare const spine_roles:
|
|
42
|
+
export declare const spine_roles: RoleRegistry;
|
|
43
43
|
/** Options for `spine_rpc_endpoints`. */
|
|
44
44
|
export interface SpineRpcEndpointsOptions {
|
|
45
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,
|
|
1
|
+
{"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI1F,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAgB3E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAAwC,CAAC;AAElG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,YAGxB,CAAC;AAEH,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC/B,KAAK,gBAAgB,EACrB,UAAU,wBAAwB,KAChC,KAAK,CAAC,eAAe,CAQvB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,SAAS,CAgC/E,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,KAAG,SAC+B,CAAC;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAO,cAS1C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { create_account_route_specs } from '../../auth/account_routes.js';
|
|
3
3
|
import { create_audit_log_route_specs } from '../../auth/audit_log_routes.js';
|
|
4
|
-
import {
|
|
4
|
+
import { create_role_registry } from '../../auth/role_schema.js';
|
|
5
5
|
import { GRANT_PATH_ADMIN } from '../../auth/grant_path_schema.js';
|
|
6
6
|
import { create_session_config } from '../../auth/session_cookie.js';
|
|
7
7
|
import { create_signup_route_specs } from '../../auth/signup_routes.js';
|
|
@@ -31,7 +31,7 @@ export const spine_session_options = create_session_config('fuz_session');
|
|
|
31
31
|
* entry also gives the admin suite real app-role grant-path coverage
|
|
32
32
|
* (`admin_account_list.grantable_roles` carries it on both spines).
|
|
33
33
|
*/
|
|
34
|
-
export const spine_roles =
|
|
34
|
+
export const spine_roles = create_role_registry([
|
|
35
35
|
{ name: SPINE_CELL_EDITOR_ROLE, grant_paths: [] },
|
|
36
36
|
{ name: SPINE_PARTICIPANT_ROLE, grant_paths: [GRANT_PATH_ADMIN] }
|
|
37
37
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"identity_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA0H9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyB5C,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAsKD,eAAO,MAAM,oCAAoC,GAChD,SAAS,8BAA8B,KACrC,IAygBF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
/**
|
|
3
3
|
* Cross-backend identity-primitive parity for fuz_app's own spine over real
|
|
4
|
-
* HTTP — the
|
|
4
|
+
* HTTP — the identity primitives (`Username`, `UsernameProvided`,
|
|
5
5
|
* `Email`) and the login/signup input handling that enforces them, pinned
|
|
6
6
|
* facet-by-facet so a TS↔Rust divergence in any one surfaces as a failure:
|
|
7
7
|
* how usernames are **canonicalized** on the login lookup, the **ASCII-only
|
|
@@ -67,12 +67,16 @@ import '../assert_dev_env.js';
|
|
|
67
67
|
* spine with `open_signup` at its `false` default), and each format violation
|
|
68
68
|
* (leading non-letter, trailing punctuation, embedded disallowed char) → 400,
|
|
69
69
|
* with mid-string `_`/`-` accepted siblings as the don't-over-reject control.
|
|
70
|
-
* Signup is also strict-object on both spines (TS `
|
|
70
|
+
* Signup is also strict-object on both spines (TS a strict fuz_schema `object`, Rust
|
|
71
71
|
* `#[serde(deny_unknown_fields)]`), so an unknown signup body key → 400.
|
|
72
72
|
* Nothing trims a creation username: a padded one is refused 400 at signup and
|
|
73
73
|
* at bootstrap, never trimmed into a legal name. Bootstrap validates its body
|
|
74
74
|
* before its window check, so the padded bootstrap answers 400 even after
|
|
75
|
-
* bootstrap completed.
|
|
75
|
+
* bootstrap completed. Its `token` is bounded the same way: past
|
|
76
|
+
* `BOOTSTRAP_TOKEN_LENGTH_MAX` UTF-16 code units it is 400, at the cap it
|
|
77
|
+
* reaches the closed window's 403, with a two-byte and an astral token at
|
|
78
|
+
* each side so the spines count the same unit — neither bytes nor scalar
|
|
79
|
+
* values.
|
|
76
80
|
*
|
|
77
81
|
* **Email format (creation):** the optional signup `email` is validated to a
|
|
78
82
|
* loose `local@domain.tld` shape on both spines — TS `Email` (`EMAIL_REGEX`:
|
|
@@ -104,6 +108,7 @@ import '../assert_dev_env.js';
|
|
|
104
108
|
*/
|
|
105
109
|
import { describe, test, assert } from 'vitest';
|
|
106
110
|
import { ERROR_ALREADY_BOOTSTRAPPED, ERROR_AUTHENTICATION_REQUIRED, ERROR_INVALID_CREDENTIALS, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY, ERROR_NO_MATCHING_INVITE } from '../../http/error_schemas.js';
|
|
111
|
+
import { BOOTSTRAP_TOKEN_LENGTH_MAX } from '../../auth/bootstrap_route_schema.js';
|
|
107
112
|
import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
|
|
108
113
|
import { test_if } from './capabilities.js';
|
|
109
114
|
import { SPINE_ACCOUNT_BOOTSTRAP_PATH, SPINE_ACCOUNT_LOGIN_PATH, SPINE_ACCOUNT_PASSWORD_PATH, SPINE_ACCOUNT_SIGNUP_PATH } from './spine_surface_constants.js';
|
|
@@ -431,9 +436,9 @@ export const describe_identity_parity_cross_tests = (options) => {
|
|
|
431
436
|
});
|
|
432
437
|
describe('login input validation parity', () => {
|
|
433
438
|
// Malformed login input → 400 `invalid_request_body` on every spine. TS
|
|
434
|
-
// runs the full `LoginInput`
|
|
439
|
+
// runs the full `LoginInput` schema (`UsernameProvided` non-empty /
|
|
435
440
|
// max 255 / non-empty-after-trim, `PasswordProvided` non-empty / max 300,
|
|
436
|
-
// `
|
|
441
|
+
// a strict `object`); the Rust spine enforces the same shape in
|
|
437
442
|
// `account_login` (an extra key fails `deny_unknown_fields` → 400, not
|
|
438
443
|
// axum's 422). These each previously fell through to a lookup-miss 401 (or
|
|
439
444
|
// a bespoke-string 400) on one backend — a status *and* body divergence the
|
|
@@ -505,7 +510,7 @@ export const describe_identity_parity_cross_tests = (options) => {
|
|
|
505
510
|
});
|
|
506
511
|
});
|
|
507
512
|
describe('signup input validation parity', () => {
|
|
508
|
-
// Signup is `
|
|
513
|
+
// Signup is a strict fuz_schema `object` on TS and `#[serde(deny_unknown_fields)]` on
|
|
509
514
|
// the Rust spine — an unknown body key → 400 `invalid_request_body` on
|
|
510
515
|
// both (the Rust spine previously ignored it via serde). The username is
|
|
511
516
|
// valid so the rejection isolates the unknown key (a valid body would
|
|
@@ -553,6 +558,34 @@ export const describe_identity_parity_cross_tests = (options) => {
|
|
|
553
558
|
});
|
|
554
559
|
assert.deepStrictEqual(control, { status: 403, error: ERROR_ALREADY_BOOTSTRAPPED }, 'bootstrap unpadded control');
|
|
555
560
|
});
|
|
561
|
+
// The token's maximum is UTF-16 code units on every spine: a two-byte
|
|
562
|
+
// token at the cap is twice the cap in bytes and still reaches the closed
|
|
563
|
+
// window, and an astral one is half the cap in scalar values and refused
|
|
564
|
+
// one character past it.
|
|
565
|
+
test_if(bootstrap_path !== null, 'a token past its maximum in code units → 400, ahead of the window check', async () => {
|
|
566
|
+
const fixture = await setup_test();
|
|
567
|
+
const astral = '\u{1F600}';
|
|
568
|
+
const attempt = (token) => post_json(fixture, bootstrap_path, {
|
|
569
|
+
token,
|
|
570
|
+
username: 'token_length_keeper',
|
|
571
|
+
password: DEFAULT_TEST_PASSWORD
|
|
572
|
+
});
|
|
573
|
+
for (const token of [
|
|
574
|
+
'x'.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX),
|
|
575
|
+
'\u00e9'.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX),
|
|
576
|
+
astral.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX / 2)
|
|
577
|
+
]) {
|
|
578
|
+
assert.deepStrictEqual(await attempt(token), { status: 403, error: ERROR_ALREADY_BOOTSTRAPPED }, `a ${token.length}-unit token passes validation`);
|
|
579
|
+
}
|
|
580
|
+
for (const token of [
|
|
581
|
+
'x'.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX + 1),
|
|
582
|
+
'\u00e9'.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX + 1),
|
|
583
|
+
astral.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX / 2) + 'a',
|
|
584
|
+
astral.repeat(BOOTSTRAP_TOKEN_LENGTH_MAX / 2 + 1)
|
|
585
|
+
]) {
|
|
586
|
+
assert_attempt(await attempt(token), 400, `a ${token.length}-unit token`);
|
|
587
|
+
}
|
|
588
|
+
});
|
|
556
589
|
});
|
|
557
590
|
describe('malformed JSON body parity', () => {
|
|
558
591
|
// A body typed `application/json` that doesn't parse, or parses to
|
|
@@ -22,7 +22,7 @@ import '../assert_dev_env.js';
|
|
|
22
22
|
*/
|
|
23
23
|
import type { RpcAction } from '../../actions/action_types.js';
|
|
24
24
|
import type { ActionSpecUnion } from '../../actions/action_spec.js';
|
|
25
|
-
import type {
|
|
25
|
+
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
26
26
|
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
27
27
|
import type { AppSurfaceSpec, RpcEndpointSpec } from '../../http/surface.js';
|
|
28
28
|
import type { AppServerContext } from '../../server/app_server_context.js';
|
|
@@ -49,8 +49,8 @@ export interface RustSpineConsumerRpcEndpointsOptions {
|
|
|
49
49
|
* `create_self_service_role_actions`), built against the stub context.
|
|
50
50
|
*/
|
|
51
51
|
readonly extra_rpc_actions?: (ctx: AppServerContext) => Array<RpcAction>;
|
|
52
|
-
/** The consumer's role
|
|
53
|
-
readonly roles?:
|
|
52
|
+
/** The consumer's role registry, for the standard admin and role-grant-offer actions. */
|
|
53
|
+
readonly roles?: RoleRegistry;
|
|
54
54
|
/**
|
|
55
55
|
* Domain methods kept off the declared surface — ones the spec-derived
|
|
56
56
|
* suites can't drive (an input whose `.refine()` the generic body generator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rust_spine_consumer_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/rust_spine_consumer_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAM/F,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"rust_spine_consumer_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/rust_spine_consumer_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,8BAA8B,CAAC;AAM/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAMnE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAI3E;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,wDAAyD,CAAC;AAU3F,8DAA8D;AAC9D,MAAM,WAAW,oCAAoC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC7D;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IACzE,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,6DAA6D;AAC7D,MAAM,WAAW,mCAAoC,SAAQ,oCAAoC;IAChG,gEAAgE;IAChE,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACjD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wCAAwC,GACpD,SAAS,oCAAoC,KAC3C,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,eAAe,CAAC,CA+BpD,CAAC;AAiCF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uCAAuC,GACnD,SAAS,mCAAmC,KAC1C,cAeA,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { Uuid } from '../../
|
|
2
|
+
import { Uuid } from '../../primitive_schemas_fuz.js';
|
|
3
3
|
import type { TestAccount } from '../app_server.js';
|
|
4
4
|
import type { BackendCapabilities } from './capabilities.js';
|
|
5
5
|
import { type FetchTransport } from '../transports/fetch_transport.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6B9B,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAKtD,OAAO,KAAK,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ACrG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsFD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,GACnC,QAAQ,sCAAsC,EAC9C,UAAS;IAAE,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAO,KACtD,OAAO,CAAC,cAAc,CAcxB,CAAC;AA8BF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,QAAQ,sCAAsC,KAC5C,OAAO,CAAC,cAAc,CAC8C,CAAC;AAExE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GACrC,QAAQ,sCAAsC,KAC5C,OAAO,CAAC,gBAAgB,CACgD,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAoVlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,sCAAsC,EAC9C,UAAU,wBAAwB,KAChC,SAsIF,CAAC"}
|
|
@@ -22,7 +22,10 @@ import '../assert_dev_env.js';
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
import { z } from 'zod';
|
|
25
|
-
import {
|
|
25
|
+
import { array, literal, parse, string, strip_object } from '@fuzdev/fuz_schema/schema.ts';
|
|
26
|
+
import { USERNAME_LENGTH_MAX } from '../../primitive_schemas.js';
|
|
27
|
+
import { Uuid } from '../../primitive_schemas_fuz.js';
|
|
28
|
+
import { format_issues } from '../../schema_issues.js';
|
|
26
29
|
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
27
30
|
import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
|
|
28
31
|
import { create_fetch_transport } from '../transports/fetch_transport.js';
|
|
@@ -98,18 +101,18 @@ export const reconstruct_bootstrapped_handle = (serialized) => ({
|
|
|
98
101
|
});
|
|
99
102
|
/**
|
|
100
103
|
* Structural subset of `SignupOutput` the runner cares about. Looser
|
|
101
|
-
* than the canonical `auth/
|
|
104
|
+
* than the canonical `auth/signup_route_schema.ts` schema — kept local so this
|
|
102
105
|
* module doesn't pull the full auth-domain schema into its dep graph.
|
|
103
106
|
*/
|
|
104
|
-
const SignupResponseShape =
|
|
105
|
-
ok:
|
|
106
|
-
account:
|
|
107
|
-
actor:
|
|
107
|
+
const SignupResponseShape = strip_object({
|
|
108
|
+
ok: literal(true),
|
|
109
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
110
|
+
actor: strip_object({ id: Uuid })
|
|
108
111
|
});
|
|
109
112
|
/** Structural subset of `account_token_create`'s output. */
|
|
110
|
-
const TokenCreateResponseShape =
|
|
111
|
-
token:
|
|
112
|
-
id:
|
|
113
|
+
const TokenCreateResponseShape = strip_object({
|
|
114
|
+
token: string,
|
|
115
|
+
id: string
|
|
113
116
|
});
|
|
114
117
|
/**
|
|
115
118
|
* Per-test username generator for the *default* `fixture.create_account()`
|
|
@@ -231,20 +234,20 @@ export const capture_migration_tracker = async (handle) => capture_via_daemon(ha
|
|
|
231
234
|
*/
|
|
232
235
|
export const EXPIRED_SESSION_OFFSET_SECONDS = -60;
|
|
233
236
|
/** Structural subset of `_testing_mint_session`'s output. */
|
|
234
|
-
const MintSessionResponseShape =
|
|
237
|
+
const MintSessionResponseShape = strip_object({ session_cookie: string });
|
|
235
238
|
/** Structural subset of `_testing_reset`'s output. */
|
|
236
|
-
const TestingResetResponseShape =
|
|
237
|
-
account:
|
|
238
|
-
actor:
|
|
239
|
-
api_token:
|
|
240
|
-
session_cookie:
|
|
241
|
-
extra_accounts:
|
|
242
|
-
account:
|
|
243
|
-
actor:
|
|
244
|
-
api_token:
|
|
245
|
-
session_cookie:
|
|
239
|
+
const TestingResetResponseShape = strip_object({
|
|
240
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
241
|
+
actor: strip_object({ id: Uuid }),
|
|
242
|
+
api_token: string,
|
|
243
|
+
session_cookie: string,
|
|
244
|
+
extra_accounts: array(strip_object({
|
|
245
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
246
|
+
actor: strip_object({ id: Uuid }),
|
|
247
|
+
api_token: string,
|
|
248
|
+
session_cookie: string
|
|
246
249
|
})),
|
|
247
|
-
extra_actors:
|
|
250
|
+
extra_actors: array(strip_object({ id: Uuid, name: string }))
|
|
248
251
|
});
|
|
249
252
|
/**
|
|
250
253
|
* Fire the `_testing_reset` RPC action over the keeper's daemon-token
|
|
@@ -263,19 +266,19 @@ const fire_testing_reset = async (handle, options) => {
|
|
|
263
266
|
})),
|
|
264
267
|
extra_actors: [...(options.extra_actors ?? [])]
|
|
265
268
|
}, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token });
|
|
266
|
-
const parsed = TestingResetResponseShape
|
|
267
|
-
if (!parsed.
|
|
268
|
-
throw new Error(`_testing_reset(${handle.config.name}) returned unexpected result: ${JSON.stringify(raw)} (${parsed.
|
|
269
|
+
const parsed = parse(TestingResetResponseShape, raw);
|
|
270
|
+
if (!parsed.ok) {
|
|
271
|
+
throw new Error(`_testing_reset(${handle.config.name}) returned unexpected result: ${JSON.stringify(raw)} (${format_issues(parsed.issues)})`);
|
|
269
272
|
}
|
|
270
273
|
return {
|
|
271
274
|
keeper: {
|
|
272
|
-
account: parsed.
|
|
273
|
-
actor: parsed.
|
|
274
|
-
api_token: parsed.
|
|
275
|
-
session_cookie: parsed.
|
|
275
|
+
account: parsed.value.account,
|
|
276
|
+
actor: parsed.value.actor,
|
|
277
|
+
api_token: parsed.value.api_token,
|
|
278
|
+
session_cookie: parsed.value.session_cookie
|
|
276
279
|
},
|
|
277
|
-
extra_accounts: parsed.
|
|
278
|
-
extra_actors: parsed.
|
|
280
|
+
extra_accounts: parsed.value.extra_accounts,
|
|
281
|
+
extra_actors: parsed.value.extra_actors
|
|
279
282
|
};
|
|
280
283
|
};
|
|
281
284
|
/**
|
|
@@ -361,9 +364,9 @@ const mint_account = async (handle, options) => {
|
|
|
361
364
|
throw new Error(`signup(${handle.config.name}) failed: status=${signup_response.status} body=${body}`);
|
|
362
365
|
}
|
|
363
366
|
const signup_raw = await signup_response.json();
|
|
364
|
-
const parsed = SignupResponseShape
|
|
365
|
-
if (!parsed.
|
|
366
|
-
throw new Error(`signup(${handle.config.name}) returned unexpected body: ${JSON.stringify(signup_raw)} (${parsed.
|
|
367
|
+
const parsed = parse(SignupResponseShape, signup_raw);
|
|
368
|
+
if (!parsed.ok) {
|
|
369
|
+
throw new Error(`signup(${handle.config.name}) returned unexpected body: ${JSON.stringify(signup_raw)} (${format_issues(parsed.issues)})`);
|
|
367
370
|
}
|
|
368
371
|
const login_response = await transport(options.login_path, {
|
|
369
372
|
method: 'POST',
|
|
@@ -382,16 +385,16 @@ const mint_account = async (handle, options) => {
|
|
|
382
385
|
// ordinary account credential, so it takes full account authority; the
|
|
383
386
|
// narrowed credential is the conformance table's `scoped_token` principal.
|
|
384
387
|
const token_result = await rpc_via_transport(transport, handle.config.rpc_path, 'account_token_create', { scope: { kind: 'full' }, lifetime: { kind: 'eternal' } }, handle.config.name);
|
|
385
|
-
const token_parsed = TokenCreateResponseShape
|
|
386
|
-
if (!token_parsed.
|
|
388
|
+
const token_parsed = parse(TokenCreateResponseShape, token_result);
|
|
389
|
+
if (!token_parsed.ok) {
|
|
387
390
|
throw new Error(`account_token_create(${handle.config.name}) returned unexpected result: ${JSON.stringify(token_result)}`);
|
|
388
391
|
}
|
|
389
392
|
return {
|
|
390
393
|
transport,
|
|
391
|
-
account: parsed.
|
|
392
|
-
actor: parsed.
|
|
394
|
+
account: parsed.value.account,
|
|
395
|
+
actor: parsed.value.actor,
|
|
393
396
|
session_cookie: extract_cookie_value(transport, handle.config.cookie_name, handle.config.name),
|
|
394
|
-
api_token: token_parsed.
|
|
397
|
+
api_token: token_parsed.value.token
|
|
395
398
|
};
|
|
396
399
|
};
|
|
397
400
|
/**
|
|
@@ -562,12 +565,12 @@ export const default_cross_process_setup = (handle, options) => {
|
|
|
562
565
|
// cookie server-side over the keeper's daemon-token channel.
|
|
563
566
|
mint_expired_session: async () => {
|
|
564
567
|
const raw = await rpc_via_transport(refreshed_handle.keeper_daemon_transport, handle.config.rpc_path, '_testing_mint_session', { account_id: keeper.account.id, expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS }, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token });
|
|
565
|
-
const parsed = MintSessionResponseShape
|
|
566
|
-
if (!parsed.
|
|
568
|
+
const parsed = parse(MintSessionResponseShape, raw);
|
|
569
|
+
if (!parsed.ok) {
|
|
567
570
|
throw new Error(`_testing_mint_session(${handle.config.name}) returned unexpected result: ` +
|
|
568
|
-
`${JSON.stringify(raw)} (${parsed.
|
|
571
|
+
`${JSON.stringify(raw)} (${format_issues(parsed.issues)})`);
|
|
569
572
|
}
|
|
570
|
-
return `${cookie_name}=${parsed.
|
|
573
|
+
return `${cookie_name}=${parsed.value.session_cookie}`;
|
|
571
574
|
}
|
|
572
575
|
};
|
|
573
576
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RoleRegistry } from '../../auth/role_schema.js';
|
|
3
3
|
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
4
4
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
5
5
|
import { type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
@@ -189,8 +189,8 @@ export interface SpineCrossSuitesOptions {
|
|
|
189
189
|
* still runs once, from the declared surface.
|
|
190
190
|
*/
|
|
191
191
|
readonly live_rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
192
|
-
/** The backend's role
|
|
193
|
-
readonly roles?:
|
|
192
|
+
/** The backend's role registry; given, the standard bundle runs its admin suite. */
|
|
193
|
+
readonly roles?: RoleRegistry;
|
|
194
194
|
/**
|
|
195
195
|
* Setup options every suite's `setup_test` starts from — a signup path the
|
|
196
196
|
* backend mounts elsewhere, `reject_unknown_audit_metadata_keys` for a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwF9B,OAAO,EAA2B,KAAK,
|
|
1
|
+
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwF9B,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAmC,KAAK,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAEN,KAAK,gCAAgC,EACrC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,KAAK,2BAA2B,EAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,KAAK,2BAA2B,EAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAkC,KAAK,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAEN,KAAK,iCAAiC,EACtC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAIN,KAAK,6BAA6B,EAClC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAEN,KAAK,gCAAgC,EACrC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,KAAK,kCAAkC,EACvC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEN,KAAK,0CAA0C,EAC/C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEN,KAAK,2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,MAAM,CAAC,CAAC;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpE;AAwbD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,MAAM,SAAS,KAAG,aAAa,CAAC,qBAAqB,CAC3D,CAAC;AAkLrC,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AAiCD;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,GACvC,eAAe,mBAAmB,EAClC,WAAW,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,KACpD,IAgBF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,8BAA8B,GAC1C,eAAe,mBAAmB,EAClC,QAAQ,aAAa,CAAC,cAAc,CAAC,KACnC,IAiCF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,sCAAsC,EAC9C,SAAS,uBAAuB,KAC9B,IAoCF,CAAC"}
|
|
@@ -14,7 +14,7 @@ import '../assert_dev_env.js';
|
|
|
14
14
|
* - `describe_data_exposure_tests`
|
|
15
15
|
*
|
|
16
16
|
* **Gated on `roles`** — included when the consumer supplies a
|
|
17
|
-
* `
|
|
17
|
+
* `RoleRegistry`:
|
|
18
18
|
*
|
|
19
19
|
* - `describe_standard_admin_integration_tests`
|
|
20
20
|
*
|
|
@@ -34,7 +34,7 @@ import '../assert_dev_env.js';
|
|
|
34
34
|
* @module
|
|
35
35
|
*/
|
|
36
36
|
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
37
|
-
import type {
|
|
37
|
+
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
38
38
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
39
39
|
import { type RpcSuccessFixtures } from '../rpc_round_trip.js';
|
|
40
40
|
import type { RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
@@ -70,10 +70,10 @@ export interface StandardCrossProcessTestOptions {
|
|
|
70
70
|
*/
|
|
71
71
|
rpc_endpoints: RpcEndpointsSuiteOption;
|
|
72
72
|
/**
|
|
73
|
-
* Role
|
|
73
|
+
* Role registry from `create_role_registry()`.
|
|
74
74
|
* When provided, the admin integration suite is included.
|
|
75
75
|
*/
|
|
76
|
-
roles?:
|
|
76
|
+
roles?: RoleRegistry;
|
|
77
77
|
/**
|
|
78
78
|
* Path prefix where admin routes are mounted.
|
|
79
79
|
* Default `'/api/admin'`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE9F,OAAO,KAAK,EAAE,uB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C;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,+BAA+B,KACtC,IAuCF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/token_lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/token_lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4E9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC7C,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAsBD,eAAO,MAAM,mCAAmC,GAC/C,SAAS,6BAA6B,KACpC,IAmVF,CAAC"}
|
|
@@ -32,6 +32,15 @@ import '../assert_dev_env.js';
|
|
|
32
32
|
* mints and reads back whole, and one unit past it is `invalid_params`,
|
|
33
33
|
* with an astral-plane name at each side of the boundary so the two spines
|
|
34
34
|
* count the same unit.
|
|
35
|
+
* - **The scope cap** — `MAX_TOKEN_SCOPE_BYTES` counts UTF-8 bytes of the
|
|
36
|
+
* compact document on both spines, at mint and at read: a two-byte scope at
|
|
37
|
+
* the cap mints, authenticates as a bearer for a method it lists, and lists
|
|
38
|
+
* as `N methods`, though Postgres prints it past the cap, and so does an
|
|
39
|
+
* ASCII scope under the cap whose printed text is past it; one byte past the
|
|
40
|
+
* cap, far under it in UTF-16 code units, is `invalid_params` with
|
|
41
|
+
* `ERROR_TOKEN_SCOPE_INVALID`. A spine counting code units mints the one
|
|
42
|
+
* past the cap, and one measuring the printed `scope::text` fails the
|
|
43
|
+
* others closed — `unreadable` in the list, an anonymous bearer.
|
|
35
44
|
* - **A token sent beside a winning daemon token is never used** — the
|
|
36
45
|
* credential legs run daemon token → session cookie → bearer on both
|
|
37
46
|
* spines, the first that authenticates winning, so a request carrying the
|
|
@@ -49,7 +58,9 @@ import '../assert_dev_env.js';
|
|
|
49
58
|
* @module
|
|
50
59
|
*/
|
|
51
60
|
import { describe, test, assert } from 'vitest';
|
|
52
|
-
import { account_token_create_action_spec, account_token_list_action_spec, API_TOKEN_NAME_LENGTH_MAX, TokenCreateOutput, TokenListOutput } from '../../auth/account_action_specs.js';
|
|
61
|
+
import { account_token_create_action_spec, account_token_list_action_spec, API_TOKEN_NAME_LENGTH_MAX, ERROR_TOKEN_SCOPE_INVALID, TokenCreateOutput, TokenListOutput } from '../../auth/account_action_specs.js';
|
|
62
|
+
import { MAX_TOKEN_SCOPE_BYTES } from '../../auth/token_scope.js';
|
|
63
|
+
import { token_scope_methods_at_bytes } from '../token_scope_fixtures.js';
|
|
53
64
|
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
54
65
|
import { cross_rpc_call, error_reason, expect_output } from './cross_rpc.js';
|
|
55
66
|
import { assert_iso8601_seconds } from './wire_shapes.js';
|
|
@@ -111,6 +122,28 @@ export const describe_token_lifetime_cross_tests = (options) => {
|
|
|
111
122
|
assert.ok(row, 'the minted token must appear in account_token_list');
|
|
112
123
|
assert.strictEqual(row.expires_at, null, 'the stored token must be eternal');
|
|
113
124
|
});
|
|
125
|
+
test('the scope cap counts compact UTF-8 bytes at mint and at read', async () => {
|
|
126
|
+
const fixture = await setup_test();
|
|
127
|
+
const two_byte = '\u00e9'.repeat(40);
|
|
128
|
+
const mint = (name, methods) => cross_rpc_call(fixture.transport, rpc_path, account_token_create_action_spec.method, { name, scope: { kind: 'methods', methods }, lifetime: { kind: 'eternal' } }, fixture.create_session_headers());
|
|
129
|
+
const admitted = [
|
|
130
|
+
['at-cap', token_scope_methods_at_bytes(MAX_TOKEN_SCOPE_BYTES, two_byte)],
|
|
131
|
+
['spaced', token_scope_methods_at_bytes(MAX_TOKEN_SCOPE_BYTES - 50, 'm')]
|
|
132
|
+
];
|
|
133
|
+
const listed_labels = new Map();
|
|
134
|
+
for (const [name, methods] of admitted) {
|
|
135
|
+
const minted = expect_output(await mint(name, methods), TokenCreateOutput);
|
|
136
|
+
// the resolve path reads the stored scope: the token lists its account's tokens
|
|
137
|
+
const listed = expect_output(await cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, account_token_list_action_spec.method, undefined, { authorization: `Bearer ${minted.token}` }), TokenListOutput);
|
|
138
|
+
for (const t of listed.tokens)
|
|
139
|
+
listed_labels.set(t.id, t.scope);
|
|
140
|
+
assert.strictEqual(listed_labels.get(minted.id), `${methods.length} methods`, `${name}: the stored scope reads back on the list`);
|
|
141
|
+
}
|
|
142
|
+
const res = await mint('over-cap', token_scope_methods_at_bytes(MAX_TOKEN_SCOPE_BYTES + 1, two_byte));
|
|
143
|
+
assert.ok(!res.ok, 'a scope one byte past the cap must be refused');
|
|
144
|
+
assert.strictEqual(res.error?.code, -32602, JSON.stringify(res.error));
|
|
145
|
+
assert.strictEqual(error_reason(res), ERROR_TOKEN_SCOPE_INVALID);
|
|
146
|
+
});
|
|
114
147
|
test('a token sent beside a winning daemon token is never used', async () => {
|
|
115
148
|
const fixture = await setup_test();
|
|
116
149
|
/** Mint a token on the keeper over its session. */
|
|
@@ -292,7 +292,7 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
292
292
|
assert.strictEqual(res.status, 200);
|
|
293
293
|
const body = await res.json();
|
|
294
294
|
// Throws on any extra or missing field — drift on either backend fails.
|
|
295
|
-
LoginOutput
|
|
295
|
+
parse_or_throw(LoginOutput, body);
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
// --- 1b. Account status body (strict schema) ---
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The UTF-8 byte length of the compact JSON of a `methods` scope over
|
|
4
|
+
* `methods`, the unit `MAX_TOKEN_SCOPE_BYTES` counts. Method order changes the
|
|
5
|
+
* document, not its length.
|
|
6
|
+
*
|
|
7
|
+
* @param methods - the scope's method names
|
|
8
|
+
* @returns the byte length of `JSON.stringify(token_scope_methods(methods))`
|
|
9
|
+
*/
|
|
10
|
+
export declare const token_scope_methods_bytes: (methods: Array<string>) => number;
|
|
11
|
+
/**
|
|
12
|
+
* Method names whose `methods` scope document is exactly `bytes` compact UTF-8
|
|
13
|
+
* bytes: `account_token_list` (so a token over it can list its own account's
|
|
14
|
+
* tokens), names `scope_cap_<i>_<filler>` while they fit, and an ASCII pad of
|
|
15
|
+
* `x`s. A multibyte `filler` makes a document far under `bytes` in UTF-16 code
|
|
16
|
+
* units. The names hold no `:` or `,`, so the printed `jsonb` text has exactly
|
|
17
|
+
* one more byte per separator.
|
|
18
|
+
*
|
|
19
|
+
* @param bytes - the compact document's size; at least that of the first name alone
|
|
20
|
+
* @param filler - the tail of every name but the first and the pad
|
|
21
|
+
* @returns distinct method names, sorted, as the Rust spine stores them
|
|
22
|
+
*/
|
|
23
|
+
export declare const token_scope_methods_at_bytes: (bytes: number, filler: string) => Array<string>;
|
|
24
|
+
//# sourceMappingURL=token_scope_fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token_scope_fixtures.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/token_scope_fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAkB7B;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,KAAK,CAAC,MAAM,CAAC,KAAG,MACL,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,KAAK,CAAC,MAAM,CAWxF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Token-scope documents built to a size, for the tests of
|
|
4
|
+
* `MAX_TOKEN_SCOPE_BYTES` — hono-free, so the cross-process suites import it.
|
|
5
|
+
*
|
|
6
|
+
* The cap counts UTF-8 bytes of a document's compact JSON on both spines.
|
|
7
|
+
* `token_scope_methods_at_bytes` builds the method list whose `methods`
|
|
8
|
+
* document is exactly a given size, the same list the Rust spine's tests
|
|
9
|
+
* build, so a boundary pinned on one spine is the boundary on the other.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { to_bytes } from '@fuzdev/fuz_util/bytes.ts';
|
|
14
|
+
import { token_scope_methods } from '../auth/token_scope.js';
|
|
15
|
+
/**
|
|
16
|
+
* The UTF-8 byte length of the compact JSON of a `methods` scope over
|
|
17
|
+
* `methods`, the unit `MAX_TOKEN_SCOPE_BYTES` counts. Method order changes the
|
|
18
|
+
* document, not its length.
|
|
19
|
+
*
|
|
20
|
+
* @param methods - the scope's method names
|
|
21
|
+
* @returns the byte length of `JSON.stringify(token_scope_methods(methods))`
|
|
22
|
+
*/
|
|
23
|
+
export const token_scope_methods_bytes = (methods) => to_bytes(JSON.stringify(token_scope_methods(methods))).length;
|
|
24
|
+
/**
|
|
25
|
+
* Method names whose `methods` scope document is exactly `bytes` compact UTF-8
|
|
26
|
+
* bytes: `account_token_list` (so a token over it can list its own account's
|
|
27
|
+
* tokens), names `scope_cap_<i>_<filler>` while they fit, and an ASCII pad of
|
|
28
|
+
* `x`s. A multibyte `filler` makes a document far under `bytes` in UTF-16 code
|
|
29
|
+
* units. The names hold no `:` or `,`, so the printed `jsonb` text has exactly
|
|
30
|
+
* one more byte per separator.
|
|
31
|
+
*
|
|
32
|
+
* @param bytes - the compact document's size; at least that of the first name alone
|
|
33
|
+
* @param filler - the tail of every name but the first and the pad
|
|
34
|
+
* @returns distinct method names, sorted, as the Rust spine stores them
|
|
35
|
+
*/
|
|
36
|
+
export const token_scope_methods_at_bytes = (bytes, filler) => {
|
|
37
|
+
const methods = ['account_token_list'];
|
|
38
|
+
for (let i = 0;; i++) {
|
|
39
|
+
const next = `scope_cap_${String(i).padStart(3, '0')}_${filler}`;
|
|
40
|
+
if (token_scope_methods_bytes([...methods, next, '']) > bytes)
|
|
41
|
+
break;
|
|
42
|
+
methods.push(next);
|
|
43
|
+
}
|
|
44
|
+
const pad = bytes - token_scope_methods_bytes([...methods, '']);
|
|
45
|
+
if (pad < 0)
|
|
46
|
+
throw new Error(`no methods document is ${bytes} bytes`);
|
|
47
|
+
methods.push('x'.repeat(pad));
|
|
48
|
+
return methods;
|
|
49
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { Uuid } from '../../
|
|
2
|
+
import { Uuid } from '../../primitive_schemas_fuz.js';
|
|
3
3
|
import type { BackendConfig } from '../cross_backend/backend_config.js';
|
|
4
4
|
import type { FetchTransport } from './fetch_transport.js';
|
|
5
5
|
/** Input for `bootstrap()`. */
|