@fuzdev/fuz_app 0.64.0 → 0.65.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 +513 -928
- package/dist/actions/broadcast_api.d.ts +1 -1
- package/dist/actions/broadcast_api.js +1 -1
- package/dist/actions/cancel.d.ts +2 -2
- package/dist/actions/cancel.js +3 -3
- package/dist/actions/connection_closer.d.ts +1 -4
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +1 -4
- package/dist/actions/register_action_ws.d.ts +2 -2
- package/dist/actions/register_ws_endpoint.d.ts +1 -1
- package/dist/actions/transports_ws_auth_guard.d.ts +1 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +1 -2
- package/dist/auth/CLAUDE.md +591 -1871
- package/dist/auth/account_schema.d.ts +1 -1
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -1
- package/dist/auth/audit_log_ddl.d.ts +1 -1
- package/dist/auth/audit_log_ddl.d.ts.map +1 -1
- package/dist/auth/audit_log_ddl.js +1 -1
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +1 -5
- package/dist/auth/bootstrap_routes.d.ts +7 -1
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +15 -11
- package/dist/auth/keyring.d.ts +6 -6
- package/dist/auth/keyring.js +8 -8
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +4 -2
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +13 -0
- package/dist/dev/setup.d.ts +2 -2
- package/dist/dev/setup.js +3 -3
- package/dist/http/CLAUDE.md +224 -498
- package/dist/http/error_schemas.d.ts +0 -4
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +0 -4
- package/dist/http/ip_canonical.d.ts +5 -4
- package/dist/http/ip_canonical.d.ts.map +1 -1
- package/dist/http/ip_canonical.js +8 -4
- package/dist/http/origin.d.ts +1 -1
- package/dist/http/origin.js +1 -1
- package/dist/runtime/mock.js +1 -1
- package/dist/server/app_server.d.ts +41 -10
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +10 -4
- package/dist/server/env.d.ts +7 -7
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +14 -14
- package/dist/server/static.d.ts +4 -4
- package/dist/server/static.js +7 -7
- package/dist/testing/CLAUDE.md +220 -46
- package/dist/testing/admin_integration.d.ts +18 -23
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +159 -201
- package/dist/testing/app_server.d.ts +125 -38
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +140 -42
- package/dist/testing/audit_completeness.d.ts +23 -22
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +199 -156
- package/dist/testing/bootstrap_success.d.ts +28 -0
- package/dist/testing/bootstrap_success.d.ts.map +1 -0
- package/dist/testing/bootstrap_success.js +144 -0
- package/dist/testing/cross_backend/capabilities.d.ts +64 -0
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -0
- package/dist/testing/cross_backend/capabilities.js +47 -0
- package/dist/testing/cross_backend/setup.d.ts +215 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -0
- package/dist/testing/cross_backend/setup.js +101 -0
- package/dist/testing/data_exposure.d.ts +14 -15
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +127 -146
- package/dist/testing/db_entities.d.ts +11 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +13 -1
- package/dist/testing/integration.d.ts +35 -21
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +231 -291
- package/dist/testing/integration_helpers.d.ts +16 -6
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +7 -7
- package/dist/testing/mock_fs.d.ts.map +1 -1
- package/dist/testing/mock_fs.js +0 -2
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +9 -0
- package/dist/testing/role_grant_helpers.d.ts +31 -0
- package/dist/testing/role_grant_helpers.d.ts.map +1 -0
- package/dist/testing/role_grant_helpers.js +46 -0
- package/dist/testing/round_trip.d.ts +21 -16
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +65 -86
- package/dist/testing/rpc_round_trip.d.ts +24 -21
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +91 -104
- package/dist/testing/schema_introspect.d.ts +106 -0
- package/dist/testing/schema_introspect.d.ts.map +1 -0
- package/dist/testing/schema_introspect.js +123 -0
- package/dist/testing/schema_parity.d.ts +144 -0
- package/dist/testing/schema_parity.d.ts.map +1 -0
- package/dist/testing/schema_parity.js +233 -0
- package/dist/testing/standard.d.ts +57 -25
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +62 -5
- package/dist/testing/stubs.d.ts +11 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/transports/surface_source.d.ts +51 -0
- package/dist/testing/transports/surface_source.d.ts.map +1 -0
- package/dist/testing/transports/surface_source.js +19 -0
- package/package.json +4 -4
|
@@ -74,7 +74,7 @@ export interface RoleGrant {
|
|
|
74
74
|
expires_at: string | null;
|
|
75
75
|
revoked_at: string | null;
|
|
76
76
|
revoked_by: Uuid | null;
|
|
77
|
-
/** Optional free-form reason attached on revoke (
|
|
77
|
+
/** Optional free-form reason attached on revoke (rides on the `role_grant_revoke` WS notification to the revokee). */
|
|
78
78
|
revoked_reason: string | null;
|
|
79
79
|
granted_by: Uuid | null;
|
|
80
80
|
/** Offer that produced this role_grant (set by `query_accept_offer`). `null` for direct grants. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAIxD,mEAAmE;AACnE,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,4FAA4F;AAC5F,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,IAAI,CAAC;IACT,UAAU,EAAE,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAExD,wEAAwE;AACxE,MAAM,WAAW,SAAS;IACz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uB;;;;;;;;;kBASlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,sGAAsG;AACtG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAKhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAI1E,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,0GAA0G;IAC1G,eAAe,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,KAAG,cAMpD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,gBAIlD,CAAC"}
|
|
@@ -51,7 +51,7 @@ export const query_validate_api_token = async (deps, raw_token, ip, pending_effe
|
|
|
51
51
|
ip ?? null,
|
|
52
52
|
row.id,
|
|
53
53
|
])
|
|
54
|
-
.then(() => { })
|
|
54
|
+
.then(() => { })
|
|
55
55
|
.catch((err) => {
|
|
56
56
|
deps.log.error('Failed to update last_used_at:', err);
|
|
57
57
|
});
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
|
-
export declare const AUDIT_LOG_SCHEMA = "\nCREATE TABLE IF NOT EXISTS audit_log (\n id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n seq
|
|
22
|
+
export declare const AUDIT_LOG_SCHEMA = "\nCREATE TABLE IF NOT EXISTS audit_log (\n id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n seq BIGSERIAL NOT NULL,\n event_type TEXT NOT NULL,\n outcome TEXT NOT NULL DEFAULT 'success',\n actor_id UUID REFERENCES actor(id) ON DELETE SET NULL,\n account_id UUID REFERENCES account(id) ON DELETE SET NULL,\n target_account_id UUID REFERENCES account(id) ON DELETE SET NULL,\n target_actor_id UUID REFERENCES actor(id) ON DELETE SET NULL,\n ip TEXT,\n created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n metadata JSONB\n)";
|
|
23
23
|
export declare const AUDIT_LOG_INDEXES: string[];
|
|
24
24
|
//# sourceMappingURL=audit_log_ddl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_ddl.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"audit_log_ddl.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,gBAAgB,ohBAa3B,CAAC;AAEH,eAAO,MAAM,iBAAiB,UAM7B,CAAC"}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
export const AUDIT_LOG_SCHEMA = `
|
|
23
23
|
CREATE TABLE IF NOT EXISTS audit_log (
|
|
24
24
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
25
|
-
seq
|
|
25
|
+
seq BIGSERIAL NOT NULL,
|
|
26
26
|
event_type TEXT NOT NULL,
|
|
27
27
|
outcome TEXT NOT NULL DEFAULT 'success',
|
|
28
28
|
actor_id UUID REFERENCES actor(id) ON DELETE SET NULL,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_account.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_account.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAGnE,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAEpC,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,6DAA6D;AAC7D,MAAM,WAAW,uBAAuB;IACvC,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE;QAAC,MAAM,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAC,CAAC;IACnD,wFAAwF;IACxF,kBAAkB,EAAE,OAAO,CAAC;CAC5B;AAED,gCAAgC;AAChC,MAAM,MAAM,uBAAuB,GAChC;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,0BAA0B,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAC,GAClE;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,wBAAwB,CAAC;IAA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eAAe,CAAC,CAAC;IAClD,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,oBAAoB,EAC1B,gBAAgB,MAAM,EACtB,OAAO,qBAAqB,KAC1B,OAAO,CAAC,sBAAsB,CAuEhC,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { timingSafeEqual } from 'node:crypto';
|
|
10
10
|
import { ERROR_INVALID_TOKEN, ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING, } from '../http/error_schemas.js';
|
|
11
11
|
import { ROLE_ADMIN, ROLE_KEEPER } from './role_schema.js';
|
|
12
|
-
import { query_create_account_with_actor
|
|
12
|
+
import { query_create_account_with_actor } from './account_queries.js';
|
|
13
13
|
import { query_create_role_grant } from './role_grant_queries.js';
|
|
14
14
|
/**
|
|
15
15
|
* Bootstrap the first account with keeper and admin privileges.
|
|
@@ -57,10 +57,6 @@ export const bootstrap_account = async (deps, provided_token, input) => {
|
|
|
57
57
|
if (lock_rows.length === 0) {
|
|
58
58
|
return { ok: false, error: ERROR_ALREADY_BOOTSTRAPPED, status: 403 };
|
|
59
59
|
}
|
|
60
|
-
// Belt-and-suspenders: verify no accounts exist even if lock was available
|
|
61
|
-
if (await query_account_has_any({ db: tx })) {
|
|
62
|
-
return { ok: false, error: ERROR_ALREADY_BOOTSTRAPPED, status: 403 };
|
|
63
|
-
}
|
|
64
60
|
const tx_deps = { db: tx };
|
|
65
61
|
const { account, actor } = await query_create_account_with_actor(tx_deps, {
|
|
66
62
|
username: input.username,
|
|
@@ -26,7 +26,13 @@ export type BootstrapInput = z.infer<typeof BootstrapInput>;
|
|
|
26
26
|
/** Output for `POST /bootstrap`. Session cookie is the operative side effect. */
|
|
27
27
|
export declare const BootstrapOutput: z.ZodObject<{
|
|
28
28
|
ok: z.ZodLiteral<true>;
|
|
29
|
-
|
|
29
|
+
account: z.ZodObject<{
|
|
30
|
+
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
31
|
+
username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
actor: z.ZodObject<{
|
|
34
|
+
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
35
|
+
}, z.core.$strict>;
|
|
30
36
|
}, z.core.$strict>;
|
|
31
37
|
export type BootstrapOutput = z.infer<typeof BootstrapOutput>;
|
|
32
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAoB,KAAK,uBAAuB,EAAC,MAAM,wBAAwB,CAAC;AAGvF,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAkB,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAA+B,KAAK,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAClF,O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xC,MAAM,gBAAgB,EACtB,SAAS,qBAAqB,KAC5B,KAAK,CAAC,SAAS,CAkHjB,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
+
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
10
11
|
import { create_session_and_set_cookie } from './session_middleware.js';
|
|
11
12
|
import { bootstrap_account } from './bootstrap_account.js';
|
|
12
13
|
import { Username } from '../primitive_schemas.js';
|
|
@@ -14,7 +15,7 @@ import { Password } from './password.js';
|
|
|
14
15
|
import { get_route_input } from '../http/route_spec.js';
|
|
15
16
|
import { get_client_ip } from '../http/proxy.js';
|
|
16
17
|
import { rate_limit_exceeded_response } from '../rate_limiter.js';
|
|
17
|
-
import {
|
|
18
|
+
import { ERROR_INVALID_TOKEN, ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY, } from '../http/error_schemas.js';
|
|
18
19
|
// -- Input/output schemas ---------------------------------------------------
|
|
19
20
|
/** Input for `POST /bootstrap`. `token` is the one-shot token file contents. */
|
|
20
21
|
export const BootstrapInput = z.strictObject({
|
|
@@ -25,7 +26,8 @@ export const BootstrapInput = z.strictObject({
|
|
|
25
26
|
/** Output for `POST /bootstrap`. Session cookie is the operative side effect. */
|
|
26
27
|
export const BootstrapOutput = z.strictObject({
|
|
27
28
|
ok: z.literal(true),
|
|
28
|
-
|
|
29
|
+
account: z.strictObject({ id: Uuid, username: Username }),
|
|
30
|
+
actor: z.strictObject({ id: Uuid }),
|
|
29
31
|
});
|
|
30
32
|
/**
|
|
31
33
|
* Check bootstrap availability at startup.
|
|
@@ -85,13 +87,14 @@ export const create_bootstrap_route_specs = (deps, options) => {
|
|
|
85
87
|
}),
|
|
86
88
|
401: z.looseObject({ error: z.literal(ERROR_INVALID_TOKEN) }),
|
|
87
89
|
403: z.looseObject({ error: z.literal(ERROR_ALREADY_BOOTSTRAPPED) }),
|
|
88
|
-
404: z.looseObject({
|
|
89
|
-
error: z.enum([ERROR_TOKEN_FILE_MISSING, ERROR_BOOTSTRAP_NOT_CONFIGURED]),
|
|
90
|
-
}),
|
|
90
|
+
404: z.looseObject({ error: z.literal(ERROR_TOKEN_FILE_MISSING) }),
|
|
91
91
|
},
|
|
92
92
|
handler: async (c, route) => {
|
|
93
|
-
// Short-circuit if bootstrap already completed
|
|
94
|
-
|
|
93
|
+
// Short-circuit if bootstrap already completed or surface-only mounted.
|
|
94
|
+
// In 'surface_only' mode `bootstrap_status.token_path === null` and
|
|
95
|
+
// `available === false`; in 'live' mode after success `available` flips
|
|
96
|
+
// to `false`. Either way the wire shape is 403 ALREADY_BOOTSTRAPPED.
|
|
97
|
+
if (!bootstrap_status.available || token_path === null) {
|
|
95
98
|
return c.json({ error: ERROR_ALREADY_BOOTSTRAPPED }, 403);
|
|
96
99
|
}
|
|
97
100
|
// Per-IP rate limit check (before any token/DB work)
|
|
@@ -103,9 +106,6 @@ export const create_bootstrap_route_specs = (deps, options) => {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
const input = get_route_input(c);
|
|
106
|
-
if (token_path === null) {
|
|
107
|
-
return c.json({ error: ERROR_BOOTSTRAP_NOT_CONFIGURED }, 404);
|
|
108
|
-
}
|
|
109
109
|
// `transaction: false` makes `route.db` the pool. `bootstrap_account`
|
|
110
110
|
// manages its own transaction internally.
|
|
111
111
|
const result = await bootstrap_account({
|
|
@@ -158,7 +158,11 @@ export const create_bootstrap_route_specs = (deps, options) => {
|
|
|
158
158
|
if (!result.token_file_deleted) {
|
|
159
159
|
throw new Error(`Bootstrap succeeded but token file was not deleted at ${token_path}. Delete it manually and log in.`);
|
|
160
160
|
}
|
|
161
|
-
return c.json({
|
|
161
|
+
return c.json({
|
|
162
|
+
ok: true,
|
|
163
|
+
account: { id: result.account.id, username: result.account.username },
|
|
164
|
+
actor: { id: result.actor.id },
|
|
165
|
+
});
|
|
162
166
|
},
|
|
163
167
|
},
|
|
164
168
|
];
|
package/dist/auth/keyring.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
|
-
* const keyring = create_keyring(process.env.
|
|
10
|
+
* const keyring = create_keyring(process.env.SECRET_FUZ_COOKIE_KEYS);
|
|
11
11
|
* if (!keyring) throw new Error('No keys configured');
|
|
12
12
|
*
|
|
13
13
|
* const signed = await keyring.sign('user:123:1700000000');
|
|
@@ -47,12 +47,12 @@ export interface Keyring {
|
|
|
47
47
|
*
|
|
48
48
|
* **Security: key rotation is an operational concern.** Old keys remain valid
|
|
49
49
|
* for verification indefinitely — a leaked old key can forge session cookies
|
|
50
|
-
* until it is removed from `
|
|
50
|
+
* until it is removed from `SECRET_FUZ_COOKIE_KEYS`. After rotating to a new
|
|
51
51
|
* signing key, remove the old key within a grace period (e.g. 24–48 hours,
|
|
52
52
|
* long enough for active sessions to re-sign with the new key via cookie
|
|
53
|
-
* refresh). Treat `
|
|
53
|
+
* refresh). Treat `SECRET_FUZ_COOKIE_KEYS` changes as security-critical deploys.
|
|
54
54
|
*
|
|
55
|
-
* @param env_value - the
|
|
55
|
+
* @param env_value - the SECRET_FUZ_COOKIE_KEYS environment variable
|
|
56
56
|
* @returns keyring or null if no keys configured
|
|
57
57
|
*/
|
|
58
58
|
export declare const create_keyring: (env_value: string | undefined) => Keyring | null;
|
|
@@ -63,7 +63,7 @@ export declare const create_keyring: (env_value: string | undefined) => Keyring
|
|
|
63
63
|
* or all-separator input like `'____'`), and for each key shorter than
|
|
64
64
|
* `MIN_KEY_LENGTH` characters.
|
|
65
65
|
*
|
|
66
|
-
* @param env_value - the
|
|
66
|
+
* @param env_value - the SECRET_FUZ_COOKIE_KEYS environment variable
|
|
67
67
|
* @returns array of validation errors (empty if valid)
|
|
68
68
|
*/
|
|
69
69
|
export declare const validate_keyring: (env_value: string | undefined) => Array<string>;
|
|
@@ -84,7 +84,7 @@ export type ValidatedKeyringResult = {
|
|
|
84
84
|
* Returns a discriminated union so callers handle exit/logging their own way
|
|
85
85
|
* (e.g. `Deno.exit(1)` vs `runtime.exit(1)`).
|
|
86
86
|
*
|
|
87
|
-
* @param env_value - the
|
|
87
|
+
* @param env_value - the SECRET_FUZ_COOKIE_KEYS environment variable
|
|
88
88
|
* @returns `{ok: true, keyring}` or `{ok: false, errors}`
|
|
89
89
|
*/
|
|
90
90
|
export declare const create_validated_keyring: (env_value: string | undefined) => ValidatedKeyringResult;
|
package/dist/auth/keyring.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
|
-
* const keyring = create_keyring(process.env.
|
|
10
|
+
* const keyring = create_keyring(process.env.SECRET_FUZ_COOKIE_KEYS);
|
|
11
11
|
* if (!keyring) throw new Error('No keys configured');
|
|
12
12
|
*
|
|
13
13
|
* const signed = await keyring.sign('user:123:1700000000');
|
|
@@ -30,12 +30,12 @@ const encoder = new TextEncoder();
|
|
|
30
30
|
*
|
|
31
31
|
* **Security: key rotation is an operational concern.** Old keys remain valid
|
|
32
32
|
* for verification indefinitely — a leaked old key can forge session cookies
|
|
33
|
-
* until it is removed from `
|
|
33
|
+
* until it is removed from `SECRET_FUZ_COOKIE_KEYS`. After rotating to a new
|
|
34
34
|
* signing key, remove the old key within a grace period (e.g. 24–48 hours,
|
|
35
35
|
* long enough for active sessions to re-sign with the new key via cookie
|
|
36
|
-
* refresh). Treat `
|
|
36
|
+
* refresh). Treat `SECRET_FUZ_COOKIE_KEYS` changes as security-critical deploys.
|
|
37
37
|
*
|
|
38
|
-
* @param env_value - the
|
|
38
|
+
* @param env_value - the SECRET_FUZ_COOKIE_KEYS environment variable
|
|
39
39
|
* @returns keyring or null if no keys configured
|
|
40
40
|
*/
|
|
41
41
|
export const create_keyring = (env_value) => {
|
|
@@ -75,13 +75,13 @@ export const create_keyring = (env_value) => {
|
|
|
75
75
|
* or all-separator input like `'____'`), and for each key shorter than
|
|
76
76
|
* `MIN_KEY_LENGTH` characters.
|
|
77
77
|
*
|
|
78
|
-
* @param env_value - the
|
|
78
|
+
* @param env_value - the SECRET_FUZ_COOKIE_KEYS environment variable
|
|
79
79
|
* @returns array of validation errors (empty if valid)
|
|
80
80
|
*/
|
|
81
81
|
export const validate_keyring = (env_value) => {
|
|
82
82
|
const keys = parse_keys(env_value);
|
|
83
83
|
if (keys.length === 0) {
|
|
84
|
-
return ['
|
|
84
|
+
return ['SECRET_FUZ_COOKIE_KEYS is required'];
|
|
85
85
|
}
|
|
86
86
|
const errors = [];
|
|
87
87
|
for (const [i, key] of keys.entries()) {
|
|
@@ -126,7 +126,7 @@ const verify_with_crypto_key = async (signed_value, key) => {
|
|
|
126
126
|
* Returns a discriminated union so callers handle exit/logging their own way
|
|
127
127
|
* (e.g. `Deno.exit(1)` vs `runtime.exit(1)`).
|
|
128
128
|
*
|
|
129
|
-
* @param env_value - the
|
|
129
|
+
* @param env_value - the SECRET_FUZ_COOKIE_KEYS environment variable
|
|
130
130
|
* @returns `{ok: true, keyring}` or `{ok: false, errors}`
|
|
131
131
|
*/
|
|
132
132
|
export const create_validated_keyring = (env_value) => {
|
|
@@ -136,7 +136,7 @@ export const create_validated_keyring = (env_value) => {
|
|
|
136
136
|
}
|
|
137
137
|
const keyring = create_keyring(env_value);
|
|
138
138
|
if (!keyring) {
|
|
139
|
-
return { ok: false, errors: ['
|
|
139
|
+
return { ok: false, errors: ['SECRET_FUZ_COOKIE_KEYS is required'] };
|
|
140
140
|
}
|
|
141
141
|
return { ok: true, keyring };
|
|
142
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAE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AC"}
|
|
@@ -130,8 +130,10 @@ export const create_role_grant_offer_actions = (deps, options = {}) => {
|
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
132
|
// Returns {offer} only — no auto-accept. Recipient must call
|
|
133
|
-
// role_grant_offer_accept; admin tests
|
|
134
|
-
//
|
|
133
|
+
// role_grant_offer_accept; admin tests drive the full consent flow over
|
|
134
|
+
// RPC (see testing/admin_integration.ts `offer_and_accept`), or seed
|
|
135
|
+
// role_grants directly via create_test_role_grant_direct when the
|
|
136
|
+
// test isn't about the consent path.
|
|
135
137
|
const create_handler = async (input, ctx) => {
|
|
136
138
|
const auth = ctx.auth;
|
|
137
139
|
// Role must include the admin grant path — same gate as admin direct-grant.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/create_db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAIxC,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,EAAE,CAAC;IACP,iFAAiF;IACjF,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"create_db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/create_db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAIxC,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,EAAE,CAAC;IACP,iFAAiF;IACjF,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,cAAc,CA6C5E,CAAC"}
|
package/dist/db/create_db.js
CHANGED
|
@@ -32,6 +32,19 @@ import { create_pglite_db } from './db_pglite.js';
|
|
|
32
32
|
export const create_db = async (database_url) => {
|
|
33
33
|
if (database_url.startsWith('postgres://') || database_url.startsWith('postgresql://')) {
|
|
34
34
|
const { default: pg } = await import('pg');
|
|
35
|
+
// Parse int8 (BIGINT) as a JS number. pg defaults to returning int8
|
|
36
|
+
// as a string to avoid 2^53 precision loss; our only int8 column
|
|
37
|
+
// today (`audit_log.seq`) stays well under that bound, and reading
|
|
38
|
+
// as number keeps the wire shape uniform across the SERIAL→BIGSERIAL
|
|
39
|
+
// widening.
|
|
40
|
+
//
|
|
41
|
+
// CAVEAT: pg.types.setTypeParser mutates pg.types globally — every
|
|
42
|
+
// pg.Pool in the process inherits the coercion, including pools the
|
|
43
|
+
// consumer constructs against unrelated databases. Any future int8
|
|
44
|
+
// column that could legitimately exceed 2^53 (file sizes, byte
|
|
45
|
+
// offsets) will silently round; if one lands, localize via a
|
|
46
|
+
// per-pool `types` override instead of widening this global parser.
|
|
47
|
+
pg.types.setTypeParser(20, (val) => Number(val));
|
|
35
48
|
const pool = new pg.Pool({ connectionString: database_url });
|
|
36
49
|
const { db, close } = create_pg_db(pool);
|
|
37
50
|
return {
|
package/dist/dev/setup.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface ResetDbResult {
|
|
|
51
51
|
/** Options for `setup_env_file`. */
|
|
52
52
|
export interface SetupEnvOptions {
|
|
53
53
|
/**
|
|
54
|
-
* Extra env var replacements beyond the default `
|
|
54
|
+
* Extra env var replacements beyond the default `SECRET_FUZ_COOKIE_KEYS`.
|
|
55
55
|
*
|
|
56
56
|
* Keys are env var names, values are async generators.
|
|
57
57
|
* Replaces `^KEY=$` (empty value) patterns in the env file.
|
|
@@ -103,7 +103,7 @@ export declare const generate_random_key: (deps: CommandDeps) => Promise<string>
|
|
|
103
103
|
*/
|
|
104
104
|
export declare const read_env_var: (deps: Pick<FsReadDeps, "stat" | "read_text_file">, env_path: string, name: string) => Promise<string | undefined>;
|
|
105
105
|
/**
|
|
106
|
-
* Create an env file from its example template, auto-generating `
|
|
106
|
+
* Create an env file from its example template, auto-generating `SECRET_FUZ_COOKIE_KEYS`.
|
|
107
107
|
*
|
|
108
108
|
* If the file already exists, backfills any empty values that have generators.
|
|
109
109
|
* Idempotent — safe to re-run.
|
package/dist/dev/setup.js
CHANGED
|
@@ -69,7 +69,7 @@ export const read_env_var = async (deps, env_path, name) => {
|
|
|
69
69
|
};
|
|
70
70
|
// === Setup helpers ===
|
|
71
71
|
/**
|
|
72
|
-
* Create an env file from its example template, auto-generating `
|
|
72
|
+
* Create an env file from its example template, auto-generating `SECRET_FUZ_COOKIE_KEYS`.
|
|
73
73
|
*
|
|
74
74
|
* If the file already exists, backfills any empty values that have generators.
|
|
75
75
|
* Idempotent — safe to re-run.
|
|
@@ -84,9 +84,9 @@ export const read_env_var = async (deps, env_path, name) => {
|
|
|
84
84
|
export const setup_env_file = async (deps, env_path, example_path, options) => {
|
|
85
85
|
const log = options?.log ?? default_setup_logger;
|
|
86
86
|
const set_permissions = options?.set_permissions;
|
|
87
|
-
// build the full replacement map (
|
|
87
|
+
// build the full replacement map (SECRET_FUZ_COOKIE_KEYS + extras)
|
|
88
88
|
const replacements = {
|
|
89
|
-
|
|
89
|
+
SECRET_FUZ_COOKIE_KEYS: () => generate_random_key(deps),
|
|
90
90
|
...options?.replacements,
|
|
91
91
|
};
|
|
92
92
|
const stat = await deps.stat(env_path);
|