@stigmer/server 3.37.1 → 3.38.1
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/README.md +1 -1
- package/dist/boot/compose.d.ts.map +1 -1
- package/dist/boot/compose.js +4 -1
- package/dist/boot/compose.js.map +1 -1
- package/dist/boot/config.d.ts +18 -7
- package/dist/boot/config.d.ts.map +1 -1
- package/dist/boot/config.js +1 -0
- package/dist/boot/config.js.map +1 -1
- package/dist/domain/iampolicy/grant-path.d.ts +7 -3
- package/dist/domain/iampolicy/grant-path.d.ts.map +1 -1
- package/dist/domain/iampolicy/grant-path.js +10 -2
- package/dist/domain/iampolicy/grant-path.js.map +1 -1
- package/dist/domain/mcpserver/complete-oauth-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/complete-oauth-connect.js +10 -4
- package/dist/domain/mcpserver/complete-oauth-connect.js.map +1 -1
- package/dist/domain/mcpserver/connect.d.ts +2 -1
- package/dist/domain/mcpserver/connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/connect.js +5 -2
- package/dist/domain/mcpserver/connect.js.map +1 -1
- package/dist/domain/mcpserver/controller.d.ts.map +1 -1
- package/dist/domain/mcpserver/controller.js +7 -3
- package/dist/domain/mcpserver/controller.js.map +1 -1
- package/dist/domain/mcpserver/get-oauth-grant-status.js +1 -1
- package/dist/domain/mcpserver/initiate-oauth-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/initiate-oauth-connect.js +8 -4
- package/dist/domain/mcpserver/initiate-oauth-connect.js.map +1 -1
- package/dist/domain/mcpserver/start-connect.d.ts +2 -2
- package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/start-connect.js +10 -4
- package/dist/domain/mcpserver/start-connect.js.map +1 -1
- package/dist/domain/organization/controller.d.ts +4 -1
- package/dist/domain/organization/controller.d.ts.map +1 -1
- package/dist/domain/organization/controller.js +28 -4
- package/dist/domain/organization/controller.js.map +1 -1
- package/dist/domain/organization/steps.d.ts +22 -0
- package/dist/domain/organization/steps.d.ts.map +1 -1
- package/dist/domain/organization/steps.js +50 -2
- package/dist/domain/organization/steps.js.map +1 -1
- package/dist/domain/platform/controller.d.ts +7 -5
- package/dist/domain/platform/controller.d.ts.map +1 -1
- package/dist/domain/platform/controller.js +4 -2
- package/dist/domain/platform/controller.js.map +1 -1
- package/dist/extensions/gate-slots.d.ts +14 -1
- package/dist/extensions/gate-slots.d.ts.map +1 -1
- package/dist/extensions/gate-slots.js +1 -0
- package/dist/extensions/gate-slots.js.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.d.ts +6 -2
- package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.js +6 -2
- package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
- package/package.json +6 -6
- package/src/boot/__tests__/config.test.ts +31 -0
- package/src/boot/compose.ts +4 -1
- package/src/boot/config.ts +23 -7
- package/src/domain/agentexecution/__tests__/store-faults.test.ts +6 -26
- package/src/domain/iampolicy/__tests__/grant-path.test.ts +40 -7
- package/src/domain/iampolicy/grant-path.ts +19 -5
- package/src/domain/mcpserver/__tests__/store-faults.test.ts +333 -0
- package/src/domain/mcpserver/complete-oauth-connect.ts +13 -4
- package/src/domain/mcpserver/connect.ts +7 -3
- package/src/domain/mcpserver/controller.ts +7 -3
- package/src/domain/mcpserver/get-oauth-grant-status.ts +1 -1
- package/src/domain/mcpserver/initiate-oauth-connect.ts +8 -4
- package/src/domain/mcpserver/start-connect.ts +12 -6
- package/src/domain/organization/__tests__/organization-delete.test.ts +266 -0
- package/src/domain/organization/controller.ts +40 -8
- package/src/domain/organization/steps.ts +66 -2
- package/src/domain/platform/__tests__/platform.test.ts +55 -3
- package/src/domain/platform/controller.ts +11 -7
- package/src/domain/workflowexecution/__tests__/store-faults.test.ts +6 -26
- package/src/extensions/__tests__/registry.test.ts +3 -0
- package/src/extensions/gate-slots.ts +14 -0
- package/src/pipeline/__tests__/blind-not-found.test.ts +0 -5
- package/src/pipeline/__tests__/support.ts +48 -5
- package/src/pipeline/steps/authorization-tuples.ts +6 -2
|
@@ -10,12 +10,20 @@
|
|
|
10
10
|
* uniqueness guarantee, mirroring cloud's OrganizationCreateHandler
|
|
11
11
|
* (CheckDuplicate + CopySlugToId) step-for-step.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The same deviation shapes the delete: a freed slug is anyone's to take,
|
|
14
|
+
* so newRevokeOrganizationPoliciesStep revokes the organization's policy
|
|
15
|
+
* rows BEFORE its row is deleted, and fails the delete when it cannot.
|
|
16
|
+
*
|
|
17
|
+
* Proven by organization.conformance.test.ts (CONFORMANCE_TARGET=local),
|
|
18
|
+
* __tests__/organization.test.ts and __tests__/organization-delete.test.ts.
|
|
15
19
|
*/
|
|
20
|
+
import { create } from "@bufbuild/protobuf";
|
|
16
21
|
import { ResourceNotFoundError } from "../../store/interface.js";
|
|
17
22
|
import { alreadyExistsError, internalError } from "../../pipeline/errors.js";
|
|
23
|
+
import { EXISTING_RESOURCE_KEY } from "../../pipeline/steps/load-existing.js";
|
|
18
24
|
import { metadataOf } from "../../pipeline/steps/shapes.js";
|
|
25
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
26
|
+
import { ApiResourceRefSchema } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
|
|
19
27
|
import { OrganizationSchema } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
20
28
|
/**
|
|
21
29
|
* Rejects a create when an organization already exists with the same slug,
|
|
@@ -86,4 +94,44 @@ export function newCopySlugToIdStep() {
|
|
|
86
94
|
},
|
|
87
95
|
};
|
|
88
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Revokes every policy row that names the organization, as principal or as
|
|
99
|
+
* resource, before the delete removes its row: the rows its members hold
|
|
100
|
+
* on it, and the scope link every organization-scoped resource holds to
|
|
101
|
+
* it. Runs after the `org-delete:pre-delete` slot and before
|
|
102
|
+
* DeleteResource.
|
|
103
|
+
*
|
|
104
|
+
* The generic delete chains clean up after the row and log a fault,
|
|
105
|
+
* because a deleted resource's rows grant nothing once it is gone. An
|
|
106
|
+
* organization is the exception: its id is its slug, the delete frees the
|
|
107
|
+
* slug, and a row left behind would grant whoever creates the slug next.
|
|
108
|
+
* So this step does not catch. A fault fails the delete with the
|
|
109
|
+
* organization in place, and a retry resumes where the revocation stopped
|
|
110
|
+
* (the grant path revokes the organization's owners last, so the owner
|
|
111
|
+
* who retries still can). The grant path fires the composed driver's
|
|
112
|
+
* `onPolicyRevoked` before each row, so a composition's tuples go with
|
|
113
|
+
* their rows. The post-delete CleanupIamPolicies still runs: it catches
|
|
114
|
+
* whatever a concurrent write named the organization with in between.
|
|
115
|
+
*/
|
|
116
|
+
export function newRevokeOrganizationPoliciesStep(grantPath) {
|
|
117
|
+
return {
|
|
118
|
+
name: "RevokeOrganizationPolicies",
|
|
119
|
+
async execute(ctx) {
|
|
120
|
+
const organization = ctx.get(EXISTING_RESOURCE_KEY);
|
|
121
|
+
const id = organization?.metadata?.id ?? "";
|
|
122
|
+
if (id === "") {
|
|
123
|
+
throw internalError(new Error("organization delete reached RevokeOrganizationPolicies without its loaded row"), "failed to remove the organization's access policies");
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
await grantPath.cleanupResource(create(ApiResourceRefSchema, {
|
|
127
|
+
kind: ApiResourceKind[ApiResourceKind.organization],
|
|
128
|
+
id,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
throw internalError(error, "failed to remove the organization's access policies");
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
89
137
|
//# sourceMappingURL=steps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../../src/domain/organization/steps.ts"],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AAK,EAAE,EAAE,CAAC;gBACd,MAAM,aAAa,CACjB,IAAI,KAAK,CAAC,+EAA+E,CAAC,EAC1F,qDAAqD,CACtD,CAAC;YACJ,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,eAAe,CAC7B,MAAM,CAAC,oBAAoB,EAAE;oBAC3B,IAAI,EAAE,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC;oBACnD,EAAE;iBACH,CAAC,CACH,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,aAAa,CACjB,KAAK,EACL,qDAAqD,CACtD,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -53,12 +53,14 @@ import type { LicenseStatusProvider } from "../../extensions/license-status.js";
|
|
|
53
53
|
import type { RunnerCredentialProvider } from "../../runnerauth/runner-credential-provider.js";
|
|
54
54
|
export interface PlatformControllerDeps {
|
|
55
55
|
/**
|
|
56
|
-
* Temporal coordinates
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
56
|
+
* The Temporal coordinates published to embedded runners. The address
|
|
57
|
+
* is the one a runner should dial, which is not always the one this
|
|
58
|
+
* server dials: a clustered server reaches Temporal by an internal name
|
|
59
|
+
* its desktop runners cannot resolve (stigmer#1357). The composition
|
|
60
|
+
* root passes config.runnerBootstrapTemporalAddress, which defaults to
|
|
61
|
+
* the server's own address; the namespace is the server's.
|
|
60
62
|
*/
|
|
61
|
-
readonly
|
|
63
|
+
readonly runnerBootstrapTemporalAddress: string;
|
|
62
64
|
readonly temporalNamespace: string;
|
|
63
65
|
/**
|
|
64
66
|
* Mints the execution-scoped tokens getRunnerScopedToken hands to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/domain/platform/controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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AAC,GAAG,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,yEAAyE;AACzE,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,sBAAsB,GAC3B,IAAI,CASN"}
|
|
@@ -63,7 +63,9 @@ async function getLicenseStatus(deps) {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Go GetRunnerBootstrapConfig: the Temporal coordinates an embedded runner
|
|
66
|
-
* should connect to so it can self-bootstrap from a token alone
|
|
66
|
+
* should connect to so it can self-bootstrap from a token alone: the
|
|
67
|
+
* address deps name for runners, never assumed to be the server's own
|
|
68
|
+
* (the proto's "the one reachable by the caller"). The
|
|
67
69
|
* RunnerAccessToken / TokenType / RunnerAccessTokenExpiresInSeconds fields
|
|
68
70
|
* are intentionally left empty in OSS: minting an iss=stigmer proxy token
|
|
69
71
|
* is a cloud-only capability (OSS has no Cursor BiDi proxy to authenticate
|
|
@@ -79,7 +81,7 @@ async function getLicenseStatus(deps) {
|
|
|
79
81
|
*/
|
|
80
82
|
async function getRunnerBootstrapConfig(deps, ctx) {
|
|
81
83
|
const output = create(GetRunnerBootstrapConfigOutputSchema, {
|
|
82
|
-
temporalAddress: deps.
|
|
84
|
+
temporalAddress: deps.runnerBootstrapTemporalAddress,
|
|
83
85
|
temporalNamespace: deps.temporalNamespace,
|
|
84
86
|
});
|
|
85
87
|
const bootstrapCredentials = deps.runnerAuthService.bootstrapCredentials?.bind(deps.runnerAuthService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/domain/platform/controller.ts"],"names":[],"mappings":"AAiDA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,O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,WAAW;YACd,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACvE,KAAK,SAAS;YACZ,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QAC1B,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,UAAU,GAAU,KAAK,CAAC,KAAK,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -53,6 +53,19 @@
|
|
|
53
53
|
* limit belongs here too. `apply` delegates to create on its create arm,
|
|
54
54
|
* so the slot fires there as well.
|
|
55
55
|
*
|
|
56
|
+
* The tenth, `org-delete:pre-delete`: the organization delete chain after
|
|
57
|
+
* LoadExistingForDelete and before any write, so the organization exists
|
|
58
|
+
* and is loaded (EXISTING_RESOURCE_KEY) while its steps run. An
|
|
59
|
+
* organization's id is its slug and its delete frees the slug for anyone,
|
|
60
|
+
* so whatever an edition keeps for the organization must go before the row
|
|
61
|
+
* does, or be refused: a row left behind would belong to whoever creates
|
|
62
|
+
* the slug next. Its steps may refuse (Enterprise refuses while an
|
|
63
|
+
* identity provider still signs in platform-managed organizations) or
|
|
64
|
+
* remove the edition's own rows; either way a throw fails the delete with
|
|
65
|
+
* the organization intact, and the retry re-runs every step, so each owns
|
|
66
|
+
* its idempotency. After the slot the chain revokes the organization's own
|
|
67
|
+
* policy rows, also before the row and also failing closed.
|
|
68
|
+
*
|
|
56
69
|
* Two enforcement layers, deliberately redundant, both derived from the
|
|
57
70
|
* ONE literal tuple below (lockstep by construction):
|
|
58
71
|
* - GateSlotName (compile time): the union of declared slot literals.
|
|
@@ -80,7 +93,7 @@ import type { PipelineStep } from "../pipeline/pipeline.js";
|
|
|
80
93
|
* owner-visible slot additions — each entry cites its chain position in
|
|
81
94
|
* the guidelines' slot table, which must match the splice sites exactly.
|
|
82
95
|
*/
|
|
83
|
-
export declare const GATE_SLOT_NAMES: readonly ["agent-execution-create:pre-side-effect-gate", "agent-execution-recover:pre-side-effect-gate", "agent-execution-submit-approval:gate", "session-create:pre-side-effect-gate", "org-create:post-persist", "sandbox-acquisition:gate", "identity-account-provision:post-persist", "iam-policy-create:pre-side-effect-gate", "org-create:pre-side-effect-gate"];
|
|
96
|
+
export declare const GATE_SLOT_NAMES: readonly ["agent-execution-create:pre-side-effect-gate", "agent-execution-recover:pre-side-effect-gate", "agent-execution-submit-approval:gate", "session-create:pre-side-effect-gate", "org-create:post-persist", "sandbox-acquisition:gate", "identity-account-provision:post-persist", "iam-policy-create:pre-side-effect-gate", "org-create:pre-side-effect-gate", "org-delete:pre-delete"];
|
|
84
97
|
/** The declared slot-name union — a registration outside it fails tsc. */
|
|
85
98
|
export type GateSlotName = (typeof GATE_SLOT_NAMES)[number];
|
|
86
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-slots.d.ts","sourceRoot":"","sources":["../../src/extensions/gate-slots.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gate-slots.d.ts","sourceRoot":"","sources":["../../src/extensions/gate-slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,eAAe,iYAWlB,CAAC;AAEX,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAEnD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,CACzC,MAAM,EACN,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CACzC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,WAAW,EACnD,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,YAAY,GACjB,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAOnC"}
|
|
@@ -13,6 +13,7 @@ export const GATE_SLOT_NAMES = [
|
|
|
13
13
|
"identity-account-provision:post-persist",
|
|
14
14
|
"iam-policy-create:pre-side-effect-gate",
|
|
15
15
|
"org-create:pre-side-effect-gate",
|
|
16
|
+
"org-delete:pre-delete",
|
|
16
17
|
];
|
|
17
18
|
/**
|
|
18
19
|
* The boot-time declared-slot set — resolveExtensions validates every
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-slots.js","sourceRoot":"","sources":["../../src/extensions/gate-slots.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gate-slots.js","sourceRoot":"","sources":["../../src/extensions/gate-slots.ts"],"names":[],"mappings":"AA4FA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,6CAA6C;IAC7C,8CAA8C;IAC9C,sCAAsC;IACtC,qCAAqC;IACrC,yBAAyB;IACzB,0BAA0B;IAC1B,yCAAyC;IACzC,wCAAwC;IACxC,iCAAiC;IACjC,uBAAuB;CACf,CAAC;AAKX;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAC7D,eAAe,CAChB,CAAC;AAWF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,SAA4B,EAC5B,IAAkB;IAElB,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACxC,kDAAkD;IAClD,oEAAoE;IACpE,sEAAsE;IACtE,cAAc;IACd,OAAO,KAA0C,CAAC;AACpD,CAAC"}
|
|
@@ -88,8 +88,12 @@ export declare function newCreateAuthorizationTuplesStep<Desc extends DescMessag
|
|
|
88
88
|
/**
|
|
89
89
|
* CleanupIamPolicies — after the store delete in every delete chain.
|
|
90
90
|
* Best-effort by contract: a driver failure is logged and the delete
|
|
91
|
-
* succeeds (Java's DeleteOperationCleanupIamPoliciesStep swallows all
|
|
92
|
-
*
|
|
91
|
+
* succeeds (Java's DeleteOperationCleanupIamPoliciesStep swallows all),
|
|
92
|
+
* because a deleted resource's rows grant nothing once it is gone. The
|
|
93
|
+
* organization is the one kind whose id another caller can take next, so
|
|
94
|
+
* its chain revokes the organization's rows before the row, failing
|
|
95
|
+
* closed (RevokeOrganizationPolicies, domain/organization/steps.ts), and
|
|
96
|
+
* this step is only its backstop there.
|
|
93
97
|
*/
|
|
94
98
|
export declare function newCleanupIamPoliciesStep<Desc extends DescMessage>(lifecycle: ResourceAuthorizationLifecycle | undefined, logger: Logger): PipelineStep<Desc>;
|
|
95
99
|
/** Context key for the pre-update visibility level. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-tuples.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/authorization-tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAU3H,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,0BAA0B,EAE1B,8BAA8B,EAC9B,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,4CAA4C,CAAC;AAEpD;;;;;;;;GAQG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,8BAA8B,GAAG,SAAS,EACrD,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,IAAI,CAAC,CAKf;AAGD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAYnD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,qBAAqB,GAC3B,WAAW,CAAC,oBAAoB,CAAC,CAwBnC;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,qBAAqB,EAC/B,QAAQ,EAAE,qBAAqB,GAC9B;IACD,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC7D,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9D,CAUA;AAgGD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,GACb,oBAAoB,GAAG,SAAS,CAkClC;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,SAAS,WAAW,EACvE,SAAS,EAAE,8BAA8B,GAAG,SAAS,EACrD,MAAM,EAAE,MAAM,GACb,YAAY,CAAC,IAAI,CAAC,CAuBpB;AAED
|
|
1
|
+
{"version":3,"file":"authorization-tuples.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/authorization-tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,E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,SAAS,EACrD,MAAM,EAAE,MAAM,GACb,YAAY,CAAC,IAAI,CAAC,CAuBpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,SAAS,WAAW,EAChE,SAAS,EAAE,8BAA8B,GAAG,SAAS,EACrD,MAAM,EAAE,MAAM,GACb,YAAY,CAAC,IAAI,CAAC,CAiCpB;AAED,uDAAuD;AACvD,eAAO,MAAM,kBAAkB,+BAA+B,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,IAAI,SAAS,WAAW,EAC1E,WAAW,EAAE,MAAM,GAClB,YAAY,CAAC,IAAI,CAAC,CAYpB;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,SAAS,WAAW,EACpE,SAAS,EAAE,8BAA8B,GAAG,SAAS,EACrD,WAAW,EAAE,MAAM,GAClB,YAAY,CAAC,IAAI,CAAC,CAoCpB"}
|
|
@@ -201,8 +201,12 @@ export function newCreateAuthorizationTuplesStep(lifecycle, logger) {
|
|
|
201
201
|
/**
|
|
202
202
|
* CleanupIamPolicies — after the store delete in every delete chain.
|
|
203
203
|
* Best-effort by contract: a driver failure is logged and the delete
|
|
204
|
-
* succeeds (Java's DeleteOperationCleanupIamPoliciesStep swallows all
|
|
205
|
-
*
|
|
204
|
+
* succeeds (Java's DeleteOperationCleanupIamPoliciesStep swallows all),
|
|
205
|
+
* because a deleted resource's rows grant nothing once it is gone. The
|
|
206
|
+
* organization is the one kind whose id another caller can take next, so
|
|
207
|
+
* its chain revokes the organization's rows before the row, failing
|
|
208
|
+
* closed (RevokeOrganizationPolicies, domain/organization/steps.ts), and
|
|
209
|
+
* this step is only its backstop there.
|
|
206
210
|
*/
|
|
207
211
|
export function newCleanupIamPoliciesStep(lifecycle, logger) {
|
|
208
212
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-tuples.js","sourceRoot":"","sources":["../../../src/pipeline/steps/authorization-tuples.ts"],"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SAAS;QAClC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;QACjD,WAAW,EAAE,kBAAkB,CAC7B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,QAAQ,CAAC,GAAG,EACZ,MAAM,CACP;QACD,mEAAmE;QACnE,oCAAoC;QACpC,gBAAgB,EAAE,CAAC,GAAG,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;KACtE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,SAAqD,EACrD,MAAc;IAEd,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,KAAK,CAAC,OAAO,CAAC,GAAyB;YACrC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5B,OAAO;YACT,CAAC;YACD,MAAM,KAAK,GAAG,2BAA2B,CACvC,GAAG,CAAC,eAAe,EACnB,GAAG,CAAC,QAAQ,EACZ,GAAG,CAAC,cAAc,EAClB,MAAM,CACP,CAAC;YACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,aAAa,CAAC,KAAK,EAAE,uCAAuC,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"authorization-tuples.js","sourceRoot":"","sources":["../../../src/pipeline/steps/authorization-tuples.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAE/F,OAAO,EACL,sBAAsB,GAEvB,MAAM,wFAAwF,CAAC;AAgBhG;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,SAAqD,EACrD,KAAiC;IAEjC,IAAI,SAAS,EAAE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AAK,SAAS,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;gBACjD,OAAO;YACT,CAAC;YACD,MAAM,QAAQ,GACX,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAuC;gBAClE,qBAAqB,CAAC,mCAAmC,CAAC;YAC5D,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAC7D,GAAG,CAAC,eAAe,EACnB,QAAQ,EACR,QAAQ,CAAC,UAAU,CACpB,CAAC;YACF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/D,OAAO;YACT,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,mBAAmB,CAAC;oBAClC,IAAI,EAAE,GAAG,CAAC,eAAe;oBACzB,UAAU,EAAE,QAAQ,CAAC,EAAE;oBACvB,KAAK,EAAE,QAAQ,CAAC,GAAG;oBACnB,cAAc;oBACd,cAAc;iBACf,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,aAAa,CAAC,KAAK,EAAE,oCAAoC,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.38.1",
|
|
4
4
|
"description": "The Stigmer OSS control plane as a composable library: composeServer, the extension registry and the driver seams a composition builds on. The self-contained deployable of the same server is @stigmer/server-slim.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"@connectrpc/connect-node": "^2.0.0",
|
|
64
64
|
"@kubernetes/client-node": "2.0.0",
|
|
65
65
|
"@opentelemetry/api": "^1.9.0",
|
|
66
|
-
"@stigmer/outbound": "3.
|
|
67
|
-
"@stigmer/plugin-package": "3.
|
|
68
|
-
"@stigmer/protos": "3.
|
|
69
|
-
"@stigmer/temporal-codecs": "3.
|
|
70
|
-
"@stigmer/zip-structure": "3.
|
|
66
|
+
"@stigmer/outbound": "3.38.1",
|
|
67
|
+
"@stigmer/plugin-package": "3.38.1",
|
|
68
|
+
"@stigmer/protos": "3.38.1",
|
|
69
|
+
"@stigmer/temporal-codecs": "3.38.1",
|
|
70
|
+
"@stigmer/zip-structure": "3.38.1",
|
|
71
71
|
"@temporalio/activity": "1.16.2",
|
|
72
72
|
"@temporalio/client": "1.16.2",
|
|
73
73
|
"@temporalio/common": "1.16.2",
|
|
@@ -94,6 +94,37 @@ describe("loadConfig", () => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
// stigmer#1357: the address runners are told to dial is its own fact.
|
|
98
|
+
// Defaulting it to the server's own address keeps every co-located
|
|
99
|
+
// install byte-identical; a clustered server overrides it for runners
|
|
100
|
+
// that cannot resolve the cluster-internal name it dials itself.
|
|
101
|
+
describe("runnerBootstrapTemporalAddress (STIGMER_RUNNER_BOOTSTRAP_TEMPORAL_ADDRESS)", () => {
|
|
102
|
+
it("defaults to the address the server dials", () => {
|
|
103
|
+
expect(loadConfig({}).runnerBootstrapTemporalAddress).toBe("localhost:7233");
|
|
104
|
+
expect(
|
|
105
|
+
loadConfig({ TEMPORAL_HOST_PORT: "temporal.internal:7233" }).runnerBootstrapTemporalAddress,
|
|
106
|
+
).toBe("temporal.internal:7233");
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("reads an explicit value, leaving the server's own address alone", () => {
|
|
110
|
+
const config = loadConfig({
|
|
111
|
+
TEMPORAL_HOST_PORT: "temporal.internal:7233",
|
|
112
|
+
STIGMER_RUNNER_BOOTSTRAP_TEMPORAL_ADDRESS: "temporal.example.com:7233",
|
|
113
|
+
});
|
|
114
|
+
expect(config.runnerBootstrapTemporalAddress).toBe("temporal.example.com:7233");
|
|
115
|
+
expect(config.temporalHostPort).toBe("temporal.internal:7233");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("treats an empty string as absent (Go's getEnvString)", () => {
|
|
119
|
+
expect(
|
|
120
|
+
loadConfig({
|
|
121
|
+
TEMPORAL_HOST_PORT: "temporal.internal:7233",
|
|
122
|
+
STIGMER_RUNNER_BOOTSTRAP_TEMPORAL_ADDRESS: "",
|
|
123
|
+
}).runnerBootstrapTemporalAddress,
|
|
124
|
+
).toBe("temporal.internal:7233");
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
97
128
|
describe("STIGMER_OIDC_CONSOLE_CLIENT_ID (the console's sign-in client)", () => {
|
|
98
129
|
const OIDC = {
|
|
99
130
|
STIGMER_OIDC_ISSUER: "https://auth.example.com/realms/main",
|
package/src/boot/compose.ts
CHANGED
|
@@ -1268,6 +1268,9 @@ export async function composeServer(
|
|
|
1268
1268
|
logger,
|
|
1269
1269
|
authorizer,
|
|
1270
1270
|
gateSteps: extensions.gateSteps,
|
|
1271
|
+
// The delete revokes the organization's rows through the one grant
|
|
1272
|
+
// path, before its row goes (domain/organization/steps.ts).
|
|
1273
|
+
grantPath: iamPolicyGrantPath,
|
|
1271
1274
|
// The role lifecycle and the directory (the identity stage): the
|
|
1272
1275
|
// composed drivers, or open source's under the built-in posture.
|
|
1273
1276
|
authorizationLifecycle: roleLifecycle,
|
|
@@ -1629,7 +1632,7 @@ export async function composeServer(
|
|
|
1629
1632
|
});
|
|
1630
1633
|
// Platform registers LAST of all controllers (Go server.go 530–535).
|
|
1631
1634
|
registerPlatformServices(router, {
|
|
1632
|
-
|
|
1635
|
+
runnerBootstrapTemporalAddress: config.runnerBootstrapTemporalAddress,
|
|
1633
1636
|
temporalNamespace: config.temporalNamespace,
|
|
1634
1637
|
runnerAuthService: runnerCredentials,
|
|
1635
1638
|
edition: extensions.edition,
|
package/src/boot/config.ts
CHANGED
|
@@ -56,13 +56,11 @@ export interface ServerConfig {
|
|
|
56
56
|
readonly operatorName: string;
|
|
57
57
|
/**
|
|
58
58
|
* Temporal coordinates this server runs against (Go TemporalHostPort/
|
|
59
|
-
* TemporalNamespace).
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* and the TemporalManager's health monitor keeps retrying — Go
|
|
65
|
-
* server.go InitialConnect posture).
|
|
59
|
+
* TemporalNamespace). The Temporal workers (#18) read the same fields;
|
|
60
|
+
* connection failure is NON-fatal (the server serves with the engine
|
|
61
|
+
* unavailable and the TemporalManager's health monitor keeps retrying —
|
|
62
|
+
* Go server.go InitialConnect posture). The address runners are told to
|
|
63
|
+
* dial is a separate fact: runnerBootstrapTemporalAddress below.
|
|
66
64
|
*/
|
|
67
65
|
readonly temporalHostPort: string;
|
|
68
66
|
readonly temporalNamespace: string;
|
|
@@ -75,6 +73,19 @@ export interface ServerConfig {
|
|
|
75
73
|
* setting fails the boot, like OIDC's half configuration.
|
|
76
74
|
*/
|
|
77
75
|
readonly temporalConnection: TemporalConnectionConfig;
|
|
76
|
+
/**
|
|
77
|
+
* The Temporal address getRunnerBootstrapConfig publishes to runners
|
|
78
|
+
* that discover their coordinates from this server instead of being
|
|
79
|
+
* given them (STIGMER_RUNNER_BOOTSTRAP_TEMPORAL_ADDRESS; stigmer#1357).
|
|
80
|
+
* Defaults to TEMPORAL_HOST_PORT — right whenever those runners share
|
|
81
|
+
* this server's network (a laptop, the compose stack, the chart). Set
|
|
82
|
+
* it when they do not: a server in a cluster that dials Temporal by its
|
|
83
|
+
* internal service name, and a desktop runner that must dial the
|
|
84
|
+
* frontend's external ingress. The namespace is not split; one
|
|
85
|
+
* namespace is served on every ingress. Sandboxes are told their
|
|
86
|
+
* address by the provisioner (sandboxTemporalAddress), never by this.
|
|
87
|
+
*/
|
|
88
|
+
readonly runnerBootstrapTemporalAddress: string;
|
|
78
89
|
/**
|
|
79
90
|
* Artifact blob storage (attachments + execution outputs; Go
|
|
80
91
|
* config.ArtifactStorage). "local" is the OSS default; "r2" boot-fails
|
|
@@ -315,6 +326,11 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): ServerConfig {
|
|
|
315
326
|
temporalHostPort: envString(env, "TEMPORAL_HOST_PORT", "localhost:7233"),
|
|
316
327
|
temporalNamespace: envString(env, "TEMPORAL_NAMESPACE", "default"),
|
|
317
328
|
temporalConnection: loadTemporalConnectionConfig((name) => env[name]),
|
|
329
|
+
runnerBootstrapTemporalAddress: envString(
|
|
330
|
+
env,
|
|
331
|
+
"STIGMER_RUNNER_BOOTSTRAP_TEMPORAL_ADDRESS",
|
|
332
|
+
envString(env, "TEMPORAL_HOST_PORT", "localhost:7233"),
|
|
333
|
+
),
|
|
318
334
|
artifactStorageType,
|
|
319
335
|
artifactLocalBasePath: envString(
|
|
320
336
|
env,
|
|
@@ -36,7 +36,12 @@ import { AgentExecutionQueryController } from "@stigmer/protos/ai/stigmer/agenti
|
|
|
36
36
|
import type { ArtifactStorage } from "../../../artifactstorage/artifact-storage.js";
|
|
37
37
|
import { createLogger } from "../../../boot/logger.js";
|
|
38
38
|
import { callerIdentityKey } from "../../../pipeline/interceptors/auth.js";
|
|
39
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
errorOf,
|
|
41
|
+
failingStore,
|
|
42
|
+
testCallerIdentity,
|
|
43
|
+
untouchable,
|
|
44
|
+
} from "../../../pipeline/__tests__/support.js";
|
|
40
45
|
import { newPermissiveSingleTeamAuthorizer } from "../../../pipeline/steps/authorize.js";
|
|
41
46
|
import { ResourceNotFoundError } from "../../../store/interface.js";
|
|
42
47
|
import type { Store } from "../../../store/interface.js";
|
|
@@ -64,35 +69,10 @@ const EXECUTION_ID = "aex_storefault";
|
|
|
64
69
|
|
|
65
70
|
const LOAD_FAULT_COPY = "failed to load agent execution";
|
|
66
71
|
|
|
67
|
-
/** A dependency the call must never reach once its load has failed. */
|
|
68
|
-
function untouchable<T extends object>(name: string): T {
|
|
69
|
-
return new Proxy({} as T, {
|
|
70
|
-
get(_target, prop) {
|
|
71
|
-
throw new Error(`${name}.${String(prop)} reached after a failed load`);
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** A store whose every read fails with the given error. */
|
|
77
|
-
function failingStore(error: Error): Store {
|
|
78
|
-
return {
|
|
79
|
-
getResource: () => Promise.reject(error),
|
|
80
|
-
} as unknown as Store;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
72
|
const MISSING = (): Error =>
|
|
84
73
|
new ResourceNotFoundError(`agent_execution/${EXECUTION_ID}`);
|
|
85
74
|
const LOCKED = (): Error => new Error("SQLITE_BUSY: database is locked");
|
|
86
75
|
|
|
87
|
-
async function errorOf(call: () => Promise<unknown>): Promise<ConnectError> {
|
|
88
|
-
const error = await call().then(
|
|
89
|
-
() => undefined,
|
|
90
|
-
(e: unknown) => e,
|
|
91
|
-
);
|
|
92
|
-
expect(error, "the call must fail").toBeInstanceOf(ConnectError);
|
|
93
|
-
return error as ConnectError;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
76
|
function lifecycleDeps(store: Store): LifecycleDeps {
|
|
97
77
|
return {
|
|
98
78
|
store,
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
* fail-open incident class). The absent arm fires the hook with the
|
|
15
15
|
* spec and no policy, so a composition can still delete a bare tuple
|
|
16
16
|
* written before the row mirror existed.
|
|
17
|
-
* - cleanupResource is bidirectional (as
|
|
18
|
-
* deduplicated, revoking each row
|
|
17
|
+
* - cleanupResource is bidirectional (as principal first, then as
|
|
18
|
+
* target with the owner rows last), deduplicated, revoking each row
|
|
19
|
+
* through the same revoke order; a fault stops it with the owners
|
|
20
|
+
* still holding, since an organization's delete runs it before the
|
|
21
|
+
* organization's row goes and its owner is the one who retries.
|
|
19
22
|
* - revokeOrgAccess revokes the account's direct rows on the
|
|
20
23
|
* organization; the inert org-column arm the cloud carried is gone
|
|
21
24
|
* (Q-OR-9).
|
|
@@ -378,17 +381,19 @@ describe("revoke: onPolicyRevoked before the row delete", () => {
|
|
|
378
381
|
});
|
|
379
382
|
|
|
380
383
|
describe("cleanupResource: bidirectional, deduplicated, each row through the revoke order", () => {
|
|
381
|
-
it("revokes rows where the ref is the
|
|
384
|
+
it("revokes rows where the ref is the principal, then where it is the resource, owners last", async () => {
|
|
382
385
|
const recorded: RecordedEvent[] = [];
|
|
383
386
|
const { policies, path } = pathOver(recorded, recordingLifecycle(recorded));
|
|
384
|
-
const
|
|
387
|
+
const owner = orgRole(ALICE, "owner", "acme");
|
|
388
|
+
const member = orgRole(BOB, "member", "acme");
|
|
385
389
|
const asPrincipal = triple(
|
|
386
390
|
{ kind: "organization", id: "acme" },
|
|
387
391
|
"organization",
|
|
388
392
|
{ kind: "agent", id: AGENT },
|
|
389
393
|
);
|
|
390
394
|
const unrelated = orgRole(ALICE, "member", "globex");
|
|
391
|
-
|
|
395
|
+
// Granted owner first, so the order below is the cleanup's, not the store's.
|
|
396
|
+
for (const spec of [owner, member, asPrincipal, unrelated]) {
|
|
392
397
|
await path.grant(spec, alice);
|
|
393
398
|
}
|
|
394
399
|
recorded.length = 0;
|
|
@@ -399,17 +404,45 @@ describe("cleanupResource: bidirectional, deduplicated, each row through the rev
|
|
|
399
404
|
|
|
400
405
|
expect([...policies.rows.keys()]).toEqual([policyIdFor(unrelated)]);
|
|
401
406
|
expect(recorded).toEqual([
|
|
402
|
-
{ kind: "revoked", id: policyIdFor(asResource), relation: "owner" },
|
|
403
|
-
{ kind: "row-delete", id: policyIdFor(asResource) },
|
|
404
407
|
{
|
|
405
408
|
kind: "revoked",
|
|
406
409
|
id: policyIdFor(asPrincipal),
|
|
407
410
|
relation: "organization",
|
|
408
411
|
},
|
|
409
412
|
{ kind: "row-delete", id: policyIdFor(asPrincipal) },
|
|
413
|
+
{ kind: "revoked", id: policyIdFor(member), relation: "member" },
|
|
414
|
+
{ kind: "row-delete", id: policyIdFor(member) },
|
|
415
|
+
{ kind: "revoked", id: policyIdFor(owner), relation: "owner" },
|
|
416
|
+
{ kind: "row-delete", id: policyIdFor(owner) },
|
|
410
417
|
]);
|
|
411
418
|
});
|
|
412
419
|
|
|
420
|
+
it("stops at the first fault with the owner rows still in place", async () => {
|
|
421
|
+
const recorded: RecordedEvent[] = [];
|
|
422
|
+
const lifecycle = recordingLifecycle(recorded);
|
|
423
|
+
const { policies, path } = pathOver(recorded, {
|
|
424
|
+
...lifecycle,
|
|
425
|
+
onPolicyRevoked: (event) =>
|
|
426
|
+
event.spec.relation === "member"
|
|
427
|
+
? Promise.reject(new Error("tuple delete refused"))
|
|
428
|
+
: lifecycle.onPolicyRevoked!(event),
|
|
429
|
+
});
|
|
430
|
+
const owner = orgRole(ALICE, "owner", "acme");
|
|
431
|
+
const member = orgRole(BOB, "member", "acme");
|
|
432
|
+
for (const spec of [owner, member]) {
|
|
433
|
+
await path.grant(spec, alice);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
await expect(
|
|
437
|
+
path.cleanupResource(
|
|
438
|
+
create(ApiResourceRefSchema, { kind: "organization", id: "acme" }),
|
|
439
|
+
),
|
|
440
|
+
).rejects.toThrow("tuple delete refused");
|
|
441
|
+
|
|
442
|
+
expect(policies.rows.has(policyIdFor(owner))).toBe(true);
|
|
443
|
+
expect(policies.rows.has(policyIdFor(member))).toBe(true);
|
|
444
|
+
});
|
|
445
|
+
|
|
413
446
|
it("a ref that is both principal and resource of one row revokes it once", async () => {
|
|
414
447
|
const recorded: RecordedEvent[] = [];
|
|
415
448
|
const { path } = pathOver(recorded, recordingLifecycle(recorded));
|
|
@@ -59,6 +59,7 @@ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/
|
|
|
59
59
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
60
60
|
import type { IamPolicy } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/api_pb";
|
|
61
61
|
import { IamPolicySchema } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/api_pb";
|
|
62
|
+
import { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
62
63
|
import type {
|
|
63
64
|
ApiResourceRef,
|
|
64
65
|
IamPolicySpec,
|
|
@@ -78,6 +79,9 @@ import { DuplicatePolicyError } from "./store.js";
|
|
|
78
79
|
import type { IamPolicyStore } from "./store.js";
|
|
79
80
|
import { refsOf, requireWellFormedTriple } from "./wire-refusals.js";
|
|
80
81
|
|
|
82
|
+
/** The relation `cleanupResource` revokes last on the ref's own rows. */
|
|
83
|
+
const OWNER_RELATION = IamRole[IamRole.owner];
|
|
84
|
+
|
|
81
85
|
export interface GrantResult {
|
|
82
86
|
readonly policy: IamPolicy;
|
|
83
87
|
/** True when the triple was already held: no row was written, the hook still fired. */
|
|
@@ -99,9 +103,13 @@ export interface IamPolicyGrantPath {
|
|
|
99
103
|
*/
|
|
100
104
|
revokeBySpec(spec: IamPolicySpec): Promise<IamPolicy | undefined>;
|
|
101
105
|
/**
|
|
102
|
-
* Revoke every row naming the ref as its
|
|
103
|
-
* it as its
|
|
104
|
-
* is revoked once. Nothing to clean is a no-op.
|
|
106
|
+
* Revoke every row naming the ref as its principal, then every row naming
|
|
107
|
+
* it as its resource with the `owner` rows last, each through the revoke
|
|
108
|
+
* order; a row that is both is revoked once. Nothing to clean is a no-op.
|
|
109
|
+
* The order matters where the ref still exists: an organization's delete
|
|
110
|
+
* runs this before its row goes and fails on the first fault, so a
|
|
111
|
+
* cleanup that stops partway has not yet removed the owners who may
|
|
112
|
+
* retry it.
|
|
105
113
|
*/
|
|
106
114
|
cleanupResource(ref: ApiResourceRef): Promise<void>;
|
|
107
115
|
/** Revoke every relation the account holds directly on the organization. */
|
|
@@ -209,9 +217,15 @@ export function newIamPolicyGrantPath(
|
|
|
209
217
|
},
|
|
210
218
|
|
|
211
219
|
async cleanupResource(ref): Promise<void> {
|
|
212
|
-
const asResource = await policies.findByResource(ref.kind, ref.id);
|
|
213
220
|
const asPrincipal = await policies.findByPrincipal(ref.kind, ref.id);
|
|
214
|
-
|
|
221
|
+
const asResource = await policies.findByResource(ref.kind, ref.id);
|
|
222
|
+
const isOwner = (policy: IamPolicy): boolean =>
|
|
223
|
+
policy.spec?.relation === OWNER_RELATION;
|
|
224
|
+
for (const policy of distinctById([
|
|
225
|
+
...asPrincipal,
|
|
226
|
+
...asResource.filter((policy) => !isOwner(policy)),
|
|
227
|
+
...asResource.filter(isOwner),
|
|
228
|
+
])) {
|
|
215
229
|
await revokeRow(policy);
|
|
216
230
|
}
|
|
217
231
|
},
|