@stigmer/server 3.15.2 → 3.15.3-dev.20260914100347
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/boot/compose.d.ts.map +1 -1
- package/dist/boot/compose.js +103 -9
- package/dist/boot/compose.js.map +1 -1
- package/dist/domain/iampolicy/access-lists.d.ts +27 -0
- package/dist/domain/iampolicy/access-lists.d.ts.map +1 -0
- package/dist/domain/iampolicy/access-lists.js +124 -0
- package/dist/domain/iampolicy/access-lists.js.map +1 -0
- package/dist/domain/iampolicy/constants.d.ts +135 -0
- package/dist/domain/iampolicy/constants.d.ts.map +1 -0
- package/dist/domain/iampolicy/constants.js +203 -0
- package/dist/domain/iampolicy/constants.js.map +1 -0
- package/dist/domain/iampolicy/controller.d.ts +29 -0
- package/dist/domain/iampolicy/controller.d.ts.map +1 -0
- package/dist/domain/iampolicy/controller.js +451 -0
- package/dist/domain/iampolicy/controller.js.map +1 -0
- package/dist/domain/iampolicy/display-resolver.d.ts +6 -0
- package/dist/domain/iampolicy/display-resolver.d.ts.map +1 -0
- package/dist/domain/iampolicy/display-resolver.js +90 -0
- package/dist/domain/iampolicy/display-resolver.js.map +1 -0
- package/dist/domain/iampolicy/grant-path.d.ts +42 -0
- package/dist/domain/iampolicy/grant-path.d.ts.map +1 -0
- package/dist/domain/iampolicy/grant-path.js +183 -0
- package/dist/domain/iampolicy/grant-path.js.map +1 -0
- package/dist/domain/iampolicy/grant-scope.d.ts +4 -0
- package/dist/domain/iampolicy/grant-scope.d.ts.map +1 -0
- package/dist/domain/iampolicy/grant-scope.js +34 -0
- package/dist/domain/iampolicy/grant-scope.js.map +1 -0
- package/dist/domain/iampolicy/membership.d.ts +111 -0
- package/dist/domain/iampolicy/membership.d.ts.map +1 -0
- package/dist/domain/iampolicy/membership.js +152 -0
- package/dist/domain/iampolicy/membership.js.map +1 -0
- package/dist/domain/iampolicy/permissions.d.ts +19 -0
- package/dist/domain/iampolicy/permissions.d.ts.map +1 -0
- package/dist/domain/iampolicy/permissions.js +27 -0
- package/dist/domain/iampolicy/permissions.js.map +1 -0
- package/dist/domain/iampolicy/resource-store.d.ts +4 -0
- package/dist/domain/iampolicy/resource-store.d.ts.map +1 -0
- package/dist/domain/iampolicy/resource-store.js +135 -0
- package/dist/domain/iampolicy/resource-store.js.map +1 -0
- package/dist/domain/iampolicy/role-lifecycle.d.ts +9 -0
- package/dist/domain/iampolicy/role-lifecycle.d.ts.map +1 -0
- package/dist/domain/iampolicy/role-lifecycle.js +106 -0
- package/dist/domain/iampolicy/role-lifecycle.js.map +1 -0
- package/dist/domain/iampolicy/roles.d.ts +11 -0
- package/dist/domain/iampolicy/roles.d.ts.map +1 -0
- package/dist/domain/iampolicy/roles.js +78 -0
- package/dist/domain/iampolicy/roles.js.map +1 -0
- package/dist/domain/iampolicy/specs.d.ts +7 -0
- package/dist/domain/iampolicy/specs.d.ts.map +1 -0
- package/dist/domain/iampolicy/specs.js +45 -0
- package/dist/domain/iampolicy/specs.js.map +1 -0
- package/dist/domain/iampolicy/steps.d.ts +18 -0
- package/dist/domain/iampolicy/steps.d.ts.map +1 -0
- package/dist/domain/iampolicy/steps.js +117 -0
- package/dist/domain/iampolicy/steps.js.map +1 -0
- package/dist/domain/iampolicy/store-contract.d.ts +8 -0
- package/dist/domain/iampolicy/store-contract.d.ts.map +1 -0
- package/dist/domain/iampolicy/store-contract.js +258 -0
- package/dist/domain/iampolicy/store-contract.js.map +1 -0
- package/dist/domain/iampolicy/store.d.ts +78 -0
- package/dist/domain/iampolicy/store.d.ts.map +1 -0
- package/dist/domain/iampolicy/store.js +13 -0
- package/dist/domain/iampolicy/store.js.map +1 -0
- package/dist/domain/iampolicy/wire-refusals.d.ts +25 -0
- package/dist/domain/iampolicy/wire-refusals.d.ts.map +1 -0
- package/dist/domain/iampolicy/wire-refusals.js +76 -0
- package/dist/domain/iampolicy/wire-refusals.js.map +1 -0
- package/dist/domain/identityaccount/constants.d.ts +33 -0
- package/dist/domain/identityaccount/constants.d.ts.map +1 -1
- package/dist/domain/identityaccount/constants.js +2 -48
- package/dist/domain/identityaccount/constants.js.map +1 -1
- package/dist/domain/identityaccount/controller.d.ts +8 -1
- package/dist/domain/identityaccount/controller.d.ts.map +1 -1
- package/dist/domain/identityaccount/controller.js +54 -29
- package/dist/domain/identityaccount/controller.js.map +1 -1
- package/dist/domain/identityaccount/operator.d.ts.map +1 -1
- package/dist/domain/identityaccount/operator.js +2 -4
- package/dist/domain/identityaccount/operator.js.map +1 -1
- package/dist/domain/identityaccount/provisioning.d.ts +20 -1
- package/dist/domain/identityaccount/provisioning.d.ts.map +1 -1
- package/dist/domain/identityaccount/provisioning.js +17 -3
- package/dist/domain/identityaccount/provisioning.js.map +1 -1
- package/dist/domain/identityaccount/resolve.d.ts +23 -0
- package/dist/domain/identityaccount/resolve.d.ts.map +1 -1
- package/dist/domain/identityaccount/resolve.js +17 -0
- package/dist/domain/identityaccount/resolve.js.map +1 -1
- package/dist/domain/identityaccount/store-contract.d.ts +4 -18
- package/dist/domain/identityaccount/store-contract.d.ts.map +1 -1
- package/dist/domain/identityaccount/store-contract.js +12 -47
- package/dist/domain/identityaccount/store-contract.js.map +1 -1
- package/dist/extensions/authorization-queries.d.ts +81 -0
- package/dist/extensions/authorization-queries.d.ts.map +1 -0
- package/dist/extensions/authorization-queries.js +2 -0
- package/dist/extensions/authorization-queries.js.map +1 -0
- package/dist/extensions/drivers.d.ts +49 -2
- package/dist/extensions/drivers.d.ts.map +1 -1
- package/dist/extensions/identity.d.ts +14 -0
- package/dist/extensions/identity.d.ts.map +1 -1
- package/dist/extensions/identity.js +18 -1
- package/dist/extensions/identity.js.map +1 -1
- package/dist/extensions/policy-grant-scope.d.ts +50 -0
- package/dist/extensions/policy-grant-scope.d.ts.map +1 -0
- package/dist/extensions/policy-grant-scope.js +2 -0
- package/dist/extensions/policy-grant-scope.js.map +1 -0
- package/dist/extensions/registry.d.ts +23 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/extensions/registry.js +30 -0
- package/dist/extensions/registry.js.map +1 -1
- package/dist/extensions/resource-authorization.d.ts +63 -0
- package/dist/extensions/resource-authorization.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pipeline/apiresource-meta.d.ts +56 -1
- package/dist/pipeline/apiresource-meta.d.ts.map +1 -1
- package/dist/pipeline/apiresource-meta.js +155 -1
- package/dist/pipeline/apiresource-meta.js.map +1 -1
- package/dist/pipeline/interceptors/auth.d.ts +12 -0
- package/dist/pipeline/interceptors/auth.d.ts.map +1 -1
- package/dist/pipeline/interceptors/auth.js +13 -1
- package/dist/pipeline/interceptors/auth.js.map +1 -1
- package/dist/pipeline/steps/authorize.d.ts +20 -5
- package/dist/pipeline/steps/authorize.d.ts.map +1 -1
- package/dist/pipeline/steps/authorize.js +37 -17
- package/dist/pipeline/steps/authorize.js.map +1 -1
- package/dist/pipeline/steps/defaults.d.ts +10 -0
- package/dist/pipeline/steps/defaults.d.ts.map +1 -1
- package/dist/pipeline/steps/defaults.js +39 -0
- package/dist/pipeline/steps/defaults.js.map +1 -1
- package/dist/store/port-contract.d.ts +61 -0
- package/dist/store/port-contract.d.ts.map +1 -0
- package/dist/store/port-contract.js +67 -0
- package/dist/store/port-contract.js.map +1 -0
- package/package.json +4 -4
- package/src/boot/compose.ts +107 -10
- package/src/domain/iampolicy/__tests__/access-lists.test.ts +238 -0
- package/src/domain/iampolicy/__tests__/constants.test.ts +388 -0
- package/src/domain/iampolicy/__tests__/controller.test.ts +960 -0
- package/src/domain/iampolicy/__tests__/display-resolver.test.ts +138 -0
- package/src/domain/iampolicy/__tests__/grant-path.test.ts +474 -0
- package/src/domain/iampolicy/__tests__/grant-scope.test.ts +61 -0
- package/src/domain/iampolicy/__tests__/iampolicy.test.ts +532 -0
- package/src/domain/iampolicy/__tests__/membership.test.ts +447 -0
- package/src/domain/iampolicy/__tests__/permissions.test.ts +41 -0
- package/src/domain/iampolicy/__tests__/resource-store.test.ts +165 -0
- package/src/domain/iampolicy/__tests__/role-lifecycle.test.ts +361 -0
- package/src/domain/iampolicy/__tests__/roles.test.ts +53 -0
- package/src/domain/iampolicy/__tests__/specs.test.ts +41 -0
- package/src/domain/iampolicy/__tests__/steps.test.ts +278 -0
- package/src/domain/iampolicy/__tests__/support.ts +195 -0
- package/src/domain/iampolicy/__tests__/wire-refusals.test.ts +117 -0
- package/src/domain/iampolicy/access-lists.ts +191 -0
- package/src/domain/iampolicy/constants.ts +243 -0
- package/src/domain/iampolicy/controller.ts +798 -0
- package/src/domain/iampolicy/display-resolver.ts +123 -0
- package/src/domain/iampolicy/grant-path.ts +270 -0
- package/src/domain/iampolicy/grant-scope.ts +36 -0
- package/src/domain/iampolicy/membership.ts +298 -0
- package/src/domain/iampolicy/permissions.ts +35 -0
- package/src/domain/iampolicy/resource-store.ts +186 -0
- package/src/domain/iampolicy/role-lifecycle.ts +132 -0
- package/src/domain/iampolicy/roles.ts +95 -0
- package/src/domain/iampolicy/specs.ts +53 -0
- package/src/domain/iampolicy/steps.ts +178 -0
- package/src/domain/iampolicy/store-contract.ts +450 -0
- package/src/domain/iampolicy/store.ts +103 -0
- package/src/domain/iampolicy/wire-refusals.ts +110 -0
- package/src/domain/identityaccount/__tests__/provisioning.test.ts +19 -7
- package/src/domain/identityaccount/__tests__/resolve.test.ts +113 -2
- package/src/domain/identityaccount/constants.ts +16 -31
- package/src/domain/identityaccount/controller.ts +65 -35
- package/src/domain/identityaccount/operator.ts +5 -5
- package/src/domain/identityaccount/provisioning.ts +43 -5
- package/src/domain/identityaccount/resolve.ts +43 -0
- package/src/domain/identityaccount/store-contract.ts +22 -70
- package/src/extensions/__tests__/composed-support.ts +87 -0
- package/src/extensions/__tests__/iam-policy-composed.test.ts +373 -0
- package/src/extensions/__tests__/iam-policy-points.test.ts +169 -0
- package/src/extensions/__tests__/identity-account-composed.test.ts +12 -78
- package/src/extensions/__tests__/identity.test.ts +62 -0
- package/src/extensions/__tests__/tier-truthfulness.test.ts +8 -0
- package/src/extensions/authorization-queries.ts +97 -0
- package/src/extensions/drivers.ts +49 -2
- package/src/extensions/identity.ts +21 -0
- package/src/extensions/policy-grant-scope.ts +50 -0
- package/src/extensions/registry.ts +62 -1
- package/src/extensions/resource-authorization.ts +65 -0
- package/src/index.ts +20 -0
- package/src/pipeline/__tests__/grantable-roles-for.test.ts +87 -0
- package/src/pipeline/__tests__/kind-by-enum-name.test.ts +107 -0
- package/src/pipeline/__tests__/kind-served-by-edition.test.ts +107 -0
- package/src/pipeline/apiresource-meta.ts +181 -1
- package/src/pipeline/interceptors/auth.ts +14 -1
- package/src/pipeline/steps/__tests__/authorize-annotation-completeness.test.ts +73 -3
- package/src/pipeline/steps/__tests__/authorize.test.ts +134 -9
- package/src/pipeline/steps/__tests__/derived-id.test.ts +49 -0
- package/src/pipeline/steps/authorize.ts +46 -21
- package/src/pipeline/steps/defaults.ts +42 -0
- package/src/store/__tests__/port-contract.test.ts +123 -0
- package/src/store/port-contract.ts +102 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IamPolicy controller (20260913.01, T01_0_plan.md §3a; T01_1_review.md
|
|
3
|
+
* Q-OR-2, Q-OR-3, Q-OR-7, Q-OR-8 and the slice-5 rulings Q-S5-1..10) —
|
|
4
|
+
* the ROW half of the IamPolicy contract served ONCE by @stigmer/server in
|
|
5
|
+
* every edition, all fourteen RPCs. The behavioural reference is the
|
|
6
|
+
* cloud's iam/policy/handlers.ts (the Java pipelines rendered flat), whose
|
|
7
|
+
* handlers retire against this module at the S3 re-point; the byte-pinned
|
|
8
|
+
* copy moved with it (constants.ts). The cloud keeps what differs per
|
|
9
|
+
* edition and registers it: its row store (`drivers.iamPolicyStore`), its
|
|
10
|
+
* grant scope (`drivers.policyGrantScope`), its OpenFGA query engine
|
|
11
|
+
* (`drivers.authorizationQueries`) and the tuple mirror in the lifecycle
|
|
12
|
+
* driver's two policy hooks — and reaches the write lanes here as
|
|
13
|
+
* in-process RPCs (Q-OR-1), never through an exported constructor.
|
|
14
|
+
*
|
|
15
|
+
* Shape (Q-S5-1). The six command RPCs are pipeline chains, each
|
|
16
|
+
* `Authorize → ValidateProto → <one domain step>` (steps.ts): the write is
|
|
17
|
+
* the grant path's, the annotation drives position 1, and the executor's
|
|
18
|
+
* fault mapping covers a store fault from inside the path. The eight
|
|
19
|
+
* query RPCs are direct handlers over `authorizeDirect` (the cloud's
|
|
20
|
+
* shape; the identity-account lookups' precedent). No chain here splices
|
|
21
|
+
* a tuple step: a policy is the authorization record, not a protected
|
|
22
|
+
* resource — the cloud builds policies outside any chain, the FGA
|
|
23
|
+
* `iam_policy` type is dead, and seeding scope links for a row would
|
|
24
|
+
* recurse (the ts-server guideline records this exception).
|
|
25
|
+
*
|
|
26
|
+
* What the cloud's handlers recorded as surprises, kept or corrected:
|
|
27
|
+
* - `delete` and `create` are idempotent (absent → the default instance;
|
|
28
|
+
* held → the row). `delete` now authorizes BEFORE it loads (Q-OR-2:
|
|
29
|
+
* the annotation names the spec's resource), so a caller without
|
|
30
|
+
* `can_grant_access` hears PERMISSION_DENIED even for an absent
|
|
31
|
+
* triple — strictly safer than the cloud's silent default instance.
|
|
32
|
+
* - `create` validates the role BEFORE it writes (the cloud's order): a
|
|
33
|
+
* held row under a role the kind does not grant is refused, never
|
|
34
|
+
* answered as a duplicate. It also grants to PEOPLE only (Q-S9-2,
|
|
35
|
+
* 2026-09-14): a principal that is not an identity account is
|
|
36
|
+
* INVALID_ARGUMENT — a row naming a resource as its principal is the
|
|
37
|
+
* structural link the hierarchy walk follows, `bootstrapPolicy`'s to
|
|
38
|
+
* write, and through this lane would have let a right on one
|
|
39
|
+
* organization list another's members. The cloud's create had the
|
|
40
|
+
* gap; the corrected answer lands at the re-point.
|
|
41
|
+
* - `checkMyPermission`, `checkAuthorization` and
|
|
42
|
+
* `listAuthorizedResourceIds` skip position 1 by proto option (IAM
|
|
43
|
+
* authorizing IAM would recurse); trust is authentication plus the
|
|
44
|
+
* principal-trust rule, compared against the caller's ACCOUNT
|
|
45
|
+
* (`accountForCaller`, Q-S4-1 — the trusted-local interceptor stamps
|
|
46
|
+
* the operator's email, so the stamp alone would never match).
|
|
47
|
+
* - `listAuthorizedPrincipalIds` is annotation-driven since slice 1
|
|
48
|
+
* (finding 7): the same target `listResourceAccessByPrincipal` checks.
|
|
49
|
+
* - `get` is the one load-then-authorize lane: its target is the ROW's
|
|
50
|
+
* resource, handed to the annotation's evaluation as an override.
|
|
51
|
+
* - the three system RPCs (`bootstrapPolicy`, `cleanupResourcePolicies`,
|
|
52
|
+
* `bootstrapRevokeOrgAccess`) admit the platform's own pipelines only
|
|
53
|
+
* (`isPlatformPipelineCaller`) and refuse a wire user
|
|
54
|
+
* PERMISSION_DENIED with the annotation's own `error_msg`, BEFORE the
|
|
55
|
+
* chain — under the permissive Authorizer the annotation alone would
|
|
56
|
+
* admit anyone (Q-OR-7). Position 1 still runs the static platform
|
|
57
|
+
* check, so the cloud's `can_bootstrap_iam` FGA check is unchanged.
|
|
58
|
+
* - every kind string that came off the wire passes the domain's wire
|
|
59
|
+
* refusals (Q-S5-2) BEFORE position 1 (Q-S6-1, 2026-09-14):
|
|
60
|
+
* INVALID_ARGUMENT with the pinned copy, on every lane, in every
|
|
61
|
+
* edition. This is not input validation moved ahead of authorization
|
|
62
|
+
* — it is naming the authorization target. A kind string that names
|
|
63
|
+
* no kind names nothing to authorize against, so there is no
|
|
64
|
+
* position-1 question to ask; `checkMyPermission` refuses an unknown
|
|
65
|
+
* permission name first for the same reason, and the cloud's
|
|
66
|
+
* handlers kept this order (`kindFromSpecString` before
|
|
67
|
+
* `authorizeRpc`), so the wire is unchanged at the re-point. Safe by
|
|
68
|
+
* construction: the protovalidate interceptor (chain position 3) has
|
|
69
|
+
* validated every request before a handler runs, so both refs are
|
|
70
|
+
* present. The resolver's "resolution never throws" rule
|
|
71
|
+
* (steps/authorize.ts) is untouched — its unknown-kind deny remains
|
|
72
|
+
* the backstop for a stored row on `get`, the one kind string that is
|
|
73
|
+
* not wire input.
|
|
74
|
+
*
|
|
75
|
+
* `checkMyPermission` has one definition (Q-OR-8; Q-S5-3), in this order:
|
|
76
|
+
* UNAUTHENTICATED for an empty identity; the relation must be an
|
|
77
|
+
* IamPermission name; the resource kind must be known; contextual
|
|
78
|
+
* policies ride the query engine or refuse UNIMPLEMENTED; then (1) a kind
|
|
79
|
+
* this edition does not serve is `false` — nobody holds a permission on a
|
|
80
|
+
* kind that does not exist here, which is what keeps the operator-only
|
|
81
|
+
* settings navigation hidden on open source; (2) `can_grant_access` on a
|
|
82
|
+
* kind outside the grant scope is `false` — the console's PermissionGate
|
|
83
|
+
* hides grant controls with no new SDK surface (Q-OR-5); (3) the composed
|
|
84
|
+
* Authorizer: allow → true, deny and not-found → false, unavailable →
|
|
85
|
+
* INTERNAL, never softened into a denial.
|
|
86
|
+
*
|
|
87
|
+
* Proven by __tests__/controller.test.ts (every arm, over a router
|
|
88
|
+
* transport with fakes), __tests__/iampolicy.test.ts (the composed
|
|
89
|
+
* trusted-local server) and the iampolicy conformance suite.
|
|
90
|
+
*/
|
|
91
|
+
import { create } from "@bufbuild/protobuf";
|
|
92
|
+
import { getOption } from "@bufbuild/protobuf";
|
|
93
|
+
import { EmptySchema } from "@bufbuild/protobuf/wkt";
|
|
94
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
95
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
96
|
+
import { config as rpcAuthorizationConfig } from "@stigmer/protos/ai/stigmer/commons/rpc/method_options_pb";
|
|
97
|
+
import { IamPolicyCommandController } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/command_pb";
|
|
98
|
+
import { AuthorizedPrincipalIdsListSchema, AuthorizedResourceIdsListSchema, CheckAuthorizationResultSchema, PrincipalResourceRolesSchema, PrincipalsCountSchema, ResourceAccessByPrincipalListSchema, RevokeOrgAccessInputSchema, } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/io_pb";
|
|
99
|
+
import { IamPolicyQueryController } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/query_pb";
|
|
100
|
+
import { ApiResourceRefSchema, IamPolicySpecSchema, } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
|
|
101
|
+
import { IamPermission } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
102
|
+
import { isPlatformPipelineCaller } from "../../extensions/identity.js";
|
|
103
|
+
import { kindByEnumName, kindEnumName, kindServedByEdition, } from "../../pipeline/apiresource-meta.js";
|
|
104
|
+
import { internalError } from "../../pipeline/errors.js";
|
|
105
|
+
import { apiResourceKindKey } from "../../pipeline/interceptors/apiresource.js";
|
|
106
|
+
import { callerIdentityOf } from "../../pipeline/interceptors/auth.js";
|
|
107
|
+
import { newPipeline } from "../../pipeline/pipeline.js";
|
|
108
|
+
import { RequestContext } from "../../pipeline/request-context.js";
|
|
109
|
+
import { AUTHORIZATION_UNAVAILABLE_MESSAGE, authorizeDirect, evaluateAuthorizer, newAuthorizeStep, } from "../../pipeline/steps/authorize.js";
|
|
110
|
+
import { newValidateProtoStep } from "../../pipeline/steps/validation.js";
|
|
111
|
+
import { accountForCaller } from "../identityaccount/resolve.js";
|
|
112
|
+
import { buildPrincipalAccessList, resolveHierarchy } from "./access-lists.js";
|
|
113
|
+
import { AUTHENTICATION_REQUIRED_MESSAGE, AUTHORIZATION_QUERIES_UNIMPLEMENTED_MESSAGE, policyNotFoundMessage, unknownPermissionMessage, } from "./constants.js";
|
|
114
|
+
import { newAccountDisplayResolver } from "./display-resolver.js";
|
|
115
|
+
import { permissionByEnumName } from "./permissions.js";
|
|
116
|
+
import { assignableRelations, isAssignableRole, roleInfoFromRelation, } from "./roles.js";
|
|
117
|
+
import { POLICY_RESULT_KEY, newCleanupResourceStep, newGrantStep, newRevokeOrgAccessStep, newRevokeStep, newValidateGrantableRoleStep, } from "./steps.js";
|
|
118
|
+
import { refsOf, requireKnownPrincipalKind, requireKnownResourceKind, requireWellFormedTriple, } from "./wire-refusals.js";
|
|
119
|
+
/**
|
|
120
|
+
* The Java pre-migration `_self` principal alias — rejected with a
|
|
121
|
+
* pointer at checkMyPermission (kept only for the precise error copy).
|
|
122
|
+
*/
|
|
123
|
+
const SELF_PRINCIPAL_ID = "_self";
|
|
124
|
+
/** Registers both IamPolicy services on the router (routes stage). */
|
|
125
|
+
export function registerIamPolicyServices(router, deps) {
|
|
126
|
+
const displayResolver = newAccountDisplayResolver(deps.accounts);
|
|
127
|
+
const command = IamPolicyCommandController.method;
|
|
128
|
+
router.service(IamPolicyCommandController, {
|
|
129
|
+
create: (spec, ctx) => createPolicy(deps, spec, ctx),
|
|
130
|
+
delete: (spec, ctx) => deletePolicy(deps, spec, ctx),
|
|
131
|
+
bootstrapPolicy: (spec, ctx) => {
|
|
132
|
+
guardSystemRpc(command.bootstrapPolicy, callerIdentityOf(ctx));
|
|
133
|
+
return grantThroughChain(deps, command.bootstrapPolicy, spec, ctx, false);
|
|
134
|
+
},
|
|
135
|
+
cleanupResourcePolicies: (ref, ctx) => {
|
|
136
|
+
guardSystemRpc(command.cleanupResourcePolicies, callerIdentityOf(ctx));
|
|
137
|
+
return cleanupResourcePolicies(deps, ref, ctx);
|
|
138
|
+
},
|
|
139
|
+
revokeOrgAccess: (input, ctx) => revokeOrgAccess(deps, command.revokeOrgAccess, input, ctx),
|
|
140
|
+
bootstrapRevokeOrgAccess: (input, ctx) => {
|
|
141
|
+
guardSystemRpc(command.bootstrapRevokeOrgAccess, callerIdentityOf(ctx));
|
|
142
|
+
return revokeOrgAccess(deps, command.bootstrapRevokeOrgAccess, input, ctx);
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
router.service(IamPolicyQueryController, {
|
|
146
|
+
get: (id, ctx) => get(deps, id, ctx),
|
|
147
|
+
checkMyPermission: (input, ctx) => checkMyPermission(deps, input, ctx),
|
|
148
|
+
checkAuthorization: (input, ctx) => checkAuthorization(deps, input, ctx),
|
|
149
|
+
listAuthorizedResourceIds: (input, ctx) => listAuthorizedResourceIds(deps, input, ctx),
|
|
150
|
+
listAuthorizedPrincipalIds: (input, ctx) => listAuthorizedPrincipalIds(deps, input, ctx),
|
|
151
|
+
listResourceAccessByPrincipal: (input, ctx) => listResourceAccessByPrincipal(deps, displayResolver, input, ctx),
|
|
152
|
+
getPrincipalResourceRoles: (input, ctx) => getPrincipalResourceRoles(deps, input, ctx),
|
|
153
|
+
getPrincipalsCount: (input, ctx) => getPrincipalsCount(deps, input, ctx),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function kindOf(ctx) {
|
|
157
|
+
return ctx.values.get(apiResourceKindKey);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The admission rule of the three system RPCs (Q-OR-7): the platform's own
|
|
161
|
+
* pipelines only, refused with the RPC's own annotation copy — the proto
|
|
162
|
+
* owns that sentence, so no second pinned copy exists here.
|
|
163
|
+
*/
|
|
164
|
+
function guardSystemRpc(method, caller) {
|
|
165
|
+
if (isPlatformPipelineCaller(caller)) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
throw new ConnectError(getOption(method, rpcAuthorizationConfig).errorMsg, Code.PermissionDenied);
|
|
169
|
+
}
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
// The command chains
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
/** `create`: the wire refusal, then Authorize → ValidateProto → ValidateGrantableRole → Grant. */
|
|
174
|
+
function createPolicy(deps, spec, ctx) {
|
|
175
|
+
requireWellFormedTriple(spec);
|
|
176
|
+
return grantThroughChain(deps, IamPolicyCommandController.method.create, spec, ctx, true);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The grant chain both `create` and `bootstrapPolicy` run; only the user
|
|
180
|
+
* lane validates the role — bootstrap writes structural relations no
|
|
181
|
+
* scope would admit.
|
|
182
|
+
*/
|
|
183
|
+
async function grantThroughChain(deps, method, spec, ctx, validateRole) {
|
|
184
|
+
const reqCtx = new RequestContext(IamPolicySpecSchema, spec, callerIdentityOf(ctx), kindOf(ctx));
|
|
185
|
+
const pipeline = newPipeline(`iampolicy-${method.localName}`, deps.logger)
|
|
186
|
+
.addStep(newAuthorizeStep(method, deps.authorizer))
|
|
187
|
+
.addStep(newValidateProtoStep());
|
|
188
|
+
if (validateRole) {
|
|
189
|
+
pipeline.addStep(newValidateGrantableRoleStep(deps.grantScope));
|
|
190
|
+
}
|
|
191
|
+
await pipeline.addStep(newGrantStep(deps.grantPath)).build().execute(reqCtx);
|
|
192
|
+
return policyResultOf(reqCtx, method);
|
|
193
|
+
}
|
|
194
|
+
/** `delete`: the wire refusal, then Authorize → ValidateProto → Revoke; the revoked row, or the default instance. */
|
|
195
|
+
async function deletePolicy(deps, spec, ctx) {
|
|
196
|
+
requireWellFormedTriple(spec);
|
|
197
|
+
const method = IamPolicyCommandController.method.delete;
|
|
198
|
+
const reqCtx = new RequestContext(IamPolicySpecSchema, spec, callerIdentityOf(ctx), kindOf(ctx));
|
|
199
|
+
await newPipeline("iampolicy-delete", deps.logger)
|
|
200
|
+
.addStep(newAuthorizeStep(method, deps.authorizer))
|
|
201
|
+
.addStep(newValidateProtoStep())
|
|
202
|
+
.addStep(newRevokeStep(deps.grantPath))
|
|
203
|
+
.build()
|
|
204
|
+
.execute(reqCtx);
|
|
205
|
+
return policyResultOf(reqCtx, method);
|
|
206
|
+
}
|
|
207
|
+
/** `revokeOrgAccess` and its system twin share one chain; only the annotation differs. */
|
|
208
|
+
async function revokeOrgAccess(deps, method, input, ctx) {
|
|
209
|
+
const reqCtx = new RequestContext(RevokeOrgAccessInputSchema, input, callerIdentityOf(ctx), kindOf(ctx));
|
|
210
|
+
await newPipeline(`iampolicy-${method.localName}`, deps.logger)
|
|
211
|
+
.addStep(newAuthorizeStep(method, deps.authorizer))
|
|
212
|
+
.addStep(newValidateProtoStep())
|
|
213
|
+
.addStep(newRevokeOrgAccessStep(deps.grantPath))
|
|
214
|
+
.build()
|
|
215
|
+
.execute(reqCtx);
|
|
216
|
+
return create(EmptySchema);
|
|
217
|
+
}
|
|
218
|
+
async function cleanupResourcePolicies(deps, ref, ctx) {
|
|
219
|
+
const method = IamPolicyCommandController.method.cleanupResourcePolicies;
|
|
220
|
+
const reqCtx = new RequestContext(ApiResourceRefSchema, ref, callerIdentityOf(ctx), kindOf(ctx));
|
|
221
|
+
await newPipeline("iampolicy-cleanupResourcePolicies", deps.logger)
|
|
222
|
+
.addStep(newAuthorizeStep(method, deps.authorizer))
|
|
223
|
+
.addStep(newValidateProtoStep())
|
|
224
|
+
.addStep(newCleanupResourceStep(deps.grantPath))
|
|
225
|
+
.build()
|
|
226
|
+
.execute(reqCtx);
|
|
227
|
+
return create(EmptySchema);
|
|
228
|
+
}
|
|
229
|
+
function policyResultOf(reqCtx, method) {
|
|
230
|
+
const result = reqCtx.get(POLICY_RESULT_KEY);
|
|
231
|
+
if (result === undefined) {
|
|
232
|
+
throw internalError(new Error(`${method.localName} pipeline completed without a policy`), "policy not found in context");
|
|
233
|
+
}
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
// The direct query handlers
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
239
|
+
/** `get`: load THEN authorize — the target is the row's resource. */
|
|
240
|
+
async function get(deps, id, ctx) {
|
|
241
|
+
const policy = await read(() => deps.policies.findById(id.value), "failed to load IAM policy");
|
|
242
|
+
if (policy === undefined) {
|
|
243
|
+
throw new ConnectError(policyNotFoundMessage(id.value), Code.NotFound);
|
|
244
|
+
}
|
|
245
|
+
// A stored row is not wire input: its kind resolves without a refusal
|
|
246
|
+
// sentence (a legacy row with an unknown kind is the Authorizer's to
|
|
247
|
+
// deny, as position 1 would), and its id is the target.
|
|
248
|
+
const { resource } = refsOf(specOfRow(policy));
|
|
249
|
+
await authorizeDirect(IamPolicyQueryController.method.get, deps.authorizer, callerIdentityOf(ctx), id, { resourceKind: kindByEnumName(resource.kind), resourceId: resource.id });
|
|
250
|
+
return policy;
|
|
251
|
+
}
|
|
252
|
+
/** The one definition — see the module header for the order and its reasons. */
|
|
253
|
+
async function checkMyPermission(deps, input, ctx) {
|
|
254
|
+
const caller = requireAuthenticated(callerIdentityOf(ctx));
|
|
255
|
+
const permission = permissionByEnumName(input.relation);
|
|
256
|
+
if (permission === undefined) {
|
|
257
|
+
throw new ConnectError(unknownPermissionMessage(input.relation), Code.InvalidArgument);
|
|
258
|
+
}
|
|
259
|
+
const resource = requireRef(input.resource);
|
|
260
|
+
const resourceKind = requireKnownResourceKind(resource.kind);
|
|
261
|
+
if (input.contextualPolicies.length > 0) {
|
|
262
|
+
const engine = requireQueryEngine(deps);
|
|
263
|
+
const principal = create(ApiResourceRefSchema, {
|
|
264
|
+
kind: kindEnumName(ApiResourceKind.identity_account),
|
|
265
|
+
id: await callerPrincipalId(deps, caller),
|
|
266
|
+
});
|
|
267
|
+
const policy = create(IamPolicySpecSchema, {
|
|
268
|
+
principal,
|
|
269
|
+
relation: input.relation,
|
|
270
|
+
resource,
|
|
271
|
+
});
|
|
272
|
+
const allowed = await engine.check(policy, input.contextualPolicies);
|
|
273
|
+
return create(CheckAuthorizationResultSchema, { isAuthorized: allowed });
|
|
274
|
+
}
|
|
275
|
+
// Arm 1: nobody holds a permission on a kind this edition does not serve.
|
|
276
|
+
if (!kindServedByEdition(resourceKind, deps.edition)) {
|
|
277
|
+
return create(CheckAuthorizationResultSchema, { isAuthorized: false });
|
|
278
|
+
}
|
|
279
|
+
// Arm 2: a grant target outside the composed scope is nobody's to grant.
|
|
280
|
+
if (permission === IamPermission.can_grant_access &&
|
|
281
|
+
deps.grantScope.grantableRoles(resourceKind).length === 0) {
|
|
282
|
+
return create(CheckAuthorizationResultSchema, { isAuthorized: false });
|
|
283
|
+
}
|
|
284
|
+
// Arm 3: the composed Authorizer's answer, an outage never softened.
|
|
285
|
+
const decision = await evaluateAuthorizer(deps.authorizer, caller, {
|
|
286
|
+
permission,
|
|
287
|
+
resourceKind,
|
|
288
|
+
resourceId: resource.id,
|
|
289
|
+
});
|
|
290
|
+
switch (decision.kind) {
|
|
291
|
+
case "allow":
|
|
292
|
+
return create(CheckAuthorizationResultSchema, { isAuthorized: true });
|
|
293
|
+
case "deny":
|
|
294
|
+
case "not-found":
|
|
295
|
+
return create(CheckAuthorizationResultSchema, { isAuthorized: false });
|
|
296
|
+
case "unavailable":
|
|
297
|
+
throw internalError(decision.cause, AUTHORIZATION_UNAVAILABLE_MESSAGE);
|
|
298
|
+
default: {
|
|
299
|
+
const exhaustive = decision;
|
|
300
|
+
throw internalError(new Error(`unknown decision ${JSON.stringify(exhaustive)}`), AUTHORIZATION_UNAVAILABLE_MESSAGE);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
async function checkAuthorization(deps, input, ctx) {
|
|
305
|
+
const caller = requireAuthenticated(callerIdentityOf(ctx));
|
|
306
|
+
const policy = requireInputPolicy(input.policy);
|
|
307
|
+
await enforcePrincipalTrust(deps, caller, policy.principal);
|
|
308
|
+
requireWellFormedTriple(policy);
|
|
309
|
+
const engine = requireQueryEngine(deps);
|
|
310
|
+
const allowed = await engine.check(policy, input.contextualPolicies);
|
|
311
|
+
return create(CheckAuthorizationResultSchema, { isAuthorized: allowed });
|
|
312
|
+
}
|
|
313
|
+
/** The skip lane with no resource (finding 7): trust on the principal, then the engine. */
|
|
314
|
+
async function listAuthorizedResourceIds(deps, input, ctx) {
|
|
315
|
+
const caller = requireAuthenticated(callerIdentityOf(ctx));
|
|
316
|
+
const principal = requireRef(input.principal);
|
|
317
|
+
await enforcePrincipalTrust(deps, caller, principal);
|
|
318
|
+
requireKnownPrincipalKind(principal.kind);
|
|
319
|
+
requireKnownResourceKind(input.resourceKind);
|
|
320
|
+
const engine = requireQueryEngine(deps);
|
|
321
|
+
const resourceIds = await engine.listResourceIds(principal, input.relation, input.resourceKind, input.contextualPolicies);
|
|
322
|
+
return create(AuthorizedResourceIdsListSchema, {
|
|
323
|
+
resourceIds: [...resourceIds],
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
async function listAuthorizedPrincipalIds(deps, input, ctx) {
|
|
327
|
+
const resource = requireRef(input.resource);
|
|
328
|
+
requireKnownResourceKind(resource.kind);
|
|
329
|
+
requireKnownPrincipalKind(input.principalKind);
|
|
330
|
+
await authorizeDirect(IamPolicyQueryController.method.listAuthorizedPrincipalIds, deps.authorizer, callerIdentityOf(ctx), input);
|
|
331
|
+
const engine = requireQueryEngine(deps);
|
|
332
|
+
const principalIds = await engine.listPrincipalIds(resource, input.relation, input.principalKind, input.contextualPolicies);
|
|
333
|
+
return create(AuthorizedPrincipalIdsListSchema, {
|
|
334
|
+
principalIds: [...principalIds],
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
async function listResourceAccessByPrincipal(deps, displayResolver, input, ctx) {
|
|
338
|
+
const resource = requireRef(input.resource);
|
|
339
|
+
requireKnownResourceKind(resource.kind);
|
|
340
|
+
await authorizeDirect(IamPolicyQueryController.method.listResourceAccessByPrincipal, deps.authorizer, callerIdentityOf(ctx), input);
|
|
341
|
+
const entries = await read(async () => {
|
|
342
|
+
const hierarchy = await resolveHierarchy(deps.policies, resource.kind, resource.id, input.includeInherited);
|
|
343
|
+
return buildPrincipalAccessList(deps.policies, displayResolver, hierarchy);
|
|
344
|
+
}, "failed to list resource access");
|
|
345
|
+
return create(ResourceAccessByPrincipalListSchema, {
|
|
346
|
+
entries: [...entries],
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async function getPrincipalResourceRoles(deps, input, ctx) {
|
|
350
|
+
const resource = requireRef(input.resource);
|
|
351
|
+
const principal = requireRef(input.principal);
|
|
352
|
+
requireKnownResourceKind(resource.kind);
|
|
353
|
+
requireKnownPrincipalKind(principal.kind);
|
|
354
|
+
await authorizeDirect(IamPolicyQueryController.method.getPrincipalResourceRoles, deps.authorizer, callerIdentityOf(ctx), input);
|
|
355
|
+
const rows = await read(() => deps.policies.findByPrincipalAndResource(principal.kind, principal.id, resource.kind, resource.id), "failed to load principal roles");
|
|
356
|
+
const roles = rows
|
|
357
|
+
.map((policy) => policy.spec?.relation ?? "")
|
|
358
|
+
.filter(isAssignableRole)
|
|
359
|
+
.map(roleInfoFromRelation);
|
|
360
|
+
return create(PrincipalResourceRolesSchema, { roles });
|
|
361
|
+
}
|
|
362
|
+
async function getPrincipalsCount(deps, input, ctx) {
|
|
363
|
+
// The wire's "" means any principal kind (the port's `undefined`).
|
|
364
|
+
const principalKind = input.principalKind === "" ? undefined : input.principalKind;
|
|
365
|
+
if (principalKind !== undefined) {
|
|
366
|
+
requireKnownPrincipalKind(principalKind);
|
|
367
|
+
}
|
|
368
|
+
await authorizeDirect(IamPolicyQueryController.method.getPrincipalsCount, deps.authorizer, callerIdentityOf(ctx), input);
|
|
369
|
+
const count = await read(() => deps.policies.countDistinctPrincipalsByResource(kindEnumName(ApiResourceKind.organization), input.orgId, principalKind, assignableRelations()), "failed to count principals");
|
|
370
|
+
return create(PrincipalsCountSchema, { count });
|
|
371
|
+
}
|
|
372
|
+
// ---------------------------------------------------------------------------
|
|
373
|
+
// Shared rules
|
|
374
|
+
// ---------------------------------------------------------------------------
|
|
375
|
+
/** Java's authenticated-caller precondition on the check handlers. */
|
|
376
|
+
function requireAuthenticated(caller) {
|
|
377
|
+
if (caller.identityId === "") {
|
|
378
|
+
throw new ConnectError(AUTHENTICATION_REQUIRED_MESSAGE, Code.Unauthenticated);
|
|
379
|
+
}
|
|
380
|
+
return caller;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* The principal the caller IS, for the engine and the trust rule: the
|
|
384
|
+
* account `accountForCaller` resolves (the trusted-local stamp is an
|
|
385
|
+
* email; a composition verifier that ran before any row existed stamps
|
|
386
|
+
* a subject), else the stamped identity — an unprovisioned subject
|
|
387
|
+
* matches no tuple, which is the cloud's answer for it too.
|
|
388
|
+
*/
|
|
389
|
+
async function callerPrincipalId(deps, caller) {
|
|
390
|
+
const account = await read(() => accountForCaller(deps.accounts, caller), "failed to resolve the caller's account");
|
|
391
|
+
return account?.metadata?.id ?? caller.identityId;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The Java EnforcePrincipalTrust rules in order: the platform's own
|
|
395
|
+
* pipelines (`machine`, `internal`) may ask about any principal; a user
|
|
396
|
+
* only about their own account.
|
|
397
|
+
*/
|
|
398
|
+
async function enforcePrincipalTrust(deps, caller, principal) {
|
|
399
|
+
if (caller.callerClass === "machine" || caller.callerClass === "internal") {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (principal?.kind !== kindEnumName(ApiResourceKind.identity_account)) {
|
|
403
|
+
throw new ConnectError("Only self identity_account permission checks are supported", Code.InvalidArgument);
|
|
404
|
+
}
|
|
405
|
+
const requestedId = principal.id;
|
|
406
|
+
if (requestedId === "" || requestedId === SELF_PRINCIPAL_ID) {
|
|
407
|
+
throw new ConnectError(`The '${SELF_PRINCIPAL_ID}' principal alias is not supported — ` +
|
|
408
|
+
"use checkMyPermission for self permission checks", Code.InvalidArgument);
|
|
409
|
+
}
|
|
410
|
+
if (requestedId !== (await callerPrincipalId(deps, caller))) {
|
|
411
|
+
throw new ConnectError("Principal must be the authenticated caller", Code.PermissionDenied);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/** The tuple-half capability, or the edition's UNIMPLEMENTED — never INTERNAL. */
|
|
415
|
+
function requireQueryEngine(deps) {
|
|
416
|
+
if (deps.queries === undefined) {
|
|
417
|
+
throw new ConnectError(AUTHORIZATION_QUERIES_UNIMPLEMENTED_MESSAGE, Code.Unimplemented);
|
|
418
|
+
}
|
|
419
|
+
return deps.queries;
|
|
420
|
+
}
|
|
421
|
+
/** Boundary-validated required refs — absence here is a contract bug. */
|
|
422
|
+
function requireRef(ref) {
|
|
423
|
+
if (ref === undefined) {
|
|
424
|
+
throw internalError(new Error("required reference missing after boundary validation"), "required reference missing after boundary validation");
|
|
425
|
+
}
|
|
426
|
+
return ref;
|
|
427
|
+
}
|
|
428
|
+
/** Boundary-validated required policy input — absence here is a contract bug. */
|
|
429
|
+
function requireInputPolicy(policy) {
|
|
430
|
+
if (policy === undefined) {
|
|
431
|
+
throw internalError(new Error("required policy missing after boundary validation"), "required policy missing after boundary validation");
|
|
432
|
+
}
|
|
433
|
+
return policy;
|
|
434
|
+
}
|
|
435
|
+
/** A stored row's spec — a row without one is corrupt storage, an infrastructure fault. */
|
|
436
|
+
function specOfRow(policy) {
|
|
437
|
+
if (policy.spec === undefined) {
|
|
438
|
+
throw internalError(new Error(`policy ${policy.metadata?.id ?? "?"} has no spec — corrupt row`), "failed to load IAM policy");
|
|
439
|
+
}
|
|
440
|
+
return policy.spec;
|
|
441
|
+
}
|
|
442
|
+
/** A direct handler's store read: a fault is INTERNAL with a static message, never "not found". */
|
|
443
|
+
async function read(operation, message) {
|
|
444
|
+
try {
|
|
445
|
+
return await operation();
|
|
446
|
+
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
throw internalError(error, message);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/domain/iampolicy/controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAG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AAC,EAC9D,mDAAmD,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,2FAA2F;AAC3F,SAAS,SAAS,CAAC,MAAiB;IAClC,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,aAAa,CACjB,IAAI,KAAK,CACP,UAAU,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,GAAG,4BAA4B,CACjE,EACD,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,mGAAmG;AACnG,KAAK,UAAU,IAAI,CACjB,SAA2B,EAC3B,OAAe;IAEf,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IdentityAccountStore } from "../identityaccount/store.js";
|
|
2
|
+
import type { PrincipalDisplayResolver } from "./access-lists.js";
|
|
3
|
+
/** The one read enrichment needs from the identity-account port. */
|
|
4
|
+
export type AccountsByIds = Pick<IdentityAccountStore, "findByIds">;
|
|
5
|
+
export declare function newAccountDisplayResolver(accounts: AccountsByIds): PrincipalDisplayResolver;
|
|
6
|
+
//# sourceMappingURL=display-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-resolver.d.ts","sourceRoot":"","sources":["../../../src/domain/iampolicy/display-resolver.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAKlE,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;AAEpE,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,aAAa,GACtB,wBAAwB,CAc1B"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The access-list display resolver (20260913.01 slice 5; Q-S5-4, Q-S5-8):
|
|
3
|
+
* the account half of the Java PrincipalEnricher — batch-loads identity
|
|
4
|
+
* accounts through the identity-account domain's PORT (`findByIds`, one
|
|
5
|
+
* row per distinct id, the port's own line) and renders the
|
|
6
|
+
* ApiResourceRefView shape access listings carry: display name, email,
|
|
7
|
+
* avatar, identity origin. Moved from the cloud's iam/account/
|
|
8
|
+
* display-resolver.ts; built by the IamPolicy controller over the accounts
|
|
9
|
+
* port it already holds, never composed as a seam — the data is a domain
|
|
10
|
+
* READ, the same in every edition.
|
|
11
|
+
*
|
|
12
|
+
* The display-name precedence is `first + last > first > last >
|
|
13
|
+
* metadata.name > email`. The `metadata.name` arm is this domain's one
|
|
14
|
+
* deliberate divergence from the Java code (Q-S5-4): the trusted-local
|
|
15
|
+
* operator account carries its display name THERE and empty first/last
|
|
16
|
+
* names (identityaccount/operator.ts), while the cloud names every
|
|
17
|
+
* provisioned account by its EMAIL and fills first/last from userinfo
|
|
18
|
+
* (identityaccount/provisioning.ts; the DefaultAccountName step) — so on
|
|
19
|
+
* the cloud this arm and the email arm answer the same string, and on a
|
|
20
|
+
* laptop the Members row reads the name the operator configured instead
|
|
21
|
+
* of an address. `email` stays as the last resort for a row whose name
|
|
22
|
+
* was never defaulted.
|
|
23
|
+
*
|
|
24
|
+
* The federated provider label stays empty (the cloud's 3C provider
|
|
25
|
+
* display-name lookup never landed in the shared shape); direct and
|
|
26
|
+
* machine accounts carry the "Stigmer" label, the Java constant.
|
|
27
|
+
*/
|
|
28
|
+
import { create } from "@bufbuild/protobuf";
|
|
29
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
30
|
+
import { IdentityAccountProvisioningMode } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/enum_pb";
|
|
31
|
+
import { ApiResourceRefViewSchema, IdentityOriginSchema, } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/io_pb";
|
|
32
|
+
import { kindEnumName } from "../../pipeline/apiresource-meta.js";
|
|
33
|
+
/** The Java STIGMER_PROVIDER_LABEL constant. */
|
|
34
|
+
const STIGMER_PROVIDER_LABEL = "Stigmer";
|
|
35
|
+
export function newAccountDisplayResolver(accounts) {
|
|
36
|
+
return {
|
|
37
|
+
async resolveIdentityAccounts(ids) {
|
|
38
|
+
const rows = await accounts.findByIds(ids);
|
|
39
|
+
const resolved = new Map();
|
|
40
|
+
for (const account of rows) {
|
|
41
|
+
const id = account.metadata?.id ?? "";
|
|
42
|
+
resolved.set(id, viewOf(id, account));
|
|
43
|
+
}
|
|
44
|
+
return resolved;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function viewOf(id, account) {
|
|
49
|
+
const spec = account.spec;
|
|
50
|
+
return create(ApiResourceRefViewSchema, {
|
|
51
|
+
kind: kindEnumName(ApiResourceKind.identity_account),
|
|
52
|
+
id,
|
|
53
|
+
name: displayNameOf(spec?.firstName ?? "", spec?.lastName ?? "", account.metadata?.name ?? "", spec?.email ?? ""),
|
|
54
|
+
email: spec?.email ?? "",
|
|
55
|
+
avatar: spec?.pictureUrl ?? "",
|
|
56
|
+
identityOrigin: create(IdentityOriginSchema, {
|
|
57
|
+
provisioningMode: spec?.provisioningMode ??
|
|
58
|
+
IdentityAccountProvisioningMode.identity_account_provisioning_mode_unspecified,
|
|
59
|
+
providerDisplayName: providerLabelOf(spec?.provisioningMode),
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** The Java buildDisplayName precedence, with the account's own name before the email (Q-S5-4). */
|
|
64
|
+
function displayNameOf(firstName, lastName, accountName, email) {
|
|
65
|
+
if (firstName !== "" && lastName !== "") {
|
|
66
|
+
return `${firstName} ${lastName}`;
|
|
67
|
+
}
|
|
68
|
+
if (firstName !== "") {
|
|
69
|
+
return firstName;
|
|
70
|
+
}
|
|
71
|
+
if (lastName !== "") {
|
|
72
|
+
return lastName;
|
|
73
|
+
}
|
|
74
|
+
if (accountName !== "") {
|
|
75
|
+
return accountName;
|
|
76
|
+
}
|
|
77
|
+
return email;
|
|
78
|
+
}
|
|
79
|
+
function providerLabelOf(mode) {
|
|
80
|
+
switch (mode) {
|
|
81
|
+
case IdentityAccountProvisioningMode.direct:
|
|
82
|
+
case IdentityAccountProvisioningMode.machine:
|
|
83
|
+
return STIGMER_PROVIDER_LABEL;
|
|
84
|
+
default:
|
|
85
|
+
// federated / platform_client / unspecified carry no external
|
|
86
|
+
// provider label (the Java switch arms).
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=display-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-resolver.js","sourceRoot":"","sources":["../../../src/domain/iampolicy/display-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,EAAE,+BAA+B,EAAE,MAAM,2DAA2D,CAAC;AAE5G,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAIlE,gDAAgD;AAChD,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAKzC,MAAM,UAAU,yBAAyB,CACvC,QAAuB;IAEvB,OAAO;QACL,KAAK,CAAC,uBAAuB,CAC3B,GAAG;YAEH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAC3C,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ACpC,CAAC;IACD,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;QACvB,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CACtB,IAAiD;IAEjD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,+BAA+B,CAAC,MAAM,CAAC;QAC5C,KAAK,+BAA+B,CAAC,OAAO;YAC1C,OAAO,sBAAsB,CAAC;QAChC;YACE,8DAA8D;YAC9D,yCAAyC;YACzC,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { IamPolicy } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/api_pb";
|
|
2
|
+
import type { ApiResourceRef, IamPolicySpec } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
|
|
3
|
+
import type { Logger } from "../../boot/logger.js";
|
|
4
|
+
import type { CallerIdentity } from "../../extensions/identity.js";
|
|
5
|
+
import type { ResourceAuthorizationLifecycle } from "../../extensions/resource-authorization.js";
|
|
6
|
+
import type { IamPolicyStore } from "./store.js";
|
|
7
|
+
export interface GrantResult {
|
|
8
|
+
readonly policy: IamPolicy;
|
|
9
|
+
/** True when the triple was already held: no row was written, the hook still fired. */
|
|
10
|
+
readonly duplicate: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface IamPolicyGrantPath {
|
|
13
|
+
/**
|
|
14
|
+
* Grant the triple as `caller`: gate, find by triple, write the row when
|
|
15
|
+
* absent (the caller's audit stamp), then `onPolicyGranted` — on the
|
|
16
|
+
* duplicate arm too. A hook throw fails the grant with the row in place.
|
|
17
|
+
*/
|
|
18
|
+
grant(spec: IamPolicySpec, caller: CallerIdentity): Promise<GrantResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Revoke the triple: gate, find by triple, `onPolicyRevoked` (with the
|
|
21
|
+
* row, or with the spec alone on the absent arm), then delete the row.
|
|
22
|
+
* A hook throw leaves row and tuple. Answers the revoked row, or
|
|
23
|
+
* `undefined` when there was none.
|
|
24
|
+
*/
|
|
25
|
+
revokeBySpec(spec: IamPolicySpec): Promise<IamPolicy | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Revoke every row naming the ref as its resource, then every row naming
|
|
28
|
+
* it as its principal, each through the revoke order; a row that is both
|
|
29
|
+
* is revoked once. Nothing to clean is a no-op.
|
|
30
|
+
*/
|
|
31
|
+
cleanupResource(ref: ApiResourceRef): Promise<void>;
|
|
32
|
+
/** Revoke every relation the account holds directly on the organization. */
|
|
33
|
+
revokeOrgAccess(identityAccountId: string, organizationId: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface IamPolicyGrantPathDeps {
|
|
36
|
+
readonly policies: IamPolicyStore;
|
|
37
|
+
/** The composed driver, if any; a driver without the two policy hooks is the same as none. */
|
|
38
|
+
readonly lifecycle: ResourceAuthorizationLifecycle | undefined;
|
|
39
|
+
readonly logger: Logger;
|
|
40
|
+
}
|
|
41
|
+
export declare function newIamPolicyGrantPath(deps: IamPolicyGrantPathDeps): IamPolicyGrantPath;
|
|
42
|
+
//# sourceMappingURL=grant-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-path.d.ts","sourceRoot":"","sources":["../../../src/domain/iampolicy/grant-path.ts"],"names":[],"mappings":"AA2DA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oDAAoD,CAAC;AAEpF,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,qDAAqD,CAAC;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA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