@fuzdev/fuz_app 0.141.0 → 0.143.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +10 -5
- package/dist/actions/connection_closer.d.ts +19 -2
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +25 -2
- package/dist/actions/perform_action.d.ts +10 -0
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +23 -9
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +5 -2
- package/dist/auth/CLAUDE.md +33 -13
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +12 -1
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +8 -0
- package/dist/auth/account_routes.d.ts +7 -2
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +240 -187
- package/dist/auth/admin_action_specs.d.ts +6 -1
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +6 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +14 -2
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +85 -76
- package/dist/auth/cell_action_specs.d.ts +7 -3
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +9 -5
- package/dist/auth/cell_actions.d.ts +3 -3
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +67 -38
- package/dist/auth/cell_authorize.d.ts +69 -8
- package/dist/auth/cell_authorize.d.ts.map +1 -1
- package/dist/auth/cell_authorize.js +89 -9
- package/dist/auth/cell_field_action_specs.d.ts +5 -4
- package/dist/auth/cell_field_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_field_action_specs.js +7 -7
- package/dist/auth/cell_field_actions.d.ts +7 -5
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +24 -22
- package/dist/auth/cell_grant_action_specs.d.ts +6 -0
- package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_grant_action_specs.js +6 -0
- package/dist/auth/cell_grant_actions.d.ts +3 -1
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +16 -2
- package/dist/auth/cell_item_action_specs.d.ts +5 -4
- package/dist/auth/cell_item_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_item_action_specs.js +7 -7
- package/dist/auth/cell_item_actions.d.ts +6 -5
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +23 -22
- package/dist/auth/cell_relation_list_limit.d.ts +20 -0
- package/dist/auth/cell_relation_list_limit.d.ts.map +1 -0
- package/dist/auth/cell_relation_list_limit.js +27 -0
- package/dist/auth/cell_relation_visibility.d.ts +4 -3
- package/dist/auth/cell_relation_visibility.d.ts.map +1 -1
- package/dist/auth/cell_relation_visibility.js +6 -5
- package/dist/auth/cell_steward.d.ts +45 -0
- package/dist/auth/cell_steward.d.ts.map +1 -0
- package/dist/auth/cell_steward.js +53 -0
- package/dist/auth/request_context.d.ts +4 -0
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +6 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +5 -0
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +6 -1
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +23 -16
- package/dist/auth/role_grant_offer_queries.d.ts +8 -6
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +16 -8
- package/dist/auth/signup_routes.d.ts +4 -3
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +157 -134
- package/dist/auth/token_scope.d.ts +7 -1
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +8 -2
- package/dist/db/CLAUDE.md +32 -19
- package/dist/db/cell_ddl.d.ts +1 -2
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +1 -2
- package/dist/db/cell_field_queries.d.ts +20 -18
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +28 -22
- package/dist/db/cell_item_queries.d.ts +20 -14
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +28 -18
- package/dist/db/cell_moderation.d.ts +67 -0
- package/dist/db/cell_moderation.d.ts.map +1 -0
- package/dist/db/cell_moderation.js +66 -0
- package/dist/db/cell_queries.d.ts +44 -14
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +68 -45
- package/dist/db/cell_view_sql.d.ts +102 -0
- package/dist/db/cell_view_sql.d.ts.map +1 -0
- package/dist/db/cell_view_sql.js +112 -0
- package/dist/db/db_pg.d.ts +1 -1
- package/dist/db/db_pg.js +1 -1
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/auth_shape.d.ts +5 -2
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +5 -2
- package/dist/http/ip_canonical.d.ts +56 -5
- package/dist/http/ip_canonical.d.ts.map +1 -1
- package/dist/http/ip_canonical.js +147 -35
- package/dist/primitive_schemas.d.ts +10 -1
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +11 -2
- package/dist/rate_limiter.d.ts +179 -12
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +352 -42
- package/dist/server/serve_fact_route.d.ts +8 -4
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +15 -6
- package/dist/testing/CLAUDE.md +16 -7
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +37 -2
- package/dist/testing/cross_backend/cell_gated_create.d.ts +38 -0
- package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.js +401 -5
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +145 -2
- package/dist/testing/cross_backend/expected_schema.json +0 -1
- package/dist/testing/cross_backend/full_spine_mount.js +2 -1
- package/dist/testing/cross_backend/login_security.d.ts +16 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +154 -0
- package/dist/testing/cross_backend/origin_conformance.d.ts +1 -1
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_conformance.js +1 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +24 -2
- package/dist/testing/cross_backend/role_grant_participation.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_participation.js +64 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +13 -21
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +13 -21
- package/dist/testing/cross_backend/testing_origin_check.d.ts +128 -0
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_origin_check.js +87 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +7 -119
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +8 -92
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +21 -1
- package/dist/testing/schema_introspect.js +1 -1
- package/dist/testing/schema_parity.d.ts +4 -3
- package/dist/testing/schema_parity.d.ts.map +1 -1
- package/dist/testing/schema_parity.js +4 -3
- package/dist/testing/schema_ready_fixture.d.ts +2 -4
- package/dist/testing/schema_ready_fixture.d.ts.map +1 -1
- package/dist/testing/schema_ready_fixture.js +2 -4
- package/dist/ui/auth_state.svelte.d.ts +10 -0
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +22 -4
- package/package.json +1 -1
- package/dist/db/cell_history_ddl.d.ts +0 -38
- package/dist/db/cell_history_ddl.d.ts.map +0 -1
- package/dist/db/cell_history_ddl.js +0 -61
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* its eager `account_routes.ts` / `signup_routes.ts` imports — and through them
|
|
11
|
-
* `session_middleware` → `hono/cookie` — onto a backend-spawning consumer with
|
|
12
|
-
* no `hono` peer installed (a Rust-only spine consumer). Keeping these constants
|
|
13
|
-
* on this handler-free leaf lets such a consumer import the path without the
|
|
14
|
-
* peer. `default_spine_surface.ts` imports the ones it uses from here.
|
|
15
|
-
*
|
|
16
|
-
* The env-var names live here so both sides of each contract share one
|
|
17
|
-
* constant: the backend configs that set them (`default_backend_configs.ts`,
|
|
18
|
-
* `ts_spine_backend_config.ts`, `rust_spine_stub_backend_config.ts`) and the
|
|
19
|
-
* spawned TS spine binary that reads them, which imports this leaf rather than
|
|
20
|
-
* the config builders.
|
|
21
|
-
*
|
|
22
|
-
* @module
|
|
3
|
+
* Shared `auth` axis for every `_testing_*` action: keeper-only via the
|
|
4
|
+
* daemon-token credential, no acting actor. This is the entire structural
|
|
5
|
+
* fence on the backdoor surface (these actions run direct DB writes the
|
|
6
|
+
* production wire never exposes), so every `_testing_*` spec references this
|
|
7
|
+
* one const rather than re-declaring it — a single source of truth the gate test
|
|
8
|
+
* (`testing_actions_auth.test.ts`) pins. Mirrors the Rust `DAEMON_TOKEN_ONLY`
|
|
9
|
+
* / shared `AuthSpec` in `fuz_testing`.
|
|
23
10
|
*/
|
|
11
|
+
export declare const TESTING_ACTION_AUTH: {
|
|
12
|
+
readonly account: "required";
|
|
13
|
+
readonly actor: "none";
|
|
14
|
+
readonly credential_types: readonly ["daemon_token"];
|
|
15
|
+
};
|
|
24
16
|
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
25
17
|
export declare const SPINE_RPC_PATH = "/api/rpc";
|
|
26
18
|
/**
|
|
@@ -72,7 +64,7 @@ export declare const SPINE_ROLE_GATED_WS_PATH = "/api/gated/ws";
|
|
|
72
64
|
export declare const SPINE_ROLE_GATED_WS_ROLES: ReadonlyArray<string>;
|
|
73
65
|
/**
|
|
74
66
|
* Committed expected-schema fixture for the spine `/ready` deploy gate — the
|
|
75
|
-
* column map a fresh full spine bootstrap (auth + cell +
|
|
67
|
+
* column map a fresh full spine bootstrap (auth + cell + fact)
|
|
76
68
|
* produces. Resolved relative to this module so the spawned TS binary (which
|
|
77
69
|
* imports this source under its loader) reads it off disk via `node:fs`.
|
|
78
70
|
* Regenerated + guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine_surface_constants.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_surface_constants.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"spine_surface_constants.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_surface_constants.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;;;;CAIF,CAAC;AAE/B,iEAAiE;AACjE,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,MAAM,CAG1D,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,EAAE,GAAwD,CAAC;AAEjG;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,iCAAiC,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,uCAAuC,CAAC;AAEvF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6BAA6B,CAAC"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* its eager `account_routes.ts` / `signup_routes.ts` imports — and through them
|
|
11
|
-
* `session_middleware` → `hono/cookie` — onto a backend-spawning consumer with
|
|
12
|
-
* no `hono` peer installed (a Rust-only spine consumer). Keeping these constants
|
|
13
|
-
* on this handler-free leaf lets such a consumer import the path without the
|
|
14
|
-
* peer. `default_spine_surface.ts` imports the ones it uses from here.
|
|
15
|
-
*
|
|
16
|
-
* The env-var names live here so both sides of each contract share one
|
|
17
|
-
* constant: the backend configs that set them (`default_backend_configs.ts`,
|
|
18
|
-
* `ts_spine_backend_config.ts`, `rust_spine_stub_backend_config.ts`) and the
|
|
19
|
-
* spawned TS spine binary that reads them, which imports this leaf rather than
|
|
20
|
-
* the config builders.
|
|
21
|
-
*
|
|
22
|
-
* @module
|
|
3
|
+
* Shared `auth` axis for every `_testing_*` action: keeper-only via the
|
|
4
|
+
* daemon-token credential, no acting actor. This is the entire structural
|
|
5
|
+
* fence on the backdoor surface (these actions run direct DB writes the
|
|
6
|
+
* production wire never exposes), so every `_testing_*` spec references this
|
|
7
|
+
* one const rather than re-declaring it — a single source of truth the gate test
|
|
8
|
+
* (`testing_actions_auth.test.ts`) pins. Mirrors the Rust `DAEMON_TOKEN_ONLY`
|
|
9
|
+
* / shared `AuthSpec` in `fuz_testing`.
|
|
23
10
|
*/
|
|
11
|
+
export const TESTING_ACTION_AUTH = {
|
|
12
|
+
account: 'required',
|
|
13
|
+
actor: 'none',
|
|
14
|
+
credential_types: ['daemon_token']
|
|
15
|
+
};
|
|
24
16
|
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
25
17
|
export const SPINE_RPC_PATH = '/api/rpc';
|
|
26
18
|
/**
|
|
@@ -75,7 +67,7 @@ export const SPINE_ROLE_GATED_WS_ROLES = Object.freeze([
|
|
|
75
67
|
]);
|
|
76
68
|
/**
|
|
77
69
|
* Committed expected-schema fixture for the spine `/ready` deploy gate — the
|
|
78
|
-
* column map a fresh full spine bootstrap (auth + cell +
|
|
70
|
+
* column map a fresh full spine bootstrap (auth + cell + fact)
|
|
79
71
|
* produces. Resolved relative to this module so the spawned TS binary (which
|
|
80
72
|
* imports this source under its loader) reads it off disk via `node:fs`.
|
|
81
73
|
* Regenerated + guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* `_testing_origin_check` — the testing seam behind the cross-impl origin
|
|
4
|
+
* conformance table (`origin_conformance.json`): its input and output schemas,
|
|
5
|
+
* the pure check it answers with, its spec, and the action builder.
|
|
6
|
+
*
|
|
7
|
+
* Split from `testing_reset_actions.ts`, whose other seams reach the
|
|
8
|
+
* in-process app server and through it the optional `hono` peer. This leaf is
|
|
9
|
+
* hono-free, so a consumer whose backend is a spawned Rust binary can run the
|
|
10
|
+
* conformance table without installing `hono`.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { type RpcAction } from '../../actions/action_rpc.js';
|
|
16
|
+
/** Input of `_testing_origin_check`. */
|
|
17
|
+
export declare const TestingOriginCheckInput: z.ZodObject<{
|
|
18
|
+
patterns: z.ZodString;
|
|
19
|
+
origin: z.ZodNullable<z.ZodString>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type TestingOriginCheckInput = z.infer<typeof TestingOriginCheckInput>;
|
|
22
|
+
/**
|
|
23
|
+
* Output of `_testing_origin_check`: the request-level answer when the list
|
|
24
|
+
* parses, else every refusal — `index` the 1-based entry position, absent for
|
|
25
|
+
* a list-level refusal.
|
|
26
|
+
*/
|
|
27
|
+
export declare const TestingOriginCheckOutput: z.ZodUnion<readonly [z.ZodObject<{
|
|
28
|
+
ok: z.ZodLiteral<true>;
|
|
29
|
+
allowed: z.ZodBoolean;
|
|
30
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
+
ok: z.ZodLiteral<false>;
|
|
32
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
33
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
kind: z.ZodEnum<{
|
|
35
|
+
empty_entry: "empty_entry";
|
|
36
|
+
not_printable_ascii: "not_printable_ascii";
|
|
37
|
+
missing_scheme: "missing_scheme";
|
|
38
|
+
unsupported_scheme: "unsupported_scheme";
|
|
39
|
+
has_path: "has_path";
|
|
40
|
+
has_userinfo: "has_userinfo";
|
|
41
|
+
missing_host: "missing_host";
|
|
42
|
+
invalid_host_char: "invalid_host_char";
|
|
43
|
+
unbracketed_ipv6: "unbracketed_ipv6";
|
|
44
|
+
partial_wildcard: "partial_wildcard";
|
|
45
|
+
non_canonical_ipv4: "non_canonical_ipv4";
|
|
46
|
+
unclosed_ipv6: "unclosed_ipv6";
|
|
47
|
+
invalid_ipv6: "invalid_ipv6";
|
|
48
|
+
invalid_after_ipv6: "invalid_after_ipv6";
|
|
49
|
+
invalid_port: "invalid_port";
|
|
50
|
+
default_port: "default_port";
|
|
51
|
+
no_origins: "no_origins";
|
|
52
|
+
}>;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
}, z.core.$strict>]>;
|
|
55
|
+
export type TestingOriginCheckOutput = z.infer<typeof TestingOriginCheckOutput>;
|
|
56
|
+
/**
|
|
57
|
+
* Answer one `_testing_origin_check` input: parse `patterns` with
|
|
58
|
+
* `parse_allowed_origins`, then run the request-level check for one `Origin`
|
|
59
|
+
* carrying `origin` (`null` — no `Origin` — passes). The action handler and
|
|
60
|
+
* the conformance table's unit test both call this, so the table checks the
|
|
61
|
+
* same function the wire serves.
|
|
62
|
+
*
|
|
63
|
+
* @param input - the allowlist value and the `Origin` value
|
|
64
|
+
* @returns the answer the Rust twin returns for the same input
|
|
65
|
+
*/
|
|
66
|
+
export declare const run_testing_origin_check: (input: TestingOriginCheckInput) => TestingOriginCheckOutput;
|
|
67
|
+
/**
|
|
68
|
+
* `_testing_origin_check` — run the origin allowlist's parse and request
|
|
69
|
+
* check for one `{patterns, origin}` pair, so the shared conformance table
|
|
70
|
+
* (`origin_conformance.json`) checks each backend's grammar and matcher over
|
|
71
|
+
* the wire, row by row. Pure: no database, no state. The Rust mirror is
|
|
72
|
+
* `fuz_testing::create_testing_origin_check_action_spec`.
|
|
73
|
+
*
|
|
74
|
+
* Like `_testing_action_manifest`, it is **not** bundled by
|
|
75
|
+
* `create_testing_actions`: a consumer whose Rust binary doesn't mount the
|
|
76
|
+
* mirror would fail its action-manifest parity gate. The spine test binary
|
|
77
|
+
* appends it at the full-mount layer (`build_full_spine_rpc_actions`).
|
|
78
|
+
*
|
|
79
|
+
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
80
|
+
*/
|
|
81
|
+
export declare const testing_origin_check_action_spec: {
|
|
82
|
+
readonly method: "_testing_origin_check";
|
|
83
|
+
readonly kind: "request_response";
|
|
84
|
+
readonly initiator: "frontend";
|
|
85
|
+
readonly auth: {
|
|
86
|
+
readonly account: "required";
|
|
87
|
+
readonly actor: "none";
|
|
88
|
+
readonly credential_types: readonly ["daemon_token"];
|
|
89
|
+
};
|
|
90
|
+
readonly side_effects: false;
|
|
91
|
+
readonly input: z.ZodObject<{
|
|
92
|
+
patterns: z.ZodString;
|
|
93
|
+
origin: z.ZodNullable<z.ZodString>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
readonly output: z.ZodUnion<readonly [z.ZodObject<{
|
|
96
|
+
ok: z.ZodLiteral<true>;
|
|
97
|
+
allowed: z.ZodBoolean;
|
|
98
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
99
|
+
ok: z.ZodLiteral<false>;
|
|
100
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
101
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
kind: z.ZodEnum<{
|
|
103
|
+
empty_entry: "empty_entry";
|
|
104
|
+
not_printable_ascii: "not_printable_ascii";
|
|
105
|
+
missing_scheme: "missing_scheme";
|
|
106
|
+
unsupported_scheme: "unsupported_scheme";
|
|
107
|
+
has_path: "has_path";
|
|
108
|
+
has_userinfo: "has_userinfo";
|
|
109
|
+
missing_host: "missing_host";
|
|
110
|
+
invalid_host_char: "invalid_host_char";
|
|
111
|
+
unbracketed_ipv6: "unbracketed_ipv6";
|
|
112
|
+
partial_wildcard: "partial_wildcard";
|
|
113
|
+
non_canonical_ipv4: "non_canonical_ipv4";
|
|
114
|
+
unclosed_ipv6: "unclosed_ipv6";
|
|
115
|
+
invalid_ipv6: "invalid_ipv6";
|
|
116
|
+
invalid_after_ipv6: "invalid_after_ipv6";
|
|
117
|
+
invalid_port: "invalid_port";
|
|
118
|
+
default_port: "default_port";
|
|
119
|
+
no_origins: "no_origins";
|
|
120
|
+
}>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
}, z.core.$strict>]>;
|
|
123
|
+
readonly async: true;
|
|
124
|
+
readonly description: string;
|
|
125
|
+
};
|
|
126
|
+
/** Build the standalone `_testing_origin_check` action (see the spec doc). */
|
|
127
|
+
export declare const create_testing_origin_check_action: () => RpcAction;
|
|
128
|
+
//# sourceMappingURL=testing_origin_check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing_origin_check.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_origin_check.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AASzE,wCAAwC;AACxC,eAAO,MAAM,uBAAuB;;;kBAKlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAQnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACpC,OAAO,uBAAuB,KAC5B,wBAcF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYC,CAAC;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,QAAO,SACyC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* `_testing_origin_check` — the testing seam behind the cross-impl origin
|
|
4
|
+
* conformance table (`origin_conformance.json`): its input and output schemas,
|
|
5
|
+
* the pure check it answers with, its spec, and the action builder.
|
|
6
|
+
*
|
|
7
|
+
* Split from `testing_reset_actions.ts`, whose other seams reach the
|
|
8
|
+
* in-process app server and through it the optional `hono` peer. This leaf is
|
|
9
|
+
* hono-free, so a consumer whose backend is a spawned Rust binary can run the
|
|
10
|
+
* conformance table without installing `hono`.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { rpc_action } from '../../actions/action_rpc.js';
|
|
16
|
+
import { AllowedOriginsErrorKind, parse_allowed_origins, should_allow_origin } from '../../http/origin.js';
|
|
17
|
+
import { TESTING_ACTION_AUTH } from './spine_surface_constants.js';
|
|
18
|
+
/** Input of `_testing_origin_check`. */
|
|
19
|
+
export const TestingOriginCheckInput = z.strictObject({
|
|
20
|
+
/** An allowlist value, as `FUZ_ALLOWED_ORIGINS` would carry it. */
|
|
21
|
+
patterns: z.string(),
|
|
22
|
+
/** One `Origin` header's value, or `null` for a request without one. */
|
|
23
|
+
origin: z.string().nullable()
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Output of `_testing_origin_check`: the request-level answer when the list
|
|
27
|
+
* parses, else every refusal — `index` the 1-based entry position, absent for
|
|
28
|
+
* a list-level refusal.
|
|
29
|
+
*/
|
|
30
|
+
export const TestingOriginCheckOutput = z.union([
|
|
31
|
+
z.strictObject({ ok: z.literal(true), allowed: z.boolean() }),
|
|
32
|
+
z.strictObject({
|
|
33
|
+
ok: z.literal(false),
|
|
34
|
+
errors: z.array(z.strictObject({ index: z.number().int().min(1).optional(), kind: AllowedOriginsErrorKind }))
|
|
35
|
+
})
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* Answer one `_testing_origin_check` input: parse `patterns` with
|
|
39
|
+
* `parse_allowed_origins`, then run the request-level check for one `Origin`
|
|
40
|
+
* carrying `origin` (`null` — no `Origin` — passes). The action handler and
|
|
41
|
+
* the conformance table's unit test both call this, so the table checks the
|
|
42
|
+
* same function the wire serves.
|
|
43
|
+
*
|
|
44
|
+
* @param input - the allowlist value and the `Origin` value
|
|
45
|
+
* @returns the answer the Rust twin returns for the same input
|
|
46
|
+
*/
|
|
47
|
+
export const run_testing_origin_check = (input) => {
|
|
48
|
+
const parsed = parse_allowed_origins(input.patterns);
|
|
49
|
+
if (!parsed.ok) {
|
|
50
|
+
return {
|
|
51
|
+
ok: false,
|
|
52
|
+
errors: parsed.errors.map(({ index, kind }) => index === undefined ? { kind } : { index, kind })
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
ok: true,
|
|
57
|
+
allowed: input.origin === null || should_allow_origin(input.origin, parsed.origins)
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* `_testing_origin_check` — run the origin allowlist's parse and request
|
|
62
|
+
* check for one `{patterns, origin}` pair, so the shared conformance table
|
|
63
|
+
* (`origin_conformance.json`) checks each backend's grammar and matcher over
|
|
64
|
+
* the wire, row by row. Pure: no database, no state. The Rust mirror is
|
|
65
|
+
* `fuz_testing::create_testing_origin_check_action_spec`.
|
|
66
|
+
*
|
|
67
|
+
* Like `_testing_action_manifest`, it is **not** bundled by
|
|
68
|
+
* `create_testing_actions`: a consumer whose Rust binary doesn't mount the
|
|
69
|
+
* mirror would fail its action-manifest parity gate. The spine test binary
|
|
70
|
+
* appends it at the full-mount layer (`build_full_spine_rpc_actions`).
|
|
71
|
+
*
|
|
72
|
+
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
73
|
+
*/
|
|
74
|
+
export const testing_origin_check_action_spec = {
|
|
75
|
+
method: '_testing_origin_check',
|
|
76
|
+
kind: 'request_response',
|
|
77
|
+
initiator: 'frontend',
|
|
78
|
+
auth: TESTING_ACTION_AUTH,
|
|
79
|
+
side_effects: false,
|
|
80
|
+
input: TestingOriginCheckInput,
|
|
81
|
+
output: TestingOriginCheckOutput,
|
|
82
|
+
async: true,
|
|
83
|
+
description: "Test-binary only — answer the origin allowlist's parse and request check for one " +
|
|
84
|
+
'{patterns, origin} pair, for the cross-impl origin conformance table.'
|
|
85
|
+
};
|
|
86
|
+
/** Build the standalone `_testing_origin_check` action (see the spec doc). */
|
|
87
|
+
export const create_testing_origin_check_action = () => rpc_action(testing_origin_check_action_spec, async (input) => run_testing_origin_check(input));
|
|
@@ -15,17 +15,17 @@ import '../assert_dev_env.js';
|
|
|
15
15
|
* of notifications onto the caller's own WebSocket connection, to push its
|
|
16
16
|
* outbound queue past its byte budget).
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Two further daemon-token actions live here but are **not** bundled by
|
|
19
19
|
* `create_testing_actions`, and are appended at the full-mount layer
|
|
20
20
|
* (`build_full_spine_rpc_actions`) instead: **`_testing_action_manifest`**
|
|
21
21
|
* (dump the live RPC registry for cross-impl method-set + auth-shape parity —
|
|
22
22
|
* it must enumerate *every* mounted method, so it goes where the complete list
|
|
23
|
-
* exists)
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* exists) and **`_testing_shorten_credential_expiry`** (pull an account's
|
|
24
|
+
* credential expiries in to seconds from now, shorten-only, for the
|
|
25
|
+
* credential-deadline cases) — the latter kept out of the bundle so a consumer
|
|
26
|
+
* whose Rust binary doesn't mount its mirror keeps a green manifest gate.
|
|
27
|
+
* `_testing_origin_check`, mounted the same way, lives in the hono-free
|
|
28
|
+
* `testing_origin_check.ts`.
|
|
29
29
|
*
|
|
30
30
|
* `_testing_reset` — full DB wipe + keeper re-seed + optional
|
|
31
31
|
* secondary-account seeding. The
|
|
@@ -472,118 +472,6 @@ export declare const testing_migration_tracker_action_spec: {
|
|
|
472
472
|
* `create_testing_actions`; mount directly for in-process use.
|
|
473
473
|
*/
|
|
474
474
|
export declare const create_testing_migration_tracker_action: () => RpcAction;
|
|
475
|
-
/** Input of `_testing_origin_check`. */
|
|
476
|
-
export declare const TestingOriginCheckInput: z.ZodObject<{
|
|
477
|
-
patterns: z.ZodString;
|
|
478
|
-
origin: z.ZodNullable<z.ZodString>;
|
|
479
|
-
}, z.core.$strict>;
|
|
480
|
-
export type TestingOriginCheckInput = z.infer<typeof TestingOriginCheckInput>;
|
|
481
|
-
/**
|
|
482
|
-
* Output of `_testing_origin_check`: the request-level answer when the list
|
|
483
|
-
* parses, else every refusal — `index` the 1-based entry position, absent for
|
|
484
|
-
* a list-level refusal.
|
|
485
|
-
*/
|
|
486
|
-
export declare const TestingOriginCheckOutput: z.ZodUnion<readonly [z.ZodObject<{
|
|
487
|
-
ok: z.ZodLiteral<true>;
|
|
488
|
-
allowed: z.ZodBoolean;
|
|
489
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
490
|
-
ok: z.ZodLiteral<false>;
|
|
491
|
-
errors: z.ZodArray<z.ZodObject<{
|
|
492
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
493
|
-
kind: z.ZodEnum<{
|
|
494
|
-
empty_entry: "empty_entry";
|
|
495
|
-
not_printable_ascii: "not_printable_ascii";
|
|
496
|
-
missing_scheme: "missing_scheme";
|
|
497
|
-
unsupported_scheme: "unsupported_scheme";
|
|
498
|
-
has_path: "has_path";
|
|
499
|
-
has_userinfo: "has_userinfo";
|
|
500
|
-
missing_host: "missing_host";
|
|
501
|
-
invalid_host_char: "invalid_host_char";
|
|
502
|
-
unbracketed_ipv6: "unbracketed_ipv6";
|
|
503
|
-
partial_wildcard: "partial_wildcard";
|
|
504
|
-
non_canonical_ipv4: "non_canonical_ipv4";
|
|
505
|
-
unclosed_ipv6: "unclosed_ipv6";
|
|
506
|
-
invalid_ipv6: "invalid_ipv6";
|
|
507
|
-
invalid_after_ipv6: "invalid_after_ipv6";
|
|
508
|
-
invalid_port: "invalid_port";
|
|
509
|
-
default_port: "default_port";
|
|
510
|
-
no_origins: "no_origins";
|
|
511
|
-
}>;
|
|
512
|
-
}, z.core.$strict>>;
|
|
513
|
-
}, z.core.$strict>]>;
|
|
514
|
-
export type TestingOriginCheckOutput = z.infer<typeof TestingOriginCheckOutput>;
|
|
515
|
-
/**
|
|
516
|
-
* Answer one `_testing_origin_check` input: parse `patterns` with
|
|
517
|
-
* `parse_allowed_origins`, then run the request-level check for one `Origin`
|
|
518
|
-
* carrying `origin` (`null` — no `Origin` — passes). The action handler and
|
|
519
|
-
* the conformance table's unit test both call this, so the table checks the
|
|
520
|
-
* same function the wire serves.
|
|
521
|
-
*
|
|
522
|
-
* @param input - the allowlist value and the `Origin` value
|
|
523
|
-
* @returns the answer the Rust twin returns for the same input
|
|
524
|
-
*/
|
|
525
|
-
export declare const run_testing_origin_check: (input: TestingOriginCheckInput) => TestingOriginCheckOutput;
|
|
526
|
-
/**
|
|
527
|
-
* `_testing_origin_check` — run the origin allowlist's parse and request
|
|
528
|
-
* check for one `{patterns, origin}` pair, so the shared conformance table
|
|
529
|
-
* (`origin_conformance.json`) checks each backend's grammar and matcher over
|
|
530
|
-
* the wire, row by row. Pure: no database, no state. The Rust mirror is
|
|
531
|
-
* `fuz_testing::create_testing_origin_check_action_spec`.
|
|
532
|
-
*
|
|
533
|
-
* Like `_testing_action_manifest`, it is **not** bundled by
|
|
534
|
-
* `create_testing_actions`: a consumer whose Rust binary doesn't mount the
|
|
535
|
-
* mirror would fail its action-manifest parity gate. The spine test binary
|
|
536
|
-
* appends it at the full-mount layer (`build_full_spine_rpc_actions`).
|
|
537
|
-
*
|
|
538
|
-
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
539
|
-
*/
|
|
540
|
-
export declare const testing_origin_check_action_spec: {
|
|
541
|
-
readonly method: "_testing_origin_check";
|
|
542
|
-
readonly kind: "request_response";
|
|
543
|
-
readonly initiator: "frontend";
|
|
544
|
-
readonly auth: {
|
|
545
|
-
readonly account: "required";
|
|
546
|
-
readonly actor: "none";
|
|
547
|
-
readonly credential_types: readonly ["daemon_token"];
|
|
548
|
-
};
|
|
549
|
-
readonly side_effects: false;
|
|
550
|
-
readonly input: z.ZodObject<{
|
|
551
|
-
patterns: z.ZodString;
|
|
552
|
-
origin: z.ZodNullable<z.ZodString>;
|
|
553
|
-
}, z.core.$strict>;
|
|
554
|
-
readonly output: z.ZodUnion<readonly [z.ZodObject<{
|
|
555
|
-
ok: z.ZodLiteral<true>;
|
|
556
|
-
allowed: z.ZodBoolean;
|
|
557
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
558
|
-
ok: z.ZodLiteral<false>;
|
|
559
|
-
errors: z.ZodArray<z.ZodObject<{
|
|
560
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
561
|
-
kind: z.ZodEnum<{
|
|
562
|
-
empty_entry: "empty_entry";
|
|
563
|
-
not_printable_ascii: "not_printable_ascii";
|
|
564
|
-
missing_scheme: "missing_scheme";
|
|
565
|
-
unsupported_scheme: "unsupported_scheme";
|
|
566
|
-
has_path: "has_path";
|
|
567
|
-
has_userinfo: "has_userinfo";
|
|
568
|
-
missing_host: "missing_host";
|
|
569
|
-
invalid_host_char: "invalid_host_char";
|
|
570
|
-
unbracketed_ipv6: "unbracketed_ipv6";
|
|
571
|
-
partial_wildcard: "partial_wildcard";
|
|
572
|
-
non_canonical_ipv4: "non_canonical_ipv4";
|
|
573
|
-
unclosed_ipv6: "unclosed_ipv6";
|
|
574
|
-
invalid_ipv6: "invalid_ipv6";
|
|
575
|
-
invalid_after_ipv6: "invalid_after_ipv6";
|
|
576
|
-
invalid_port: "invalid_port";
|
|
577
|
-
default_port: "default_port";
|
|
578
|
-
no_origins: "no_origins";
|
|
579
|
-
}>;
|
|
580
|
-
}, z.core.$strict>>;
|
|
581
|
-
}, z.core.$strict>]>;
|
|
582
|
-
readonly async: true;
|
|
583
|
-
readonly description: string;
|
|
584
|
-
};
|
|
585
|
-
/** Build the standalone `_testing_origin_check` action (see the spec doc). */
|
|
586
|
-
export declare const create_testing_origin_check_action: () => RpcAction;
|
|
587
475
|
/** The shortest expiry `_testing_shorten_credential_expiry` sets, in seconds from now. */
|
|
588
476
|
export declare const TESTING_SHORTEN_CREDENTIAL_EXPIRY_MIN_SECONDS = 1;
|
|
589
477
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"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"}
|
|
@@ -15,17 +15,17 @@ import '../assert_dev_env.js';
|
|
|
15
15
|
* of notifications onto the caller's own WebSocket connection, to push its
|
|
16
16
|
* outbound queue past its byte budget).
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Two further daemon-token actions live here but are **not** bundled by
|
|
19
19
|
* `create_testing_actions`, and are appended at the full-mount layer
|
|
20
20
|
* (`build_full_spine_rpc_actions`) instead: **`_testing_action_manifest`**
|
|
21
21
|
* (dump the live RPC registry for cross-impl method-set + auth-shape parity —
|
|
22
22
|
* it must enumerate *every* mounted method, so it goes where the complete list
|
|
23
|
-
* exists)
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* exists) and **`_testing_shorten_credential_expiry`** (pull an account's
|
|
24
|
+
* credential expiries in to seconds from now, shorten-only, for the
|
|
25
|
+
* credential-deadline cases) — the latter kept out of the bundle so a consumer
|
|
26
|
+
* whose Rust binary doesn't mount its mirror keeps a green manifest gate.
|
|
27
|
+
* `_testing_origin_check`, mounted the same way, lives in the hono-free
|
|
28
|
+
* `testing_origin_check.ts`.
|
|
29
29
|
*
|
|
30
30
|
* `_testing_reset` — full DB wipe + keeper re-seed + optional
|
|
31
31
|
* secondary-account seeding. The
|
|
@@ -89,21 +89,7 @@ import { ActionManifest, build_action_manifest } from './action_manifest.js';
|
|
|
89
89
|
import { query_create_actor } from '../../auth/account_queries.js';
|
|
90
90
|
import { create_test_account_with_credentials, mint_test_session } from '../app_server.js';
|
|
91
91
|
import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
|
|
92
|
-
import {
|
|
93
|
-
/**
|
|
94
|
-
* Shared `auth` axis for every `_testing_*` action: keeper-only via the
|
|
95
|
-
* daemon-token credential, no acting actor. This is the entire structural
|
|
96
|
-
* fence on the backdoor surface (these actions run direct DB writes the
|
|
97
|
-
* production wire never exposes), so every `_testing_*` spec references this
|
|
98
|
-
* one const rather than re-declaring it — a single source of truth the gate test
|
|
99
|
-
* (`testing_actions_auth.test.ts`) pins. Mirrors the Rust `DAEMON_TOKEN_ONLY`
|
|
100
|
-
* / shared `AuthSpec` in `fuz_testing`.
|
|
101
|
-
*/
|
|
102
|
-
const TESTING_ACTION_AUTH = {
|
|
103
|
-
account: 'required',
|
|
104
|
-
actor: 'none',
|
|
105
|
-
credential_types: ['daemon_token']
|
|
106
|
-
};
|
|
92
|
+
import { TESTING_ACTION_AUTH } from './spine_surface_constants.js';
|
|
107
93
|
/** Output shape for an individual seeded account (keeper or extra). */
|
|
108
94
|
const SeededAccountShape = z.strictObject({
|
|
109
95
|
account: z.strictObject({ id: Uuid, username: z.string() }),
|
|
@@ -459,76 +445,6 @@ export const testing_migration_tracker_action_spec = {
|
|
|
459
445
|
* `create_testing_actions`; mount directly for in-process use.
|
|
460
446
|
*/
|
|
461
447
|
export const create_testing_migration_tracker_action = () => rpc_action(testing_migration_tracker_action_spec, async (_input, ctx) => query_migration_tracker(ctx.db));
|
|
462
|
-
/** Input of `_testing_origin_check`. */
|
|
463
|
-
export const TestingOriginCheckInput = z.strictObject({
|
|
464
|
-
/** An allowlist value, as `FUZ_ALLOWED_ORIGINS` would carry it. */
|
|
465
|
-
patterns: z.string(),
|
|
466
|
-
/** One `Origin` header's value, or `null` for a request without one. */
|
|
467
|
-
origin: z.string().nullable()
|
|
468
|
-
});
|
|
469
|
-
/**
|
|
470
|
-
* Output of `_testing_origin_check`: the request-level answer when the list
|
|
471
|
-
* parses, else every refusal — `index` the 1-based entry position, absent for
|
|
472
|
-
* a list-level refusal.
|
|
473
|
-
*/
|
|
474
|
-
export const TestingOriginCheckOutput = z.union([
|
|
475
|
-
z.strictObject({ ok: z.literal(true), allowed: z.boolean() }),
|
|
476
|
-
z.strictObject({
|
|
477
|
-
ok: z.literal(false),
|
|
478
|
-
errors: z.array(z.strictObject({ index: z.number().int().min(1).optional(), kind: AllowedOriginsErrorKind }))
|
|
479
|
-
})
|
|
480
|
-
]);
|
|
481
|
-
/**
|
|
482
|
-
* Answer one `_testing_origin_check` input: parse `patterns` with
|
|
483
|
-
* `parse_allowed_origins`, then run the request-level check for one `Origin`
|
|
484
|
-
* carrying `origin` (`null` — no `Origin` — passes). The action handler and
|
|
485
|
-
* the conformance table's unit test both call this, so the table checks the
|
|
486
|
-
* same function the wire serves.
|
|
487
|
-
*
|
|
488
|
-
* @param input - the allowlist value and the `Origin` value
|
|
489
|
-
* @returns the answer the Rust twin returns for the same input
|
|
490
|
-
*/
|
|
491
|
-
export const run_testing_origin_check = (input) => {
|
|
492
|
-
const parsed = parse_allowed_origins(input.patterns);
|
|
493
|
-
if (!parsed.ok) {
|
|
494
|
-
return {
|
|
495
|
-
ok: false,
|
|
496
|
-
errors: parsed.errors.map(({ index, kind }) => index === undefined ? { kind } : { index, kind })
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
return {
|
|
500
|
-
ok: true,
|
|
501
|
-
allowed: input.origin === null || should_allow_origin(input.origin, parsed.origins)
|
|
502
|
-
};
|
|
503
|
-
};
|
|
504
|
-
/**
|
|
505
|
-
* `_testing_origin_check` — run the origin allowlist's parse and request
|
|
506
|
-
* check for one `{patterns, origin}` pair, so the shared conformance table
|
|
507
|
-
* (`origin_conformance.json`) checks each backend's grammar and matcher over
|
|
508
|
-
* the wire, row by row. Pure: no database, no state. The Rust mirror is
|
|
509
|
-
* `fuz_testing::create_testing_origin_check_action_spec`.
|
|
510
|
-
*
|
|
511
|
-
* Like `_testing_action_manifest`, it is **not** bundled by
|
|
512
|
-
* `create_testing_actions`: a consumer whose Rust binary doesn't mount the
|
|
513
|
-
* mirror would fail its action-manifest parity gate. The spine test binary
|
|
514
|
-
* appends it at the full-mount layer (`build_full_spine_rpc_actions`).
|
|
515
|
-
*
|
|
516
|
-
* `auth` gates on the daemon-token credential, matching `_testing_reset`.
|
|
517
|
-
*/
|
|
518
|
-
export const testing_origin_check_action_spec = {
|
|
519
|
-
method: '_testing_origin_check',
|
|
520
|
-
kind: 'request_response',
|
|
521
|
-
initiator: 'frontend',
|
|
522
|
-
auth: TESTING_ACTION_AUTH,
|
|
523
|
-
side_effects: false,
|
|
524
|
-
input: TestingOriginCheckInput,
|
|
525
|
-
output: TestingOriginCheckOutput,
|
|
526
|
-
async: true,
|
|
527
|
-
description: "Test-binary only — answer the origin allowlist's parse and request check for one " +
|
|
528
|
-
'{patterns, origin} pair, for the cross-impl origin conformance table.'
|
|
529
|
-
};
|
|
530
|
-
/** Build the standalone `_testing_origin_check` action (see the spec doc). */
|
|
531
|
-
export const create_testing_origin_check_action = () => rpc_action(testing_origin_check_action_spec, async (input) => run_testing_origin_check(input));
|
|
532
448
|
/** The shortest expiry `_testing_shorten_credential_expiry` sets, in seconds from now. */
|
|
533
449
|
export const TESTING_SHORTEN_CREDENTIAL_EXPIRY_MIN_SECONDS = 1;
|
|
534
450
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_action_rate_limit.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ws_action_rate_limit.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ws_action_rate_limit.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/ws_action_rate_limit.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAkE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAgD5C,+DAA+D;AAC/D,MAAM,WAAW,iCAAiC;IACjD,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAkBD;;;;GAIG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,iCAAiC,KACxC,IAwSF,CAAC"}
|