@bevel-software/platform-core-backend 0.27.0 → 0.28.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.
Files changed (95) hide show
  1. package/dist/core/create-core-server.d.ts.map +1 -1
  2. package/dist/core/create-core-server.js +2 -2
  3. package/dist/core/create-core-server.js.map +1 -1
  4. package/dist/core/create-core-services.d.ts +7 -0
  5. package/dist/core/create-core-services.d.ts.map +1 -1
  6. package/dist/core/create-core-services.js +5 -0
  7. package/dist/core/create-core-services.js.map +1 -1
  8. package/dist/modules/access/access-control.interface.d.ts +9 -0
  9. package/dist/modules/access/access-control.interface.d.ts.map +1 -1
  10. package/dist/modules/access/access-control.service.d.ts +1 -0
  11. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  12. package/dist/modules/access/access-control.service.js +20 -0
  13. package/dist/modules/access/access-control.service.js.map +1 -1
  14. package/dist/modules/access/access.routes.d.ts +4 -1
  15. package/dist/modules/access/access.routes.d.ts.map +1 -1
  16. package/dist/modules/access/access.routes.js +66 -7
  17. package/dist/modules/access/access.routes.js.map +1 -1
  18. package/dist/modules/access/roles-admin.service.d.ts +35 -6
  19. package/dist/modules/access/roles-admin.service.d.ts.map +1 -1
  20. package/dist/modules/access/roles-admin.service.js +36 -9
  21. package/dist/modules/access/roles-admin.service.js.map +1 -1
  22. package/dist/modules/access/user-access-removal.service.js +1 -1
  23. package/dist/modules/access/user-access-removal.service.js.map +1 -1
  24. package/dist/modules/auth/account-hooks.d.ts +46 -0
  25. package/dist/modules/auth/account-hooks.d.ts.map +1 -0
  26. package/dist/modules/auth/account-hooks.js +25 -0
  27. package/dist/modules/auth/account-hooks.js.map +1 -0
  28. package/dist/modules/auth/account-switch-guard.d.ts +15 -0
  29. package/dist/modules/auth/account-switch-guard.d.ts.map +1 -0
  30. package/dist/modules/auth/account-switch-guard.js +2 -0
  31. package/dist/modules/auth/account-switch-guard.js.map +1 -0
  32. package/dist/modules/auth/account-switch-lock.d.ts +34 -0
  33. package/dist/modules/auth/account-switch-lock.d.ts.map +1 -0
  34. package/dist/modules/auth/account-switch-lock.js +48 -0
  35. package/dist/modules/auth/account-switch-lock.js.map +1 -0
  36. package/dist/modules/auth/account.routes.d.ts +4 -1
  37. package/dist/modules/auth/account.routes.d.ts.map +1 -1
  38. package/dist/modules/auth/account.routes.js +100 -10
  39. package/dist/modules/auth/account.routes.js.map +1 -1
  40. package/dist/modules/auth/auth.service.d.ts +101 -6
  41. package/dist/modules/auth/auth.service.d.ts.map +1 -1
  42. package/dist/modules/auth/auth.service.js +246 -51
  43. package/dist/modules/auth/auth.service.js.map +1 -1
  44. package/dist/modules/auth/password-hash.d.ts +5 -2
  45. package/dist/modules/auth/password-hash.d.ts.map +1 -1
  46. package/dist/modules/auth/password-hash.js +5 -2
  47. package/dist/modules/auth/password-hash.js.map +1 -1
  48. package/dist/modules/database/pg-error.d.ts +9 -0
  49. package/dist/modules/database/pg-error.d.ts.map +1 -0
  50. package/dist/modules/database/pg-error.js +17 -0
  51. package/dist/modules/database/pg-error.js.map +1 -0
  52. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  53. package/dist/modules/workflow/workflow.service.js +2 -1
  54. package/dist/modules/workflow/workflow.service.js.map +1 -1
  55. package/package.json +3 -3
  56. package/src/__tests__/pg-scratch.ts +48 -0
  57. package/src/core/create-core-server.ts +2 -0
  58. package/src/core/create-core-services.ts +11 -0
  59. package/src/modules/access/__tests__/access-control.admin-root-floor.test.ts +1 -0
  60. package/src/modules/access/__tests__/access.routes.admins.test.ts +203 -0
  61. package/src/modules/access/__tests__/access.routes.batch.test.ts +25 -5
  62. package/src/modules/access/__tests__/access.routes.folder-governs.test.ts +1 -0
  63. package/src/modules/access/__tests__/access.routes.group-grant.test.ts +1 -1
  64. package/src/modules/access/__tests__/access.routes.overrides.test.ts +1 -1
  65. package/src/modules/access/__tests__/access.routes.proposal-branch.test.ts +1 -0
  66. package/src/modules/access/__tests__/access.routes.prospective.test.ts +1 -0
  67. package/src/modules/access/__tests__/access.routes.revoke.test.ts +1 -1
  68. package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +1 -0
  69. package/src/modules/access/__tests__/roles-admin.security.test.ts +1 -1
  70. package/src/modules/access/__tests__/roles-admin.service.test.ts +15 -2
  71. package/src/modules/access/__tests__/roles.routes.test.ts +132 -7
  72. package/src/modules/access/__tests__/user-access-removal.service.test.ts +2 -2
  73. package/src/modules/access/__tests__/users-db-double.ts +12 -3
  74. package/src/modules/access/access-control.interface.ts +10 -0
  75. package/src/modules/access/access-control.service.ts +19 -0
  76. package/src/modules/access/access.routes.ts +67 -6
  77. package/src/modules/access/roles-admin.service.ts +51 -11
  78. package/src/modules/access/user-access-removal.service.ts +1 -1
  79. package/src/modules/auth/__tests__/account-deactivation.test.ts +145 -16
  80. package/src/modules/auth/__tests__/account-hooks.test.ts +57 -0
  81. package/src/modules/auth/__tests__/account-switch-lock.pg.test.ts +78 -0
  82. package/src/modules/auth/__tests__/account-switch-lock.test.ts +43 -0
  83. package/src/modules/auth/__tests__/account.routes.test.ts +382 -6
  84. package/src/modules/auth/__tests__/auth.service.created.pg.test.ts +69 -0
  85. package/src/modules/auth/__tests__/auth.service.test.ts +159 -1
  86. package/src/modules/auth/account-hooks.ts +69 -0
  87. package/src/modules/auth/account-switch-guard.ts +14 -0
  88. package/src/modules/auth/account-switch-lock.ts +58 -0
  89. package/src/modules/auth/account.routes.ts +112 -10
  90. package/src/modules/auth/auth.service.ts +268 -52
  91. package/src/modules/auth/password-hash.ts +5 -2
  92. package/src/modules/database/__tests__/pg-error.test.ts +21 -0
  93. package/src/modules/database/__tests__/pii-backfill.pg.test.ts +6 -27
  94. package/src/modules/database/pg-error.ts +15 -0
  95. package/src/modules/workflow/workflow.service.ts +2 -1
@@ -0,0 +1,46 @@
1
+ import type { AuthUser } from '@bevel-software/platform-shared';
2
+ /**
3
+ * An admin invited somebody: a NEW account was made for the address. Never
4
+ * raised for an account that was already there (an invite that only set a
5
+ * starting password, a password reset, a rename), and never for a first
6
+ * single sign-on, which provisions by itself: the person is already in.
7
+ */
8
+ export interface AccountInvitedEvent {
9
+ /** The new account, as the admin's answer carries it. */
10
+ account: Pick<AuthUser, 'id' | 'email' | 'name'>;
11
+ /** The admin who invited them. */
12
+ invitedBy: Pick<AuthUser, 'id' | 'email' | 'name'>;
13
+ /**
14
+ * Whether the account was created with a starting password the admin
15
+ * typed. The password itself never travels: a listener that writes to the
16
+ * person says it comes from the admin separately.
17
+ */
18
+ passwordSet: boolean;
19
+ }
20
+ /**
21
+ * A listener answers how it reached the person — a non-empty channel name,
22
+ * `'email'` say — or null when it did not (nothing configured, the send
23
+ * failed). It is awaited: the admin's answer says who was notified,
24
+ * truthfully, so a listener bounds its own wait. A throw is logged and
25
+ * counts as null; it never fails the invite. An empty name is no channel and
26
+ * counts as null too.
27
+ */
28
+ export type AccountInvitedHook = (event: AccountInvitedEvent) => Promise<string | null>;
29
+ /**
30
+ * Core's seam for "an account was invited": a deployment (the cloud with its
31
+ * mail, an enterprise overlay) registers how to tell the person, and core
32
+ * says in its answer whether somebody did. Core registers nothing, so a
33
+ * core-only deployment notifies nobody and the admin is handed the link and
34
+ * the message to send, as before.
35
+ */
36
+ export interface IAccountHooks {
37
+ onAccountInvited(hook: AccountInvitedHook): void;
38
+ /** Run every listener in registration order; the channels that reached the person, in that order. */
39
+ runAccountInvited(event: AccountInvitedEvent): Promise<string[]>;
40
+ }
41
+ export declare class AccountHooks implements IAccountHooks {
42
+ private readonly invited;
43
+ onAccountInvited(hook: AccountInvitedHook): void;
44
+ runAccountInvited(event: AccountInvitedEvent): Promise<string[]>;
45
+ }
46
+ //# sourceMappingURL=account-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-hooks.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/account-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAKhE;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IACjD,kCAAkC;IAClC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IACnD;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjD,qGAAqG;IACrG,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAClE;AAED,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAI1C,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAcvE"}
@@ -0,0 +1,25 @@
1
+ import { logger } from '../../shared/logging.js';
2
+ const log = logger('accounts');
3
+ export class AccountHooks {
4
+ invited = [];
5
+ onAccountInvited(hook) {
6
+ this.invited.push(hook);
7
+ }
8
+ async runAccountInvited(event) {
9
+ const notified = [];
10
+ for (const hook of this.invited) {
11
+ try {
12
+ const channel = await hook(event);
13
+ if (channel !== null && channel !== '')
14
+ notified.push(channel);
15
+ }
16
+ catch (err) {
17
+ // The account exists whether or not the person was told: the admin's
18
+ // answer says they were not, and the admin sends the link themselves.
19
+ log.error('an account-invited listener failed; the person was not notified by it:', { err });
20
+ }
21
+ }
22
+ return notified;
23
+ }
24
+ }
25
+ //# sourceMappingURL=account-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-hooks.js","sourceRoot":"","sources":["../../../src/modules/auth/account-hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AA4C/B,MAAM,OAAO,YAAY;IACN,OAAO,GAAyB,EAAE,CAAC;IAEpD,gBAAgB,CAAC,IAAwB;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAA0B;QAChD,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,EAAE;oBAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACjE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,qEAAqE;gBACrE,sEAAsE;gBACtE,GAAG,CAAC,KAAK,CAAC,wEAAwE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YAC/F,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Auth's contract for a write that must not land on a switched-off account:
3
+ * `whileSwitchedOn` runs `write` only while `email` is not switched off, and
4
+ * keeps it so until `write` has finished. A switch-off either committed
5
+ * before the check (`write` is refused with a 409 `deactivated` and never
6
+ * runs) or waits until `write` is done. An address with no account yet counts
7
+ * as switched on.
8
+ *
9
+ * Implemented by `AuthService`; other modules take this contract, not the
10
+ * service, so how auth coordinates switch-offs stays its own.
11
+ */
12
+ export interface IAccountSwitchGuard {
13
+ whileSwitchedOn(email: string, write: () => Promise<void>): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=account-switch-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-switch-guard.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/account-switch-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=account-switch-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-switch-guard.js","sourceRoot":"","sources":["../../../src/modules/auth/account-switch-guard.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import type { Database } from '../database/connection.js';
2
+ /** The handle `db.transaction` hands its callback. */
3
+ type Tx = Parameters<Parameters<Database['transaction']>[0]>[0];
4
+ /**
5
+ * How long a switch-off or a promotion waits for the address's lock. The
6
+ * holder may be a promotion committing `roles.yaml` (a git commit and push,
7
+ * seconds), so the wait is generous; it is bounded all the same, for the
8
+ * reason `database/advisory-lock.ts` gives: a waiter blocked for good sits
9
+ * on a pooled connection, and a wedged holder would take the pool with it.
10
+ */
11
+ export declare const ACCOUNT_SWITCH_LOCK_WAIT_MS = 15000;
12
+ /** What a caller is told when the wait ran out: a 409, to try again shortly. */
13
+ export declare const ACCOUNT_BUSY_MESSAGE = "Another change to this account is still being saved; try again in a moment.";
14
+ /**
15
+ * Hold, for the rest of `tx`, the one lock that orders an address's switch-off
16
+ * against a write that must not land on a switched-off account (the invite's
17
+ * Admin promotion).
18
+ *
19
+ * A row lock cannot do it: an address with no account yet has no row, and an
20
+ * account can be created switched off (single sign-on waiting for an admin)
21
+ * or created and switched off while the promotion is being written. So the
22
+ * lock is a transaction-scoped advisory lock on the canonical address, taken
23
+ * by every write that switches an account off and by the promotion, before
24
+ * either reads the row. Whichever comes second waits for the first to commit,
25
+ * then reads what it committed (READ COMMITTED takes a fresh snapshot per
26
+ * statement). A different address that hashes to the same key only waits.
27
+ *
28
+ * The wait is bounded by a transaction-local `lock_timeout`
29
+ * ({@link ACCOUNT_SWITCH_LOCK_WAIT_MS}), which the transaction's end reverts
30
+ * with everything else; running out of it is answered as a 409 `account-busy`.
31
+ */
32
+ export declare function takeAccountSwitchLock(tx: Pick<Tx, 'execute'>, email: string, waitMs?: number): Promise<void>;
33
+ export {};
34
+ //# sourceMappingURL=account-switch-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-switch-lock.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/account-switch-lock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAK1D,sDAAsD;AACtD,KAAK,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAKlD,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,gFAAgF,CAAC;AAElH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,EACvB,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,MAAoC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAWf"}
@@ -0,0 +1,48 @@
1
+ import { sql } from 'drizzle-orm';
2
+ import { canonicalEmail } from '../../shared/email-identity.js';
3
+ import { WorkflowDomainError } from '../../shared/domain-errors.js';
4
+ import { pgErrorCode } from '../database/pg-error.js';
5
+ /**
6
+ * How long a switch-off or a promotion waits for the address's lock. The
7
+ * holder may be a promotion committing `roles.yaml` (a git commit and push,
8
+ * seconds), so the wait is generous; it is bounded all the same, for the
9
+ * reason `database/advisory-lock.ts` gives: a waiter blocked for good sits
10
+ * on a pooled connection, and a wedged holder would take the pool with it.
11
+ */
12
+ export const ACCOUNT_SWITCH_LOCK_WAIT_MS = 15_000;
13
+ /** Postgres raises this when `lock_timeout` expires while waiting for a lock. */
14
+ const LOCK_NOT_AVAILABLE = '55P03';
15
+ /** What a caller is told when the wait ran out: a 409, to try again shortly. */
16
+ export const ACCOUNT_BUSY_MESSAGE = 'Another change to this account is still being saved; try again in a moment.';
17
+ /**
18
+ * Hold, for the rest of `tx`, the one lock that orders an address's switch-off
19
+ * against a write that must not land on a switched-off account (the invite's
20
+ * Admin promotion).
21
+ *
22
+ * A row lock cannot do it: an address with no account yet has no row, and an
23
+ * account can be created switched off (single sign-on waiting for an admin)
24
+ * or created and switched off while the promotion is being written. So the
25
+ * lock is a transaction-scoped advisory lock on the canonical address, taken
26
+ * by every write that switches an account off and by the promotion, before
27
+ * either reads the row. Whichever comes second waits for the first to commit,
28
+ * then reads what it committed (READ COMMITTED takes a fresh snapshot per
29
+ * statement). A different address that hashes to the same key only waits.
30
+ *
31
+ * The wait is bounded by a transaction-local `lock_timeout`
32
+ * ({@link ACCOUNT_SWITCH_LOCK_WAIT_MS}), which the transaction's end reverts
33
+ * with everything else; running out of it is answered as a 409 `account-busy`.
34
+ */
35
+ export async function takeAccountSwitchLock(tx, email, waitMs = ACCOUNT_SWITCH_LOCK_WAIT_MS) {
36
+ await tx.execute(sql `select set_config('lock_timeout', ${String(waitMs)}, true)`);
37
+ try {
38
+ await tx.execute(sql `select pg_advisory_xact_lock(hashtext(${`account-switch:${canonicalEmail(email)}`}))`);
39
+ }
40
+ catch (err) {
41
+ // Drizzle wraps the driver's error, so the SQLSTATE is on its cause.
42
+ if (pgErrorCode(err) === LOCK_NOT_AVAILABLE) {
43
+ throw new WorkflowDomainError(ACCOUNT_BUSY_MESSAGE, 409, { kind: 'account-busy' });
44
+ }
45
+ throw err;
46
+ }
47
+ }
48
+ //# sourceMappingURL=account-switch-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-switch-lock.js","sourceRoot":"","sources":["../../../src/modules/auth/account-switch-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAElD,iFAAiF;AACjF,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEnC,gFAAgF;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG,6EAA6E,CAAC;AAElH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,EAAuB,EACvB,KAAa,EACb,SAAiB,2BAA2B;IAE5C,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAA,qCAAqC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAClF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAA,yCAAyC,kBAAkB,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9G,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qEAAqE;QACrE,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,kBAAkB,EAAE,CAAC;YAC5C,MAAM,IAAI,mBAAmB,CAAC,oBAAoB,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import express from 'express';
2
2
  import type { AuthService } from './auth.service.js';
3
+ import type { IAccountHooks } from './account-hooks.js';
3
4
  import { type IAccountErasureService } from './account-erasure.service.js';
4
5
  import type { IAdminAccessService } from '../admin/admin.interface.js';
5
6
  import type { UserAccessRemovalService } from '../access/user-access-removal.service.js';
@@ -15,5 +16,7 @@ import './auth.middleware.js';
15
16
  * {@link IAdminAccessService} — the Admin role in `roles.yaml`, plus the env
16
17
  * bootstrap admin (always-admin, see AdminAccessService).
17
18
  */
18
- export declare function createAccountRoutes(authService: Pick<AuthService, 'listAccounts' | 'createAccount' | 'getUserById' | 'deactivate' | 'reactivate'>, adminAccess: IAdminAccessService, accountErasure: Pick<IAccountErasureService, 'eraseUser'>, accessRemoval?: Pick<UserAccessRemovalService, 'report' | 'assertRemovable' | 'remove' | 'filesNaming'>): express.Router;
19
+ export declare function createAccountRoutes(authService: Pick<AuthService, 'listAccounts' | 'createAccount' | 'createAccountWithoutPassword' | 'createAccountWithStartingPassword' | 'getUserById' | 'deactivate' | 'reactivate' | 'isOwnerEmail' | 'assertDeletable'>, adminAccess: IAdminAccessService, accountErasure: Pick<IAccountErasureService, 'eraseUser'>,
20
+ /** Who tells an invited person (see {@link IAccountHooks}); core registers nobody. */
21
+ accountHooks: Pick<IAccountHooks, 'runAccountInvited'>, accessRemoval?: Pick<UserAccessRemovalService, 'report' | 'assertRemovable' | 'remove' | 'filesNaming'>): express.Router;
19
22
  //# sourceMappingURL=account.routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.routes.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/account.routes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAO9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,wBAA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AC,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,GAAG,aAAa,CAAC,GACtG,OAAO,CAAC,MAAM,CAkThB"}
@@ -7,6 +7,7 @@ import { AccountAdmissionRefusedError, AccountChangeRefusedError } from './accou
7
7
  import { erasedAccountId } from './account-erasure.service.js';
8
8
  import { sendError } from '../access/admin-route-helpers.js';
9
9
  import { WorkflowDomainError } from '../../shared/domain-errors.js';
10
+ import { canonicalEmail } from '../../shared/email-identity.js';
10
11
  import './auth.middleware.js'; // Express Request augmentation
11
12
  /**
12
13
  * Admin account management — the ONE account surface (the core User Accounts
@@ -19,7 +20,9 @@ import './auth.middleware.js'; // Express Request augmentation
19
20
  * {@link IAdminAccessService} — the Admin role in `roles.yaml`, plus the env
20
21
  * bootstrap admin (always-admin, see AdminAccessService).
21
22
  */
22
- export function createAccountRoutes(authService, adminAccess, accountErasure, accessRemoval) {
23
+ export function createAccountRoutes(authService, adminAccess, accountErasure,
24
+ /** Who tells an invited person (see {@link IAccountHooks}); core registers nobody. */
25
+ accountHooks, accessRemoval) {
23
26
  const router = express.Router();
24
27
  const requireAdmin = async (req, res, next) => {
25
28
  if (!(await adminAccess.isAdmin(req.userEmail))) {
@@ -29,7 +32,8 @@ export function createAccountRoutes(authService, adminAccess, accountErasure, ac
29
32
  next();
30
33
  };
31
34
  // GET /api/admin/accounts — id, email, name, whether a password hash is
32
- // stored, and whether the account is the env bootstrap admin.
35
+ // stored, whether the account is the env bootstrap admin, and whether it is
36
+ // an owner (and, if so, whether it may be deleted).
33
37
  router.get('/admin/accounts', requireAdmin, async (_req, res) => {
34
38
  res.json({ accounts: await authService.listAccounts() });
35
39
  });
@@ -37,8 +41,12 @@ export function createAccountRoutes(authService, adminAccess, accountErasure, ac
37
41
  // (or reset the password of an existing one; upsert-by-email is deliberate,
38
42
  // see AuthService.createAccount). Without a password the account is for
39
43
  // single sign-on: the person finds it waiting when they first sign in.
44
+ // With `keepExistingPassword: true` (an invite's starting password) the
45
+ // password goes only to a new account or a switched-on one with none; the
46
+ // reply's `passwordSet` says whether it did, and `deactivated` whether a
47
+ // refusal was because the account is switched off.
40
48
  router.post('/admin/accounts', requireAdmin, async (req, res) => {
41
- const { email, name, password } = req.body;
49
+ const { email, name, password, keepExistingPassword } = req.body;
42
50
  if (!email) {
43
51
  res.status(400).json({ error: 'email is required' });
44
52
  return;
@@ -48,7 +56,66 @@ export function createAccountRoutes(authService, adminAccess, accountErasure, ac
48
56
  res.status(400).json({ error: 'password must be a string' });
49
57
  return;
50
58
  }
59
+ // Fail closed: anything but a boolean is a mistake, never "overwrite".
60
+ if (keepExistingPassword !== undefined && typeof keepExistingPassword !== 'boolean') {
61
+ res.status(400).json({ error: 'keepExistingPassword must be a boolean' });
62
+ return;
63
+ }
64
+ if (keepExistingPassword === true && typeof password !== 'string') {
65
+ res.status(400).json({ error: 'keepExistingPassword needs a password' });
66
+ return;
67
+ }
68
+ // Another admin setting an owner's password could then sign in as the
69
+ // owner. The owner sets their own on the Account page; an owner account
70
+ // without a password (restoring one, say; an empty one counts as none,
71
+ // as in createAccount) is still created here. An invite's starting
72
+ // password is a password too: the owner is invited by nobody.
73
+ if (password &&
74
+ authService.isOwnerEmail(email) &&
75
+ canonicalEmail(email) !== canonicalEmail(req.userEmail ?? '')) {
76
+ res.status(400).json({ error: "The owner's password can't be set by another admin; the owner sets it on their Account page." });
77
+ return;
78
+ }
51
79
  try {
80
+ // A NEW account is an invitation, and the deployment's listeners say
81
+ // how the person was told (`notified`): the answer the admin reads is
82
+ // true to what happened, so the dialog can say "emailed" or hand over
83
+ // the link. An account that was already there is not invited again.
84
+ const invited = async (account, created, passwordSet) => {
85
+ if (!created)
86
+ return [];
87
+ // The inviting admin, by name when their account can be read. The
88
+ // account is already made: a failed read falls back to the identity
89
+ // the request carries rather than answering an error a retry could
90
+ // not make good (the account is not new the second time).
91
+ const requester = { id: req.userId ?? '', email: req.userEmail ?? '', name: '' };
92
+ const by = req.userId
93
+ ? await authService.getUserById(req.userId).catch((err) => {
94
+ log.warn('the inviting admin could not be read; the invite names them by address:', { err });
95
+ return null;
96
+ })
97
+ : null;
98
+ return accountHooks.runAccountInvited({
99
+ account: { id: account.id, email: account.email, name: account.name },
100
+ invitedBy: by ?? requester,
101
+ passwordSet,
102
+ });
103
+ };
104
+ if (keepExistingPassword === true && typeof password === 'string') {
105
+ const { user, created, passwordSet, deactivated } = await authService.createAccountWithStartingPassword(email, password);
106
+ const notified = await invited(user, created, passwordSet);
107
+ res.status(201).json({ ...user, passwordSet, deactivated, notified });
108
+ return;
109
+ }
110
+ if (!password) {
111
+ const { user, created } = await authService.createAccountWithoutPassword(email, name);
112
+ const notified = await invited(user, created, false);
113
+ res.status(201).json({ ...user, notified });
114
+ return;
115
+ }
116
+ // Set or reset password: an account that is here already, or one an
117
+ // admin makes with a password from the API. Not an invitation the
118
+ // listeners are told of: the dialog that invites never sends this form.
52
119
  const user = await authService.createAccount(email, name, password);
53
120
  res.status(201).json(user);
54
121
  }
@@ -89,6 +156,14 @@ export function createAccountRoutes(authService, adminAccess, accountErasure, ac
89
156
  res.status(400).json({ error: error.message });
90
157
  return;
91
158
  }
159
+ // The address's switch lock is held by a change still being saved (an
160
+ // invite's promotion committing roles.yaml, say): the 409 the lock
161
+ // promises, with its words, so the admin tries again rather than
162
+ // reading an outage.
163
+ if (error instanceof WorkflowDomainError) {
164
+ res.status(error.status).json({ error: error.message, ...(error.payload ?? {}) });
165
+ return;
166
+ }
92
167
  log.error('switching an account off failed:', { err: error });
93
168
  res.status(500).json({ error: 'Could not switch this account off' });
94
169
  }
@@ -162,14 +237,29 @@ export function createAccountRoutes(authService, adminAccess, accountErasure, ac
162
237
  // for the removal below — never logged, never returned.
163
238
  let email = null;
164
239
  let actor = null;
165
- if (removeFromAccess) {
166
- try {
167
- const user = await authService.getUserById(userId);
168
- if (!user) {
169
- res.status(404).json({ error: 'No such user' });
170
- return;
171
- }
240
+ try {
241
+ const user = await authService.getUserById(userId);
242
+ if (!user) {
243
+ res.status(404).json({ error: 'No such user' });
244
+ return;
245
+ }
246
+ // An owner who could not sign back in afterwards is refused for every
247
+ // caller, whether or not the access option is ticked.
248
+ authService.assertDeletable(user.email);
249
+ if (removeFromAccess)
172
250
  email = user.email;
251
+ }
252
+ catch (err) {
253
+ if (err instanceof AccountChangeRefusedError) {
254
+ res.status(400).json({ error: err.message });
255
+ return;
256
+ }
257
+ log.error('looking up the account to erase failed:', { err });
258
+ res.status(500).json({ error: 'Failed to erase user' });
259
+ return;
260
+ }
261
+ if (removeFromAccess && email !== null) {
262
+ try {
173
263
  // The existing guards: the deployment owner and the last Admin are
174
264
  // refused up front, before anything is erased.
175
265
  await accessRemoval.assertRemovable(email);
@@ -1 +1 @@
1
- {"version":3,"file":"account.routes.js","sourceRoot":"","sources":["../../../src/modules/auth/account.routes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAG/B,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAA+B,MAAM,8BAA8B,CAAC;AAG5F,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,sBAAsB,CAAC,CAAC,+BAA+B;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAA8G,EAC9G,WAAgC,EAChC,cAAyD,EACzD,aAAuG;IAEvG,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,MAAM,YAAY,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AED,uEAAuE;AACvE,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,SAAS,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACrE,CAAC"}
@@ -1,6 +1,11 @@
1
1
  import type { Database } from '../database/connection.js';
2
2
  import type { AuthUser } from '@bevel-software/platform-shared';
3
3
  import { type IAccountAdmission } from './account-admission.js';
4
+ import type { IAccountSwitchGuard } from './account-switch-guard.js';
5
+ /** What an admin is told when they try to switch an owner off. */
6
+ export declare const OWNER_SWITCH_OFF_REFUSAL = "The owner can't be switched off.";
7
+ /** What an admin is told when deleting an owner's account would leave them no way to sign in. */
8
+ export declare const OWNER_DELETE_REFUSAL = "The owner's account can't be deleted: they would have no way to sign in.";
4
9
  /**
5
10
  * What this service needs from the deployment's configuration, and nothing
6
11
  * more. Narrowed from `CoreConfig` so the caller can supply a value that is
@@ -39,7 +44,7 @@ export interface SsoLoginOptions {
39
44
  */
40
45
  admittedByProvider?: boolean;
41
46
  }
42
- export declare class AuthService {
47
+ export declare class AuthService implements IAccountSwitchGuard {
43
48
  private readonly db;
44
49
  private readonly config;
45
50
  /**
@@ -115,7 +120,10 @@ export declare class AuthService {
115
120
  * Password sign-in refuses it until a password is set. For an address that
116
121
  * already has an account it changes nothing but an explicitly given name.
117
122
  *
118
- * WITH a password, the deployment admin is the one target this refuses, for the reason
123
+ * WITH a password, this refuses two kinds of target. The accounts the
124
+ * platform runs its own work as are refused first
125
+ * ({@link assertNotSystemAccount}): a password would make them able to sign
126
+ * in. The deployment admin is refused for the reason
119
127
  * {@link changePassword} refuses it: that account's password is the
120
128
  * environment's, so a stored hash would not replace it but ADD a second
121
129
  * credential — one that keeps signing in after `ADMIN_PASSWORD` is rotated,
@@ -124,6 +132,40 @@ export declare class AuthService {
124
132
  * with an arbitrary email.
125
133
  */
126
134
  createAccount(email: string, name: string | undefined, password?: string): Promise<AuthUser>;
135
+ /**
136
+ * An account for single sign-on, or for a password somebody sets later:
137
+ * created without one, and for an address that already has an account,
138
+ * nothing changes but an explicitly given name. `created` says which
139
+ * happened, from the one statement that did it (see {@link CREATED}): an
140
+ * invite is only an invite when the account is new.
141
+ */
142
+ createAccountWithoutPassword(email: string, name: string | undefined): Promise<{
143
+ user: AuthUser;
144
+ created: boolean;
145
+ }>;
146
+ /**
147
+ * An invite's starting password: create the account with it, or give it to
148
+ * an existing account that is switched on and has no password yet — never
149
+ * to one that has a password of its own or is switched off. The test and
150
+ * the write are ONE statement (the upsert's `setWhere`), so a password the
151
+ * person sets between the admin reading the account list and sending the
152
+ * invite is never overwritten; `passwordSet` says which happened, and
153
+ * `created` whether the account is new (see {@link CREATED}).
154
+ *
155
+ * The deployment admin has its own password (the environment's): it is
156
+ * left as it is, as {@link createAccount} would refuse to store one. The
157
+ * accounts the platform runs its own work as are refused outright: a
158
+ * password would make them able to sign in.
159
+ *
160
+ * When nothing was written, `deactivated` tells a switched-off account
161
+ * apart from one that has a password of its own.
162
+ */
163
+ createAccountWithStartingPassword(email: string, password: string): Promise<{
164
+ user: AuthUser;
165
+ created: boolean;
166
+ passwordSet: boolean;
167
+ deactivated: boolean;
168
+ }>;
127
169
  /**
128
170
  * Is `email` the deployment admin — the account whose password is set in
129
171
  * the deployment environment (`ADMIN_EMAIL` while `ADMIN_PASSWORD` is set)
@@ -139,6 +181,39 @@ export declare class AuthService {
139
181
  * client is TOLD does follow the switch: {@link reportsAsEnvAdmin}.
140
182
  */
141
183
  private isEnvAdminEmail;
184
+ /**
185
+ * Is `email` an owner of this deployment — an address it is configured
186
+ * with as its owner (`ADMIN_EMAIL`; on Hexis by Bevel cloud, whoever
187
+ * created the workspace)? Unlike {@link isEnvAdminEmail} this asks nothing
188
+ * of `ADMIN_PASSWORD`: the cloud never sets one, and its owner must be
189
+ * protected all the same. Behind {@link deactivate} (which always refuses
190
+ * an owner) and {@link assertDeletable} (which refuses one who could not
191
+ * sign back in). Canonicalises both sides, so `email` may be raw.
192
+ */
193
+ isOwnerEmail(email: string): boolean;
194
+ /**
195
+ * An owner is never switched off, but an earlier version did switch off an
196
+ * owner without a server-held password, and no admin can undo that for a
197
+ * workspace's only owner. So wherever an owner's row is read to let them
198
+ * in, a switch-off left on it is cleared — on the row itself, so that the
199
+ * credentials that read the column directly (API keys, MCP tokens) are
200
+ * honoured again too. Returns `row` as it now stands; anyone else's row
201
+ * unchanged.
202
+ */
203
+ private clearOwnerSwitchOff;
204
+ /**
205
+ * The configured owner addresses, canonical, blanks dropped. One today
206
+ * (`ADMIN_EMAIL` is a single string); a list so that every owner is
207
+ * treated alike should the configuration ever carry more.
208
+ */
209
+ private ownerEmails;
210
+ /**
211
+ * Refuse to delete `email`'s account when it is an owner who could not
212
+ * sign back in afterwards: only an owner whose password the server holds,
213
+ * with password sign-in on (exactly {@link reportsAsEnvAdmin}), still has a
214
+ * way in once the row is gone. Anyone else's account passes.
215
+ */
216
+ assertDeletable(email: string): void;
142
217
  /**
143
218
  * Whether a client is told `email` is the deployment admin — behind
144
219
  * {@link toClientUser} and {@link listAccounts}. The identity is
@@ -189,12 +264,18 @@ export declare class AuthService {
189
264
  name: string;
190
265
  hasPassword: boolean;
191
266
  isEnvAdmin: boolean;
267
+ /** One of the deployment's owners (`ADMIN_EMAIL`), with or without a server-held password. */
268
+ isOwner: boolean;
269
+ /** An owner whose account may be deleted, since they can sign back in (see {@link assertDeletable}); false for everyone else. */
270
+ ownerCanBeDeleted: boolean;
192
271
  /** When an admin switched the account off; null while it is on. */
193
272
  deactivatedAt: Date | null;
194
273
  /** One of the accounts the platform runs its own work as: never switched off, nobody signs in with it. */
195
274
  isSystem: boolean;
196
275
  createdAt: Date;
197
276
  }>>;
277
+ /** Every password write calls this first: the system accounts never get one. */
278
+ private assertNotSystemAccount;
198
279
  private assertPasswordPolicy;
199
280
  private signToken;
200
281
  /**
@@ -245,18 +326,32 @@ export declare class AuthService {
245
326
  * environment password signs it in regardless (see `loginWithPassword`),
246
327
  * and a session that sign-in mints must then be usable too, or the way
247
328
  * back into a deployment would lead nowhere. {@link deactivate} refuses
248
- * the account, but a host may write the column itself.
329
+ * the account, but a host may write the column itself. Any owner's
330
+ * leftover switch-off is cleared here, as at sign-in
331
+ * ({@link clearOwnerSwitchOff}).
249
332
  */
250
333
  isActive(userId: string): Promise<boolean>;
334
+ /**
335
+ * Run `write` only while `email` is not switched off, and keep it so until
336
+ * `write` has finished: a transaction takes the address's switch lock (see
337
+ * account-switch-lock), reads the account and stays open across `write`.
338
+ * Every write that switches an account off, or creates one switched off,
339
+ * takes the same lock first, so it either committed before the read (and
340
+ * `write` is refused) or waits until `write` is done. An address with no
341
+ * account yet counts as switched on. A switched-off account throws a 409
342
+ * `deactivated` and `write` never runs.
343
+ */
344
+ whileSwitchedOn(email: string, write: () => Promise<void>): Promise<void>;
251
345
  /**
252
346
  * Switch an account off. Its row, history and place in roles and groups
253
347
  * stay; every credential it holds stops being honoured (see
254
348
  * {@link isActive}). Idempotent: an account already off keeps the moment
255
349
  * it was first switched off.
256
350
  *
257
- * The deployment admin is refused: the environment password is the way
258
- * back into a deployment whose every other admin is gone, and switching
259
- * it off would close that door from inside. So are the machine accounts
351
+ * An owner is refused, on every deployment, whether or not the server
352
+ * holds a password for them: switching the owner off locks them out of
353
+ * their own workspace (and, where `ADMIN_PASSWORD` is set, closes the
354
+ * way back into a deployment whose every other admin is gone). So are the machine accounts
260
355
  * core runs its own work as. Refusing an admin's own account is the
261
356
  * route's concern, since it knows who is asking.
262
357
  *
@@ -1 +1 @@
1
- {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/auth.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;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