testing/cross_backend/testing_origin_check.ts

_testing_origin_check — the testing seam behind the cross-impl origin conformance table (origin_conformance.json): its input and output schemas, the pure check it answers with, its spec, and the action builder.

Split from testing_reset_actions.ts, whose other seams reach the in-process app server and through it the optional hono peer. This leaf is hono-free, so a consumer whose backend is a spawned Rust binary can run the conformance table without installing hono.

view source

Declarations
#

5 declarations

create_testing_origin_check_action
#

run_testing_origin_check
#

testing/cross_backend/testing_origin_check.ts view source

(input: { patterns: string; origin: string | null; }): { ok: true; allowed: boolean; } | { ok: false; errors: { kind: "empty_entry" | "not_printable_ascii" | "missing_scheme" | "unsupported_scheme" | ... 12 more ... | "no_origins"; index?: number | undefined; }[]; } import {run_testing_origin_check} from '@fuzdev/fuz_app/testing/cross_backend/testing_origin_check.js';

Answer one _testing_origin_check input: parse patterns with parse_allowed_origins, then run the request-level check for one Origin carrying origin (null — no Origin — passes). The action handler and the conformance table's unit test both call this, so the table checks the same function the wire serves.

input

the allowlist value and the Origin value

returns

TestingOriginCheckOutput

the answer the Rust twin returns for the same input

testing_origin_check_action_spec
#

testing/cross_backend/testing_origin_check.ts view source

{ readonly method: "_testing_origin_check"; readonly kind: "request_response"; readonly initiator: "frontend"; readonly auth: { readonly account: "required"; readonly actor: "none"; readonly credential_types: readonly [...]; }; ... 4 more ...; readonly description: string; } import {testing_origin_check_action_spec} from '@fuzdev/fuz_app/testing/cross_backend/testing_origin_check.js';

_testing_origin_check — run the origin allowlist's parse and request check for one {patterns, origin} pair, so the shared conformance table (origin_conformance.json) checks each backend's grammar and matcher over the wire, row by row. Pure: no database, no state. The Rust mirror is fuz_testing::create_testing_origin_check_action_spec.

Like _testing_action_manifest, it is not bundled by create_testing_actions: a consumer whose Rust binary doesn't mount the mirror would fail its action-manifest parity gate. The spine test binary appends it at the full-mount layer (build_full_spine_rpc_actions).

auth gates on the daemon-token credential, matching _testing_reset.

TestingOriginCheckInput
#

testing/cross_backend/testing_origin_check.ts view source

value + type

{ patterns: string; origin: string | null; } import {TestingOriginCheckInput} from '@fuzdev/fuz_app/testing/cross_backend/testing_origin_check.js';

Input of _testing_origin_check.

patterns

An allowlist value, as FUZ_ALLOWED_ORIGINS would carry it.

type string

origin

One Origin header's value, or null for a request without one.

type string | null

TestingOriginCheckOutput
#

testing/cross_backend/testing_origin_check.ts view source

value + type

{ ok: true; allowed: boolean; } | { ok: false; errors: { kind: "empty_entry" | "not_printable_ascii" | "missing_scheme" | "unsupported_scheme" | "has_path" | "has_userinfo" | "missing_host" | ... 9 more ... | "no_origins"; index?: number | undefined; }[]; }

type { ok: true; allowed: boolean; } | { ok: false; errors: { kind: "empty_entry" | "not_printable_ascii" | "missing_scheme" | "unsupported_scheme" | "has_path" | "has_userinfo" | "missing_host" | "invalid_host_char" | "unbracketed_ipv6" | "partial_wildcard" | "non_canonical_ipv4" | "unclosed_ipv6" | "invalid_ipv6" | "invalid_after_ipv6" | "invalid_port" | "default_port" | "no_origins"; index?: number | undefined; }[]; }

import {TestingOriginCheckOutput} from '@fuzdev/fuz_app/testing/cross_backend/testing_origin_check.js';

Output of _testing_origin_check: the request-level answer when the list parses, else every refusal — index the 1-based entry position, absent for a list-level refusal.

Depends on
#

Imported by
#