@fuzdev/fuz_app 0.59.0 → 0.60.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 +5 -5
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.js +2 -2
- package/dist/actions/action_event_helpers.d.ts +3 -3
- package/dist/actions/action_event_helpers.js +8 -8
- package/dist/actions/action_event_types.d.ts +3 -3
- package/dist/actions/action_event_types.js +3 -3
- package/dist/actions/transports_ws_auth_guard.d.ts +2 -2
- package/dist/actions/transports_ws_auth_guard.js +3 -3
- package/dist/auth/CLAUDE.md +157 -15
- package/dist/auth/actor_lookup_action_specs.d.ts +127 -0
- package/dist/auth/actor_lookup_action_specs.d.ts.map +1 -0
- package/dist/auth/actor_lookup_action_specs.js +93 -0
- package/dist/auth/actor_lookup_actions.d.ts +19 -0
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -0
- package/dist/auth/actor_lookup_actions.js +32 -0
- package/dist/auth/actor_lookup_queries.d.ts +44 -0
- package/dist/auth/actor_lookup_queries.d.ts.map +1 -0
- package/dist/auth/actor_lookup_queries.js +42 -0
- package/dist/auth/actor_search_action_specs.d.ts +166 -0
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -0
- package/dist/auth/actor_search_action_specs.js +139 -0
- package/dist/auth/actor_search_actions.d.ts +31 -0
- package/dist/auth/actor_search_actions.d.ts.map +1 -0
- package/dist/auth/actor_search_actions.js +61 -0
- package/dist/auth/actor_search_queries.d.ts +75 -0
- package/dist/auth/actor_search_queries.d.ts.map +1 -0
- package/dist/auth/actor_search_queries.js +91 -0
- package/dist/auth/admin_actions.js +2 -2
- package/dist/auth/all_action_spec_registries.d.ts +55 -0
- package/dist/auth/all_action_spec_registries.d.ts.map +1 -0
- package/dist/auth/all_action_spec_registries.js +59 -0
- package/dist/auth/audit_emitter.d.ts +1 -1
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_queries.d.ts +1 -1
- package/dist/auth/audit_log_queries.js +3 -3
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +5 -5
- package/dist/auth/audit_log_schema.js +7 -7
- package/dist/auth/auth_ddl.d.ts +7 -0
- package/dist/auth/auth_ddl.d.ts.map +1 -1
- package/dist/auth/auth_ddl.js +8 -0
- package/dist/auth/credential_type_schema.d.ts +1 -1
- package/dist/auth/credential_type_schema.js +3 -3
- package/dist/auth/grant_path_schema.d.ts +1 -1
- package/dist/auth/grant_path_schema.js +3 -3
- package/dist/auth/migrations.d.ts +4 -4
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +7 -6
- package/dist/auth/role_grant_offer_actions.js +2 -2
- package/dist/auth/role_grant_offer_notifications.d.ts +2 -2
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_queries.d.ts +21 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +31 -0
- package/dist/auth/role_schema.d.ts +2 -2
- package/dist/auth/role_schema.js +3 -3
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.js +2 -2
- package/dist/auth/session_cookie.d.ts +1 -1
- package/dist/auth/session_cookie.js +1 -1
- package/dist/auth/session_middleware.d.ts +1 -1
- package/dist/auth/session_middleware.js +5 -5
- package/dist/rate_limiter.d.ts +5 -5
- package/dist/rate_limiter.js +6 -6
- package/dist/realtime/sse_auth_guard.d.ts +3 -3
- package/dist/realtime/sse_auth_guard.js +4 -4
- package/dist/server/app_backend.d.ts +3 -3
- package/dist/server/app_backend.js +4 -4
- package/dist/server/app_server.d.ts +1 -1
- package/dist/server/app_server.js +10 -10
- package/dist/testing/CLAUDE.md +22 -12
- package/dist/testing/admin_integration.js +4 -4
- package/dist/testing/app_server.d.ts +1 -1
- package/dist/testing/app_server.js +2 -2
- package/dist/testing/attack_surface.d.ts +4 -4
- package/dist/testing/attack_surface.js +6 -6
- package/dist/testing/audit_completeness.js +4 -4
- package/dist/testing/data_exposure.d.ts +2 -2
- package/dist/testing/data_exposure.js +7 -7
- package/dist/testing/db.d.ts +8 -8
- package/dist/testing/db.js +11 -11
- package/dist/testing/integration.js +4 -4
- package/dist/testing/integration_helpers.d.ts +6 -6
- package/dist/testing/integration_helpers.js +7 -7
- package/dist/testing/rate_limiting.js +4 -4
- package/dist/testing/round_trip.js +2 -2
- package/dist/testing/rpc_round_trip.js +2 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +23 -2
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/surface_invariants.d.ts +4 -4
- package/dist/testing/surface_invariants.js +5 -5
- package/package.json +1 -1
|
@@ -158,8 +158,29 @@ export const generate_valid_value = (field, field_schema) => {
|
|
|
158
158
|
return 1;
|
|
159
159
|
case 'boolean':
|
|
160
160
|
return true;
|
|
161
|
-
case 'array':
|
|
162
|
-
|
|
161
|
+
case 'array': {
|
|
162
|
+
let min_items = 0;
|
|
163
|
+
try {
|
|
164
|
+
const json = z.toJSONSchema(field_schema);
|
|
165
|
+
if (typeof json.minItems === 'number')
|
|
166
|
+
min_items = json.minItems;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
// no constraint
|
|
170
|
+
}
|
|
171
|
+
if (min_items === 0)
|
|
172
|
+
return [];
|
|
173
|
+
const def = zod_unwrap_def(field_schema);
|
|
174
|
+
const element_schema = def.element;
|
|
175
|
+
if (!element_schema)
|
|
176
|
+
return [];
|
|
177
|
+
const element_field = {
|
|
178
|
+
...field,
|
|
179
|
+
base_type: zod_get_base_type(element_schema),
|
|
180
|
+
};
|
|
181
|
+
const item = generate_valid_value(element_field, element_schema);
|
|
182
|
+
return Array.from({ length: min_items }, () => item);
|
|
183
|
+
}
|
|
163
184
|
case 'object': {
|
|
164
185
|
// Recursively generate valid nested objects
|
|
165
186
|
const nested_schema = zod_unwrap_to_object(field_schema);
|
|
@@ -21,7 +21,7 @@ import { create_pglite_factory } from './db.js';
|
|
|
21
21
|
import { find_route_spec, pick_auth_headers } from './integration_helpers.js';
|
|
22
22
|
import { rpc_call, require_rpc_endpoint_path, resolve_rpc_endpoints_for_setup, } from './rpc_helpers.js';
|
|
23
23
|
import { run_migrations } from '../db/migrate.js';
|
|
24
|
-
import {
|
|
24
|
+
import { auth_migration_ns } from '../auth/migrations.js';
|
|
25
25
|
import { account_session_revoke_all_action_spec } from '../auth/account_action_specs.js';
|
|
26
26
|
/**
|
|
27
27
|
* Read one complete SSE frame (up to `\n\n`) from a stream reader.
|
|
@@ -138,7 +138,7 @@ export const describe_sse_route_tests = (options) => {
|
|
|
138
138
|
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_options);
|
|
139
139
|
const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
|
|
140
140
|
const init_schema = async (db) => {
|
|
141
|
-
await run_migrations(db, [
|
|
141
|
+
await run_migrations(db, [auth_migration_ns]);
|
|
142
142
|
};
|
|
143
143
|
const factories = options.db_factories ?? [create_pglite_factory(init_schema)];
|
|
144
144
|
for (const factory of factories) {
|
|
@@ -178,13 +178,13 @@ export interface ErrorSchemaTightnessOptions {
|
|
|
178
178
|
* them here instead of forcing every consumer to hand-maintain the entry.
|
|
179
179
|
*
|
|
180
180
|
* Paths assume the standard `/api/account` + `/api/db` prefixes used by every
|
|
181
|
-
* fuz_app consumer. Merged into `
|
|
181
|
+
* fuz_app consumer. Merged into `default_error_schema_tightness.allowlist` so
|
|
182
182
|
* consumers calling `assert_error_schema_tightness` directly inherit the
|
|
183
183
|
* exemptions; the standard attack-surface suite also prepends these entries
|
|
184
184
|
* underneath any consumer-supplied allowlist so project-specific entries are
|
|
185
185
|
* additive.
|
|
186
186
|
*/
|
|
187
|
-
export declare const
|
|
187
|
+
export declare const fuz_app_stock_route_tightness_allowlist: ReadonlyArray<string>;
|
|
188
188
|
/**
|
|
189
189
|
* Baseline error schema tightness applied by
|
|
190
190
|
* `describe_standard_attack_surface_tests` when no config is passed.
|
|
@@ -192,13 +192,13 @@ export declare const FUZ_APP_STOCK_ROUTE_TIGHTNESS_ALLOWLIST: ReadonlyArray<stri
|
|
|
192
192
|
* Uses `min_specificity: 'enum'` (the assertion default) with `ignore_statuses`
|
|
193
193
|
* for middleware-derived status codes that are commonly generic (auth middleware
|
|
194
194
|
* produces multiple error codes at 401/403, and 429 comes from rate limiters),
|
|
195
|
-
* and `allowlist` seeded with `
|
|
195
|
+
* and `allowlist` seeded with `fuz_app_stock_route_tightness_allowlist` so
|
|
196
196
|
* fuz_app-shipped routes with heterogeneous generic schemas don't force every
|
|
197
197
|
* consumer to hand-maintain an identical allowlist. Consumers can pass a
|
|
198
198
|
* narrower config with project-specific `allowlist` entries, or pass `null`
|
|
199
199
|
* to skip the assertion entirely.
|
|
200
200
|
*/
|
|
201
|
-
export declare const
|
|
201
|
+
export declare const default_error_schema_tightness: ErrorSchemaTightnessOptions;
|
|
202
202
|
/**
|
|
203
203
|
* Assert that all error schemas meet a minimum specificity threshold.
|
|
204
204
|
*
|
|
@@ -467,13 +467,13 @@ const SPECIFICITY_ORDER = {
|
|
|
467
467
|
* them here instead of forcing every consumer to hand-maintain the entry.
|
|
468
468
|
*
|
|
469
469
|
* Paths assume the standard `/api/account` + `/api/db` prefixes used by every
|
|
470
|
-
* fuz_app consumer. Merged into `
|
|
470
|
+
* fuz_app consumer. Merged into `default_error_schema_tightness.allowlist` so
|
|
471
471
|
* consumers calling `assert_error_schema_tightness` directly inherit the
|
|
472
472
|
* exemptions; the standard attack-surface suite also prepends these entries
|
|
473
473
|
* underneath any consumer-supplied allowlist so project-specific entries are
|
|
474
474
|
* additive.
|
|
475
475
|
*/
|
|
476
|
-
export const
|
|
476
|
+
export const fuz_app_stock_route_tightness_allowlist = [];
|
|
477
477
|
/**
|
|
478
478
|
* Baseline error schema tightness applied by
|
|
479
479
|
* `describe_standard_attack_surface_tests` when no config is passed.
|
|
@@ -481,15 +481,15 @@ export const FUZ_APP_STOCK_ROUTE_TIGHTNESS_ALLOWLIST = [];
|
|
|
481
481
|
* Uses `min_specificity: 'enum'` (the assertion default) with `ignore_statuses`
|
|
482
482
|
* for middleware-derived status codes that are commonly generic (auth middleware
|
|
483
483
|
* produces multiple error codes at 401/403, and 429 comes from rate limiters),
|
|
484
|
-
* and `allowlist` seeded with `
|
|
484
|
+
* and `allowlist` seeded with `fuz_app_stock_route_tightness_allowlist` so
|
|
485
485
|
* fuz_app-shipped routes with heterogeneous generic schemas don't force every
|
|
486
486
|
* consumer to hand-maintain an identical allowlist. Consumers can pass a
|
|
487
487
|
* narrower config with project-specific `allowlist` entries, or pass `null`
|
|
488
488
|
* to skip the assertion entirely.
|
|
489
489
|
*/
|
|
490
|
-
export const
|
|
490
|
+
export const default_error_schema_tightness = {
|
|
491
491
|
ignore_statuses: [401, 403, 429],
|
|
492
|
-
allowlist: [...
|
|
492
|
+
allowlist: [...fuz_app_stock_route_tightness_allowlist],
|
|
493
493
|
};
|
|
494
494
|
/**
|
|
495
495
|
* Assert that all error schemas meet a minimum specificity threshold.
|