@astram/identity 0.15.0 → 0.17.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 (129) hide show
  1. package/dist/branch.object.d.ts +9 -1
  2. package/dist/branch.object.d.ts.map +1 -1
  3. package/dist/branch.object.js +14 -1
  4. package/dist/company-branch.object.d.ts +5 -4
  5. package/dist/company-branch.object.d.ts.map +1 -1
  6. package/dist/company-branch.object.js +6 -4
  7. package/dist/company-department.object.d.ts +6 -6
  8. package/dist/company-department.object.d.ts.map +1 -1
  9. package/dist/company-department.object.js +7 -6
  10. package/dist/department.object.d.ts +9 -1
  11. package/dist/department.object.d.ts.map +1 -1
  12. package/dist/department.object.js +14 -1
  13. package/dist/features/access/access-admin.access.d.ts.map +1 -1
  14. package/dist/features/access/access-admin.access.js +8 -1
  15. package/dist/features/access/index.d.ts +1 -0
  16. package/dist/features/access/index.d.ts.map +1 -1
  17. package/dist/features/access/index.js +10 -2
  18. package/dist/features/access/org-structure.access.d.ts +3 -0
  19. package/dist/features/access/org-structure.access.d.ts.map +1 -0
  20. package/dist/features/access/org-structure.access.js +41 -0
  21. package/dist/features/access/user-management.access.d.ts.map +1 -1
  22. package/dist/features/access/user-management.access.js +5 -0
  23. package/dist/features/audit/audit-read.service.d.ts +32 -1
  24. package/dist/features/audit/audit-read.service.d.ts.map +1 -1
  25. package/dist/features/audit/audit-read.service.js +67 -14
  26. package/dist/features/audit/auth-audit-sink.d.ts +19 -0
  27. package/dist/features/audit/auth-audit-sink.d.ts.map +1 -0
  28. package/dist/features/audit/auth-audit-sink.js +24 -0
  29. package/dist/features/audit/directory-label-resolver.d.ts +10 -1
  30. package/dist/features/audit/directory-label-resolver.d.ts.map +1 -1
  31. package/dist/features/audit/directory-label-resolver.js +28 -1
  32. package/dist/features/authz/grant-admin.controller.d.ts +4 -4
  33. package/dist/features/authz/grant-admin.controller.js +4 -4
  34. package/dist/features/authz/grant-admin.service.d.ts +9 -8
  35. package/dist/features/authz/grant-admin.service.d.ts.map +1 -1
  36. package/dist/features/authz/grant-admin.service.js +20 -24
  37. package/dist/features/authz/grant-ceiling.d.ts +35 -16
  38. package/dist/features/authz/grant-ceiling.d.ts.map +1 -1
  39. package/dist/features/authz/grant-ceiling.js +44 -29
  40. package/dist/features/authz/role-binding.d.ts +25 -24
  41. package/dist/features/authz/role-binding.d.ts.map +1 -1
  42. package/dist/features/authz/role-binding.js +31 -44
  43. package/dist/features/identity-feature.module.d.ts +0 -11
  44. package/dist/features/identity-feature.module.d.ts.map +1 -1
  45. package/dist/features/identity-feature.module.js +90 -1
  46. package/dist/features/membership/membership.controller.d.ts.map +1 -1
  47. package/dist/features/membership/membership.controller.js +20 -6
  48. package/dist/features/membership/membership.service.d.ts +16 -10
  49. package/dist/features/membership/membership.service.d.ts.map +1 -1
  50. package/dist/features/membership/membership.service.js +61 -21
  51. package/dist/features/membership/posting.service.d.ts +25 -6
  52. package/dist/features/membership/posting.service.d.ts.map +1 -1
  53. package/dist/features/membership/posting.service.js +63 -16
  54. package/dist/features/org-bootstrap/org-bootstrap-file.d.ts +6 -2
  55. package/dist/features/org-bootstrap/org-bootstrap-file.d.ts.map +1 -1
  56. package/dist/features/org-bootstrap/org-bootstrap-file.js +54 -11
  57. package/dist/features/org-bootstrap/org-bootstrap-plan.d.ts +30 -11
  58. package/dist/features/org-bootstrap/org-bootstrap-plan.d.ts.map +1 -1
  59. package/dist/features/org-bootstrap/org-bootstrap-plan.js +172 -68
  60. package/dist/features/org-bootstrap/org-state.reader.d.ts.map +1 -1
  61. package/dist/features/org-bootstrap/org-state.reader.js +56 -49
  62. package/dist/features/org-bootstrap/run-org-bootstrap.d.ts +6 -1
  63. package/dist/features/org-bootstrap/run-org-bootstrap.d.ts.map +1 -1
  64. package/dist/features/org-bootstrap/run-org-bootstrap.js +81 -92
  65. package/dist/features/org-structure/org-catalog.controller.d.ts +29 -6
  66. package/dist/features/org-structure/org-catalog.controller.d.ts.map +1 -1
  67. package/dist/features/org-structure/org-catalog.controller.js +105 -17
  68. package/dist/features/org-structure/org-catalog.service.d.ts +99 -18
  69. package/dist/features/org-structure/org-catalog.service.d.ts.map +1 -1
  70. package/dist/features/org-structure/org-catalog.service.js +327 -51
  71. package/dist/features/org-structure/org-unit-name.d.ts +31 -0
  72. package/dist/features/org-structure/org-unit-name.d.ts.map +1 -0
  73. package/dist/features/org-structure/org-unit-name.js +50 -0
  74. package/dist/features/role/role.controller.d.ts +28 -13
  75. package/dist/features/role/role.controller.d.ts.map +1 -1
  76. package/dist/features/role/role.controller.js +54 -14
  77. package/dist/features/role/role.service.d.ts +76 -21
  78. package/dist/features/role/role.service.d.ts.map +1 -1
  79. package/dist/features/role/role.service.js +204 -27
  80. package/dist/features/security-policy/security-policy-version-bump.d.ts +41 -0
  81. package/dist/features/security-policy/security-policy-version-bump.d.ts.map +1 -0
  82. package/dist/features/security-policy/security-policy-version-bump.js +65 -0
  83. package/dist/features/security-policy/security-policy.controller.d.ts +51 -0
  84. package/dist/features/security-policy/security-policy.controller.d.ts.map +1 -0
  85. package/dist/features/security-policy/security-policy.controller.js +121 -0
  86. package/dist/features/security-policy/security-policy.service.d.ts +94 -0
  87. package/dist/features/security-policy/security-policy.service.d.ts.map +1 -0
  88. package/dist/features/security-policy/security-policy.service.js +429 -0
  89. package/dist/features/service-account/service-account.service.d.ts +13 -3
  90. package/dist/features/service-account/service-account.service.d.ts.map +1 -1
  91. package/dist/features/service-account/service-account.service.js +48 -10
  92. package/dist/features/service-account/service-account.store.d.ts +11 -1
  93. package/dist/features/service-account/service-account.store.d.ts.map +1 -1
  94. package/dist/features/service-account/service-account.store.js +20 -1
  95. package/dist/features/user/signin-admin.tokens.d.ts +11 -0
  96. package/dist/features/user/signin-admin.tokens.d.ts.map +1 -0
  97. package/dist/features/user/signin-admin.tokens.js +13 -0
  98. package/dist/features/user/user-mfa-status.d.ts +38 -0
  99. package/dist/features/user/user-mfa-status.d.ts.map +1 -0
  100. package/dist/features/user/user-mfa-status.js +47 -0
  101. package/dist/features/user/user-signin-admin.service.d.ts +48 -0
  102. package/dist/features/user/user-signin-admin.service.d.ts.map +1 -0
  103. package/dist/features/user/user-signin-admin.service.js +232 -0
  104. package/dist/features/user/user.controller.d.ts +29 -2
  105. package/dist/features/user/user.controller.d.ts.map +1 -1
  106. package/dist/features/user/user.controller.js +71 -3
  107. package/dist/features/user/user.service.d.ts +40 -14
  108. package/dist/features/user/user.service.d.ts.map +1 -1
  109. package/dist/features/user/user.service.js +143 -10
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +3 -1
  113. package/dist/objects.d.ts.map +1 -1
  114. package/dist/objects.js +2 -0
  115. package/dist/role.object.d.ts +1 -1
  116. package/dist/role.object.d.ts.map +1 -1
  117. package/dist/role.object.js +6 -15
  118. package/dist/security-policy.object.d.ts +43 -0
  119. package/dist/security-policy.object.d.ts.map +1 -0
  120. package/dist/security-policy.object.js +107 -0
  121. package/dist/user.object.d.ts +6 -0
  122. package/dist/user.object.d.ts.map +1 -1
  123. package/dist/user.object.js +13 -1
  124. package/migrations/1710000000102-CreateAuditChain.cjs +71 -0
  125. package/migrations/1710000000103-AddUserLoginName.cjs +87 -0
  126. package/migrations/1710000000104-CreateSecurityPolicy.cjs +90 -0
  127. package/migrations/1710000000105-OwnDepartmentsAndBranches.cjs +327 -0
  128. package/migrations/1710000000106-OwnRolesPerCompany.cjs +622 -0
  129. package/package.json +9 -4
@@ -0,0 +1,94 @@
1
+ import { type FrameworkSchemas, type Principal } from '@astram/core';
2
+ import { RecordsService, type RecordId, type RecordView } from '@astram/engine';
3
+ import { GrantCeiling } from '../authz/grant-ceiling.js';
4
+ import { type ListParams } from '../shared/list-query.js';
5
+ import { type SecurityPolicyVersionBump } from './security-policy-version-bump.js';
6
+ /** `POST /identity/security-policies` body, already stripped to the documented fields. */
7
+ export interface CreateSecurityPolicyInput {
8
+ /** Canonical company uuid (controller `optionalUuidField`); absent ⇒ the actor's active node. */
9
+ readonly scopeNodeUuid?: string;
10
+ readonly platform?: unknown;
11
+ readonly targetKind?: unknown;
12
+ readonly targetValue?: unknown;
13
+ readonly graceDays?: unknown;
14
+ }
15
+ /** `PUT /identity/security-policies/:uuid` body: the two changeable fields. */
16
+ export interface UpdateSecurityPolicyInput {
17
+ readonly targetValue?: unknown;
18
+ readonly graceDays?: unknown;
19
+ }
20
+ /**
21
+ * SecurityPolicyService — mandatory-2FA policies (auth capabilities R2.6, R2.9) over the engine:
22
+ * every write runs the engine's gate (`decide()` on `identity:security_policy:<action>`, the
23
+ * subtree read/write wall) and these authority rules on top:
24
+ *
25
+ * - **Create or tighten** (add a policy, widen its target, shorten its grace): the permission
26
+ * holder, for a node inside their subtree (root anywhere). Tightening only adds a requirement
27
+ * every user meets by self-service enrolment, so no grant ceiling or dominance applies.
28
+ * - **Lower or delete** (remove, narrow or move the target, lengthen grace): a `role` policy needs
29
+ * the grant ceiling over every key the role grants (`assertCanAssignRoles`); a `permission`
30
+ * policy over its listed key (`assertCanGrant`); a `tenant` policy all of `identity:*`
31
+ * (`assertCanGrant(['identity:*'])`: the actor's keys at their tenant, which is the node or an
32
+ * ancestor since the node is in their subtree). Judged on the policy AS STORED. Root bypasses.
33
+ * - **Platform floor**: root only, for every write.
34
+ * - **Rules set from above** (D-12): each policy stores the node its creator acted at
35
+ * (`createdAtNode`, from the session); lowering or deleting it also needs the actor to act at
36
+ * that node or an ancestor (root bypasses), so a subsidiary admin cannot weaken a group rule.
37
+ *
38
+ * Each write is one engine transaction: lock the row, re-read and re-check it (CONVENTIONS: no
39
+ * check-then-write across transactions), write, a `permission_change` audit row on the same
40
+ * transaction, and the permission-version bump of every tenant in the policy's scope on the same
41
+ * transaction (published to Redis after the commit), so guard's recompute sees the change on each
42
+ * user's next request. No bump wired ⇒ every write is refused (503): a policy never lands silently.
43
+ * Error messages are fixed and name no ids.
44
+ */
45
+ export declare class SecurityPolicyService {
46
+ private readonly records;
47
+ private readonly ceiling;
48
+ private readonly versionBump?;
49
+ private readonly audit;
50
+ /** `<app>`, where `roles` lives (the root existence check for a role target). */
51
+ private readonly appSchema;
52
+ /** Epoch-ms clock (a field, not a constructor parameter: Nest injects every parameter). */
53
+ private readonly now;
54
+ constructor(records: RecordsService, ceiling: GrantCeiling, versionBump?: (SecurityPolicyVersionBump | null) | undefined, schemas?: FrameworkSchemas | null);
55
+ /** List policies (walled to the caller's subtree by the engine; platform rows: root only). */
56
+ listPolicies(params?: ListParams): Promise<{
57
+ rows: RecordView[];
58
+ total: number;
59
+ }>;
60
+ /** Read one policy (walled read). */
61
+ getPolicy(uuid: string): Promise<RecordView | null>;
62
+ /** Create a policy (create/tighten authority; platform floor root only). */
63
+ createPolicy(actor: Principal, input: CreateSecurityPolicyInput): Promise<RecordId>;
64
+ /** Change a policy's target or grace (tighten freely; lower under the R2.6 lower rules). */
65
+ updatePolicy(actor: Principal, uuid: string, patch: UpdateSecurityPolicyInput): Promise<void>;
66
+ /** Delete a policy (always a lower: R2.6 lower rules; platform floor root only). */
67
+ deletePolicy(actor: Principal, uuid: string): Promise<void>;
68
+ private requireBump;
69
+ private inSubtree;
70
+ /** Lock the row, re-read it on the transaction, and apply the reach and floor rules. */
71
+ private lockAndRead;
72
+ /**
73
+ * Decision (6) of slice D: a role target must exist and be visible to the actor. Non-root: the
74
+ * role's owner company is in the actor's subtree (G-013 owner rule, the one grant administration
75
+ * uses, `GrantCeiling.roleOwnedInReach`); an owner implies the role exists, and an ownerless role
76
+ * is root only. Root: the role row exists (read on the write's transaction). Otherwise 404 with a
77
+ * fixed message (no existence oracle, no id).
78
+ */
79
+ private assertRoleTarget;
80
+ /**
81
+ * The R2.6 lower rule for the policy as stored. Root bypasses. D-12 (rules set from above): the
82
+ * actor must also act at the node the policy was created at or an ancestor of it, i.e. that node
83
+ * is in the actor's subtree; a legacy row with no creator node is judged at its scope node.
84
+ */
85
+ private assertMayLower;
86
+ /**
87
+ * One engine transaction with the transaction's own connection exposed for the audit row and the
88
+ * version bump; versions are published after the commit, dropped after a rollback.
89
+ */
90
+ private write;
91
+ /** The `permission_change` row on the write's transaction (fail closed: it rolls back with it). */
92
+ private recordAudit;
93
+ }
94
+ //# sourceMappingURL=security-policy.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-policy.service.d.ts","sourceRoot":"","sources":["../../../src/features/security-policy/security-policy.service.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,cAAc,EAGd,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAgC,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS1E,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAC;AAM3C,0FAA0F;AAC1F,MAAM,WAAW,yBAAyB;IACxC,iGAAiG;IACjG,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,+EAA+E;AAC/E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAmHD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,qBAAqB;IAQ9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAGxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAX/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;gBAG3B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,YAAY,EAGrB,WAAW,CAAC,GAAE,yBAAyB,GAAG,IAAI,aAAA,EAG/D,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAMnC,8FAA8F;IACxF,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAKvF,qCAAqC;IAC/B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAKzD,4EAA4E;IACtE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,QAAQ,CAAC;IA8DzF,4FAA4F;IACtF,YAAY,CAChB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,IAAI,CAAC;IA+ChB,oFAAoF;IAC9E,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjE,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,SAAS;IAIjB,wFAAwF;YAC1E,WAAW;IAqBzB;;;;;;OAMG;YACW,gBAAgB;IAc9B;;;;OAIG;YACW,cAAc;IAqB5B;;;OAGG;YACW,KAAK;IAiCnB,mGAAmG;YACrF,WAAW;CAkB1B"}
@@ -0,0 +1,429 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SecurityPolicyService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const core_1 = require("@astram/core");
18
+ const engine_1 = require("@astram/engine");
19
+ const internal_1 = require("@astram/engine/internal");
20
+ const grant_ceiling_js_1 = require("../authz/grant-ceiling.js");
21
+ const list_query_js_1 = require("../shared/list-query.js");
22
+ const http_js_1 = require("../shared/http.js");
23
+ const identity_errors_js_1 = require("../shared/identity-errors.js");
24
+ const framework_schemas_token_js_1 = require("../framework-schemas.token.js");
25
+ const schema_js_1 = require("../../schema.js");
26
+ const security_policy_version_bump_js_1 = require("./security-policy-version-bump.js");
27
+ const TYPE = 'security_policy';
28
+ const SEARCH_FIELDS = ['targetValue'];
29
+ const SORT_FIELDS = ['targetKind', 'graceDays', 'createdAtMs', 'updatedAtMs'];
30
+ /** The prefix a grant wildcard covers (`identity:*`, bare `identity` → `identity:`), else null. */
31
+ function wildcardPrefix(key) {
32
+ if (key.endsWith(':*'))
33
+ return key.slice(0, -1);
34
+ if (!key.includes(':'))
35
+ return `${key}:`;
36
+ return null;
37
+ }
38
+ /** True when key `a` covers every key `b` covers (`b` is equal to or under `a`'s wildcard). */
39
+ function keyCovers(a, b) {
40
+ const pa = wildcardPrefix(a);
41
+ const pb = wildcardPrefix(b);
42
+ if (pa === null)
43
+ return a === b;
44
+ return (pb ?? b).startsWith(pa);
45
+ }
46
+ function parsePlatform(v) {
47
+ if (v === undefined || v === null)
48
+ return false;
49
+ if (typeof v !== 'boolean')
50
+ throw new identity_errors_js_1.IdentityBadRequestError('platform must be true or false.');
51
+ return v;
52
+ }
53
+ function parseKind(v) {
54
+ if (typeof v === 'string' && core_1.SECURITY_POLICY_TARGET_KINDS.includes(v)) {
55
+ return v;
56
+ }
57
+ throw new identity_errors_js_1.IdentityBadRequestError('targetKind must be one of: tenant, role, permission.');
58
+ }
59
+ function parseGrace(v) {
60
+ if (typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= core_1.MAX_MFA_GRACE_DAYS)
61
+ return v;
62
+ throw new identity_errors_js_1.IdentityBadRequestError(`graceDays must be a whole number from 0 to ${core_1.MAX_MFA_GRACE_DAYS}.`);
63
+ }
64
+ function parseTarget(kind, v) {
65
+ if (kind === 'tenant') {
66
+ if (v === undefined || v === null)
67
+ return null;
68
+ throw new identity_errors_js_1.IdentityBadRequestError('An organisation-wide policy has no target.');
69
+ }
70
+ if (kind === 'role') {
71
+ const id = (0, engine_1.canonicalUuid)(v);
72
+ if (id === null)
73
+ throw new identity_errors_js_1.IdentityBadRequestError('Choose a role for this policy.');
74
+ return id;
75
+ }
76
+ if (typeof v === 'string' && (0, core_1.isSecurityPolicyPermissionTarget)(v))
77
+ return v;
78
+ throw new identity_errors_js_1.IdentityBadRequestError('Enter a permission key such as identity:user:update, or a wildcard such as identity:*.');
79
+ }
80
+ function toStored(fields) {
81
+ const p = fields.platform;
82
+ const grace = Number(fields.graceDays);
83
+ return {
84
+ scopeNodeUuid: typeof fields.scopeNodeUuid === 'string' ? fields.scopeNodeUuid : null,
85
+ createdAtNode: typeof fields.createdAtNode === 'string' ? fields.createdAtNode : null,
86
+ platform: p === true || p === 1 || p === '1',
87
+ targetKind: String(fields.targetKind ?? ''),
88
+ targetValue: typeof fields.targetValue === 'string' ? fields.targetValue : null,
89
+ // An unreadable stored grace counts as 0 (the strictest), so a lengthening is judged a lower.
90
+ graceDays: Number.isInteger(grace) ? grace : 0,
91
+ };
92
+ }
93
+ /**
94
+ * A stored policy as the HTTP response carries it (QA2 B8): the BIGINT epoch-ms columns come back
95
+ * from the driver as a `bigint` (or a numeric string), which `JSON.stringify` refuses (a 500), and
96
+ * the TINYINT flag as 0/1. Coerce them to the documented `number` / `boolean`.
97
+ */
98
+ function toJsonView(view) {
99
+ const f = view.fields;
100
+ const p = f.platform;
101
+ return {
102
+ ...view,
103
+ fields: {
104
+ ...f,
105
+ platform: p === true || p === 1 || p === '1',
106
+ graceDays: Number(f.graceDays),
107
+ createdAtMs: (0, http_js_1.asEpochMs)(f.createdAtMs),
108
+ updatedAtMs: (0, http_js_1.asEpochMs)(f.updatedAtMs),
109
+ },
110
+ };
111
+ }
112
+ /** The fixed 403 text for a refused lower or delete (R2.6, D-12); names no ids. */
113
+ function lowerRefusal(p) {
114
+ return p.targetKind === 'role' || p.targetKind === 'permission'
115
+ ? 'You cannot relax this policy: it covers permissions you do not hold.'
116
+ : 'Relaxing an organisation-wide policy needs full identity administration.';
117
+ }
118
+ /** The driver errno of an engine/driver error, also through one `cause` level. */
119
+ function errnoOf(e) {
120
+ const own = e?.errno;
121
+ if (typeof own === 'number')
122
+ return own;
123
+ const inner = e?.cause?.errno;
124
+ return typeof inner === 'number' ? inner : undefined;
125
+ }
126
+ /**
127
+ * SecurityPolicyService — mandatory-2FA policies (auth capabilities R2.6, R2.9) over the engine:
128
+ * every write runs the engine's gate (`decide()` on `identity:security_policy:<action>`, the
129
+ * subtree read/write wall) and these authority rules on top:
130
+ *
131
+ * - **Create or tighten** (add a policy, widen its target, shorten its grace): the permission
132
+ * holder, for a node inside their subtree (root anywhere). Tightening only adds a requirement
133
+ * every user meets by self-service enrolment, so no grant ceiling or dominance applies.
134
+ * - **Lower or delete** (remove, narrow or move the target, lengthen grace): a `role` policy needs
135
+ * the grant ceiling over every key the role grants (`assertCanAssignRoles`); a `permission`
136
+ * policy over its listed key (`assertCanGrant`); a `tenant` policy all of `identity:*`
137
+ * (`assertCanGrant(['identity:*'])`: the actor's keys at their tenant, which is the node or an
138
+ * ancestor since the node is in their subtree). Judged on the policy AS STORED. Root bypasses.
139
+ * - **Platform floor**: root only, for every write.
140
+ * - **Rules set from above** (D-12): each policy stores the node its creator acted at
141
+ * (`createdAtNode`, from the session); lowering or deleting it also needs the actor to act at
142
+ * that node or an ancestor (root bypasses), so a subsidiary admin cannot weaken a group rule.
143
+ *
144
+ * Each write is one engine transaction: lock the row, re-read and re-check it (CONVENTIONS: no
145
+ * check-then-write across transactions), write, a `permission_change` audit row on the same
146
+ * transaction, and the permission-version bump of every tenant in the policy's scope on the same
147
+ * transaction (published to Redis after the commit), so guard's recompute sees the change on each
148
+ * user's next request. No bump wired ⇒ every write is refused (503): a policy never lands silently.
149
+ * Error messages are fixed and name no ids.
150
+ */
151
+ let SecurityPolicyService = class SecurityPolicyService {
152
+ records;
153
+ ceiling;
154
+ versionBump;
155
+ audit;
156
+ /** `<app>`, where `roles` lives (the root existence check for a role target). */
157
+ appSchema;
158
+ /** Epoch-ms clock (a field, not a constructor parameter: Nest injects every parameter). */
159
+ now = Date.now;
160
+ constructor(records, ceiling, versionBump, schemas) {
161
+ this.records = records;
162
+ this.ceiling = ceiling;
163
+ this.versionBump = versionBump;
164
+ this.audit = new engine_1.MariaDbAuditSink(schemas ? { schema: schemas.audit } : {});
165
+ this.appSchema = (schemas ?? (0, schema_js_1.frameworkSchemasFromEnv)()).app;
166
+ }
167
+ /** List policies (walled to the caller's subtree by the engine; platform rows: root only). */
168
+ async listPolicies(params) {
169
+ const page = await this.records.list(TYPE, (0, list_query_js_1.buildListQuery)(params, SEARCH_FIELDS, SORT_FIELDS));
170
+ return { rows: page.rows.map(toJsonView), total: page.total };
171
+ }
172
+ /** Read one policy (walled read). */
173
+ async getPolicy(uuid) {
174
+ const view = await this.records.get(TYPE, uuid);
175
+ return view === null ? null : toJsonView(view);
176
+ }
177
+ /** Create a policy (create/tighten authority; platform floor root only). */
178
+ async createPolicy(actor, input) {
179
+ const bump = this.requireBump();
180
+ const isRoot = actor.isRoot === true;
181
+ const platform = parsePlatform(input.platform);
182
+ const targetKind = parseKind(input.targetKind);
183
+ const targetValue = parseTarget(targetKind, input.targetValue);
184
+ const graceDays = input.graceDays === undefined ? 0 : parseGrace(input.graceDays);
185
+ let scopeNodeUuid;
186
+ if (platform) {
187
+ if (!isRoot) {
188
+ throw new identity_errors_js_1.IdentityForbiddenError('Only a platform administrator can set a platform-wide policy.');
189
+ }
190
+ if (input.scopeNodeUuid !== undefined) {
191
+ throw new identity_errors_js_1.IdentityBadRequestError('A platform-wide policy applies to every organisation; do not choose one.');
192
+ }
193
+ scopeNodeUuid = null;
194
+ }
195
+ else {
196
+ scopeNodeUuid = input.scopeNodeUuid ?? actor.activeScopeNodeId ?? actor.tenantId;
197
+ if (!isRoot && !this.inSubtree(actor, scopeNodeUuid)) {
198
+ throw new identity_errors_js_1.IdentityForbiddenError('You can only set a policy for an organisation you manage.');
199
+ }
200
+ }
201
+ // D-12: the node the creator acts at, from the session (never the body). A platform row has
202
+ // none (root only, judged by the floor rule).
203
+ const createdAtNode = platform ? null : (actor.activeScopeNodeId ?? actor.tenantId);
204
+ const nowMs = this.now();
205
+ // A NULL column (the scope node of a platform row, the target of a `tenant` policy) is left
206
+ // out: the engine's validate stage refuses `null` for a typed field, and the column defaults
207
+ // to NULL (task 22 live run: every tenant and platform policy was refused with a 400).
208
+ const fields = {
209
+ ...(scopeNodeUuid !== null ? { scopeNodeUuid } : {}),
210
+ platform,
211
+ targetKind,
212
+ ...(targetValue !== null ? { targetValue } : {}),
213
+ graceDays,
214
+ ...(createdAtNode !== null ? { createdAtNode } : {}),
215
+ createdAtMs: nowMs,
216
+ updatedAtMs: nowMs,
217
+ };
218
+ return this.write(bump, async (tx, conn) => {
219
+ if (targetKind === 'role')
220
+ await this.assertRoleTarget(actor, targetValue, conn);
221
+ const id = await tx.create(TYPE, { fields });
222
+ await this.recordAudit(conn, actor, 'created', id, {
223
+ scopeNodeId: scopeNodeUuid,
224
+ platform,
225
+ targetKind,
226
+ targetValue,
227
+ graceDays,
228
+ direction: 'tighten',
229
+ });
230
+ return { result: id, changed: true, scope: scopeNodeUuid };
231
+ });
232
+ }
233
+ /** Change a policy's target or grace (tighten freely; lower under the R2.6 lower rules). */
234
+ async updatePolicy(actor, uuid, patch) {
235
+ const bump = this.requireBump();
236
+ const newGrace = patch.graceDays === undefined ? undefined : parseGrace(patch.graceDays);
237
+ await this.write(bump, async (tx, conn) => {
238
+ const current = await this.lockAndRead(tx, actor, uuid);
239
+ const newTarget = patch.targetValue === undefined
240
+ ? undefined
241
+ : parseTarget(current.targetKind, patch.targetValue);
242
+ const fields = {};
243
+ const directions = [];
244
+ if (newGrace !== undefined && newGrace !== current.graceDays) {
245
+ fields.graceDays = newGrace;
246
+ directions.push(newGrace < current.graceDays ? 'tighten' : 'lower');
247
+ }
248
+ if (newTarget !== undefined && newTarget !== current.targetValue) {
249
+ if (current.targetKind === 'role') {
250
+ await this.assertRoleTarget(actor, newTarget, conn);
251
+ }
252
+ fields.targetValue = newTarget;
253
+ const widens = current.targetKind === 'permission' &&
254
+ current.targetValue !== null &&
255
+ keyCovers(newTarget, current.targetValue);
256
+ directions.push(widens ? 'tighten' : 'lower');
257
+ }
258
+ if (directions.length === 0)
259
+ return { result: undefined, changed: false, scope: null };
260
+ const direction = directions.includes('lower') ? 'lower' : 'tighten';
261
+ if (direction === 'lower')
262
+ await this.assertMayLower(actor, current);
263
+ fields.updatedAtMs = this.now();
264
+ await tx.update(TYPE, uuid, { fields });
265
+ await this.recordAudit(conn, actor, 'updated', uuid, {
266
+ scopeNodeId: current.scopeNodeUuid,
267
+ platform: current.platform,
268
+ targetKind: current.targetKind,
269
+ targetValue: fields.targetValue ?? current.targetValue,
270
+ graceDays: fields.graceDays ?? current.graceDays,
271
+ previousTargetValue: current.targetValue,
272
+ previousGraceDays: current.graceDays,
273
+ direction,
274
+ });
275
+ return { result: undefined, changed: true, scope: current.scopeNodeUuid };
276
+ });
277
+ }
278
+ /** Delete a policy (always a lower: R2.6 lower rules; platform floor root only). */
279
+ async deletePolicy(actor, uuid) {
280
+ const bump = this.requireBump();
281
+ await this.write(bump, async (tx, conn) => {
282
+ const current = await this.lockAndRead(tx, actor, uuid);
283
+ await this.assertMayLower(actor, current);
284
+ await tx.delete(TYPE, uuid);
285
+ await this.recordAudit(conn, actor, 'deleted', uuid, {
286
+ scopeNodeId: current.scopeNodeUuid,
287
+ platform: current.platform,
288
+ targetKind: current.targetKind,
289
+ targetValue: current.targetValue,
290
+ graceDays: current.graceDays,
291
+ direction: 'lower',
292
+ });
293
+ return { result: undefined, changed: true, scope: current.scopeNodeUuid };
294
+ });
295
+ }
296
+ // ── internals ────────────────────────────────────────────────────────────────────────────
297
+ requireBump() {
298
+ const bump = this.versionBump;
299
+ if (!bump) {
300
+ throw new core_1.AuthorizationUnavailableError('security policy version bump is not configured');
301
+ }
302
+ return bump;
303
+ }
304
+ inSubtree(actor, node) {
305
+ return (0, grant_ceiling_js_1.subtreeOf)(actor).some((n) => (0, http_js_1.sameUuid)(n, node));
306
+ }
307
+ /** Lock the row, re-read it on the transaction, and apply the reach and floor rules. */
308
+ async lockAndRead(tx, actor, uuid) {
309
+ await tx.lockForUpdate(TYPE, uuid);
310
+ const view = await tx.get(TYPE, uuid);
311
+ if (view === null)
312
+ throw new identity_errors_js_1.IdentityNotFoundError('Security policy not found.');
313
+ const current = toStored(view.fields);
314
+ if (actor.isRoot === true)
315
+ return current;
316
+ if (current.platform) {
317
+ throw new identity_errors_js_1.IdentityForbiddenError('Only a platform administrator can change a platform-wide policy.');
318
+ }
319
+ if (current.scopeNodeUuid === null || !this.inSubtree(actor, current.scopeNodeUuid)) {
320
+ throw new identity_errors_js_1.IdentityNotFoundError('Security policy not found.');
321
+ }
322
+ return current;
323
+ }
324
+ /**
325
+ * Decision (6) of slice D: a role target must exist and be visible to the actor. Non-root: the
326
+ * role's owner company is in the actor's subtree (G-013 owner rule, the one grant administration
327
+ * uses, `GrantCeiling.roleOwnedInReach`); an owner implies the role exists, and an ownerless role
328
+ * is root only. Root: the role row exists (read on the write's transaction). Otherwise 404 with a
329
+ * fixed message (no existence oracle, no id).
330
+ */
331
+ async assertRoleTarget(actor, roleUuid, conn) {
332
+ let visible;
333
+ if (actor.isRoot === true) {
334
+ const rows = (await conn.query(`SELECT 1 AS ok FROM \`${this.appSchema}\`.\`roles\` WHERE r_uuid = ? LIMIT 1`, [roleUuid]));
335
+ visible = Array.isArray(rows) && rows.length > 0;
336
+ }
337
+ else {
338
+ visible = (await this.ceiling.roleOwnedInReach(actor, roleUuid)) === true;
339
+ }
340
+ if (!visible)
341
+ throw new identity_errors_js_1.IdentityNotFoundError('Role not found.');
342
+ }
343
+ /**
344
+ * The R2.6 lower rule for the policy as stored. Root bypasses. D-12 (rules set from above): the
345
+ * actor must also act at the node the policy was created at or an ancestor of it, i.e. that node
346
+ * is in the actor's subtree; a legacy row with no creator node is judged at its scope node.
347
+ */
348
+ async assertMayLower(actor, p) {
349
+ if (actor.isRoot === true)
350
+ return;
351
+ const creatorNode = p.createdAtNode ?? p.scopeNodeUuid;
352
+ if (creatorNode === null || !this.inSubtree(actor, creatorNode)) {
353
+ throw new identity_errors_js_1.IdentityForbiddenError(lowerRefusal(p));
354
+ }
355
+ try {
356
+ if (p.targetKind === 'role' && p.targetValue !== null) {
357
+ await this.ceiling.assertCanAssignRoles(actor, [p.targetValue]);
358
+ }
359
+ else if (p.targetKind === 'permission' && p.targetValue !== null) {
360
+ await this.ceiling.assertCanGrant(actor, [p.targetValue]);
361
+ }
362
+ else {
363
+ // `tenant` (or anything unreadable): full identity administration at the node or above.
364
+ await this.ceiling.assertCanGrant(actor, ['identity:*']);
365
+ }
366
+ }
367
+ catch (cause) {
368
+ if (!(cause instanceof grant_ceiling_js_1.GrantCeilingError))
369
+ throw cause;
370
+ throw new identity_errors_js_1.IdentityForbiddenError(lowerRefusal(p));
371
+ }
372
+ }
373
+ /**
374
+ * One engine transaction with the transaction's own connection exposed for the audit row and the
375
+ * version bump; versions are published after the commit, dropped after a rollback.
376
+ */
377
+ async write(bump, fn) {
378
+ let conn;
379
+ try {
380
+ const result = await this.records.transaction(async (tx) => {
381
+ const query = (0, internal_1.transactionQueryOf)(tx);
382
+ const c = { query: (sql, params) => query(sql, params) };
383
+ conn = c;
384
+ const out = await fn(tx, c);
385
+ if (out.changed)
386
+ await bump.bump(await bump.tenantsInScope(out.scope, c), c);
387
+ return out.result;
388
+ });
389
+ if (conn)
390
+ await bump.publishCommitted(conn);
391
+ return result;
392
+ }
393
+ catch (e) {
394
+ if (conn)
395
+ bump.discardPending(conn);
396
+ const errno = errnoOf(e);
397
+ // 1452: the chosen organisation does not exist (FK); 4025: a CHECK the input passed but the
398
+ // database refused. Fixed text, never the driver's.
399
+ if (errno === 1452)
400
+ throw new identity_errors_js_1.IdentityBadRequestError('Choose an existing organisation.');
401
+ if (errno === 4025)
402
+ throw new identity_errors_js_1.IdentityBadRequestError('This policy is not valid.');
403
+ throw e;
404
+ }
405
+ }
406
+ /** The `permission_change` row on the write's transaction (fail closed: it rolls back with it). */
407
+ async recordAudit(conn, actor, what, id, attributes) {
408
+ const event = {
409
+ type: 'permission_change',
410
+ occurredAtMs: this.now(),
411
+ actorId: actor.id,
412
+ tenantId: actor.tenantId,
413
+ action: { key: `security_policy.${what}` },
414
+ resource: { level: 'record', typeKey: TYPE, tenantId: actor.tenantId, recordId: String(id) },
415
+ attributes,
416
+ };
417
+ await this.audit.record(event, (sql, params) => conn.query(sql, params));
418
+ }
419
+ };
420
+ exports.SecurityPolicyService = SecurityPolicyService;
421
+ exports.SecurityPolicyService = SecurityPolicyService = __decorate([
422
+ (0, common_1.Injectable)(),
423
+ __param(2, (0, common_1.Optional)()),
424
+ __param(2, (0, common_1.Inject)(security_policy_version_bump_js_1.SECURITY_POLICY_VERSION_BUMP)),
425
+ __param(3, (0, common_1.Optional)()),
426
+ __param(3, (0, common_1.Inject)(framework_schemas_token_js_1.IDENTITY_FRAMEWORK_SCHEMAS)),
427
+ __metadata("design:paramtypes", [engine_1.RecordsService,
428
+ grant_ceiling_js_1.GrantCeiling, Object, Object])
429
+ ], SecurityPolicyService);
@@ -155,11 +155,21 @@ export declare class ServiceAccountService {
155
155
  * back to placeholder names instead of failing a write that already happened.
156
156
  */
157
157
  private auditNames;
158
+ /**
159
+ * G-013 (spec §5.D, R2): every requested role is OWNED by the account's company — another
160
+ * company's role, an ownerless role or an unknown id is a 400 with one fixed message (no name, no
161
+ * id: the role catalog read is not caller-scoped). Applies to every admin, root included, and runs
162
+ * BEFORE the ceiling. Store errors propagate (→ 503).
163
+ */
164
+ /** The ids among `roleIds` owned by `companyUuid` (G-013), in their order. Store errors propagate. */
165
+ private ownedBy;
166
+ private assertRolesOwnedBy;
158
167
  /**
159
168
  * What the caller may grant (the picker source for create/edit), computed from the SAME
160
- * {@link ceilingOf} the write check enforces. Root → every role + every company; non-root → the
161
- * roles they hold + the nodes of their reachable subtree. Nodes come back tree-ordered with a
162
- * `parentId` only when the parent is also assignable.
169
+ * {@link ceilingOf} the write check enforces. Roles: only those OWNED by the company a new agent
170
+ * is created in (the admin's tenant, G-013) — root gets all of them, a non-root admin those it
171
+ * also holds. Companies: root every company; non-root the nodes of its reachable subtree. Nodes
172
+ * come back tree-ordered with a `parentId` only when the parent is also assignable.
163
173
  */
164
174
  assignable(admin: AdminPrincipal): Promise<AssignableAccess>;
165
175
  /** List the admin's own-tenant accounts (by label; ids are handles). */
@@ -1 +1 @@
1
- {"version":3,"file":"service-account.service.d.ts","sourceRoot":"","sources":["../../../src/features/service-account/service-account.service.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,KAAK,EACV,mBAAmB,EAGnB,UAAU,EACV,eAAe,EAChB,MAAM,4BAA4B,CA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EAAE,CAAC;QACxC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;KAChC,GACA,OAAO,CAAC,kBAAkB,CAAC;IA0G9B;;;;;;OAMG;IACG,QAAQ,CACZ,KAAK,EAAE,cAAc,EACrB,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,SAAS,CAAC;IAOrB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAkBrB;;;;OAIG;IACG,SAAS,CACb,KAAK,EAAE,cAAc,EACrB,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,SAAS,CAAC;IAOrB,kGAAkG;IAC5F,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlE,mGAAmG;YACrF,OAAO;IAiCrB,+EAA+E;YACjE,SAAS;CAkBxB"}
1
+ {"version":3,"file":"service-account.service.d.ts","sourceRoot":"","sources":["../../../src/features/service-account/service-account.service.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,KAAK,EACV,mBAAmB,EAGnB,UAAU,EACV,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC,gGAAgG;AAChG,qBAAa,2BAA4B,SAAQ,KAAK;;CAKrD;AAED,oFAAoF;AACpF,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,EAAE,MAAM;CAI5B;AAED,4FAA4F;AAC5F,qBAAa,2BAA4B,SAAQ,KAAK;;CAKrD;AAED,0EAA0E;AAC1E,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB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