@stigmer/server 3.21.0 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authorization/evaluator.d.ts +7 -1
- package/dist/authorization/evaluator.d.ts.map +1 -1
- package/dist/authorization/evaluator.js.map +1 -1
- package/dist/authorization/list-read-scope.d.ts.map +1 -1
- package/dist/authorization/list-read-scope.js +19 -11
- package/dist/authorization/list-read-scope.js.map +1 -1
- package/dist/authorization/model/organization.d.ts.map +1 -1
- package/dist/authorization/model/organization.js +2 -0
- package/dist/authorization/model/organization.js.map +1 -1
- package/dist/domain/agent/controller.d.ts.map +1 -1
- package/dist/domain/agent/controller.js +2 -0
- package/dist/domain/agent/controller.js.map +1 -1
- package/dist/domain/agentchannel/controller.d.ts.map +1 -1
- package/dist/domain/agentchannel/controller.js +6 -1
- package/dist/domain/agentchannel/controller.js.map +1 -1
- package/dist/domain/agentchannel/steps.d.ts +19 -0
- package/dist/domain/agentchannel/steps.d.ts.map +1 -1
- package/dist/domain/agentchannel/steps.js +32 -0
- package/dist/domain/agentchannel/steps.js.map +1 -1
- package/dist/domain/agentinstance/controller.d.ts +5 -5
- package/dist/domain/agentinstance/controller.d.ts.map +1 -1
- package/dist/domain/agentinstance/controller.js +6 -1
- package/dist/domain/agentinstance/controller.js.map +1 -1
- package/dist/domain/agentinstance/steps.d.ts +43 -8
- package/dist/domain/agentinstance/steps.d.ts.map +1 -1
- package/dist/domain/agentinstance/steps.js +71 -8
- package/dist/domain/agentinstance/steps.js.map +1 -1
- package/dist/domain/agentshare/controller.d.ts.map +1 -1
- package/dist/domain/agentshare/controller.js +7 -1
- package/dist/domain/agentshare/controller.js.map +1 -1
- package/dist/domain/agentshare/steps.d.ts +58 -0
- package/dist/domain/agentshare/steps.d.ts.map +1 -1
- package/dist/domain/agentshare/steps.js +109 -4
- package/dist/domain/agentshare/steps.js.map +1 -1
- package/dist/domain/artifact/controller.js +21 -25
- package/dist/domain/artifact/controller.js.map +1 -1
- package/dist/domain/channelapp/controller.d.ts.map +1 -1
- package/dist/domain/channelapp/controller.js +2 -0
- package/dist/domain/channelapp/controller.js.map +1 -1
- package/dist/domain/environment/controller.d.ts.map +1 -1
- package/dist/domain/environment/controller.js +2 -0
- package/dist/domain/environment/controller.js.map +1 -1
- package/dist/domain/executioncontext/controller.d.ts.map +1 -1
- package/dist/domain/executioncontext/controller.js +2 -0
- package/dist/domain/executioncontext/controller.js.map +1 -1
- package/dist/domain/executioncontext/steps.d.ts.map +1 -1
- package/dist/domain/executioncontext/steps.js +2 -1
- package/dist/domain/executioncontext/steps.js.map +1 -1
- package/dist/domain/mcpserver/connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/connect.js +8 -7
- 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 +2 -0
- package/dist/domain/mcpserver/controller.js.map +1 -1
- package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/start-connect.js +8 -7
- package/dist/domain/mcpserver/start-connect.js.map +1 -1
- package/dist/domain/memory/controller.d.ts.map +1 -1
- package/dist/domain/memory/controller.js +6 -1
- package/dist/domain/memory/controller.js.map +1 -1
- package/dist/domain/memory/steps.d.ts +23 -0
- package/dist/domain/memory/steps.d.ts.map +1 -1
- package/dist/domain/memory/steps.js +35 -0
- package/dist/domain/memory/steps.js.map +1 -1
- package/dist/domain/oauthapp/controller.d.ts.map +1 -1
- package/dist/domain/oauthapp/controller.js +2 -0
- package/dist/domain/oauthapp/controller.js.map +1 -1
- package/dist/domain/plugin/controller.d.ts.map +1 -1
- package/dist/domain/plugin/controller.js +5 -24
- package/dist/domain/plugin/controller.js.map +1 -1
- package/dist/domain/schedule/controller.d.ts.map +1 -1
- package/dist/domain/schedule/controller.js +7 -1
- package/dist/domain/schedule/controller.js.map +1 -1
- package/dist/domain/schedule/steps.d.ts +19 -0
- package/dist/domain/schedule/steps.d.ts.map +1 -1
- package/dist/domain/schedule/steps.js +32 -0
- package/dist/domain/schedule/steps.js.map +1 -1
- package/dist/domain/session/steps.d.ts +8 -9
- package/dist/domain/session/steps.d.ts.map +1 -1
- package/dist/domain/session/steps.js +17 -21
- package/dist/domain/session/steps.js.map +1 -1
- package/dist/domain/skill/controller.d.ts.map +1 -1
- package/dist/domain/skill/controller.js +8 -17
- package/dist/domain/skill/controller.js.map +1 -1
- package/dist/domain/workflow/controller.d.ts.map +1 -1
- package/dist/domain/workflow/controller.js +30 -107
- package/dist/domain/workflow/controller.js.map +1 -1
- package/dist/domain/workflow/version-resolution.d.ts +5 -0
- package/dist/domain/workflow/version-resolution.d.ts.map +1 -0
- package/dist/domain/workflow/version-resolution.js +113 -0
- package/dist/domain/workflow/version-resolution.js.map +1 -0
- package/dist/domain/workflowinstance/controller.d.ts.map +1 -1
- package/dist/domain/workflowinstance/controller.js +6 -1
- package/dist/domain/workflowinstance/controller.js.map +1 -1
- package/dist/domain/workflowinstance/steps.d.ts +20 -0
- package/dist/domain/workflowinstance/steps.d.ts.map +1 -1
- package/dist/domain/workflowinstance/steps.js +39 -0
- package/dist/domain/workflowinstance/steps.js.map +1 -1
- package/dist/extensions/identity.d.ts +19 -0
- package/dist/extensions/identity.d.ts.map +1 -1
- package/dist/extensions/identity.js +22 -3
- package/dist/extensions/identity.js.map +1 -1
- package/dist/extensions/list-read-scope.d.ts +41 -7
- package/dist/extensions/list-read-scope.d.ts.map +1 -1
- package/dist/extensions/list-read-scope.js +13 -2
- package/dist/extensions/list-read-scope.js.map +1 -1
- package/dist/pipeline/steps/authorize-resolved-target.d.ts +88 -0
- package/dist/pipeline/steps/authorize-resolved-target.d.ts.map +1 -0
- package/dist/pipeline/steps/authorize-resolved-target.js +36 -0
- package/dist/pipeline/steps/authorize-resolved-target.js.map +1 -0
- package/dist/pipeline/steps/authorize.d.ts +27 -0
- package/dist/pipeline/steps/authorize.d.ts.map +1 -1
- package/dist/pipeline/steps/authorize.js +49 -10
- package/dist/pipeline/steps/authorize.js.map +1 -1
- package/dist/pipeline/steps/guard-memory-capture.d.ts.map +1 -1
- package/dist/pipeline/steps/guard-memory-capture.js +2 -1
- package/dist/pipeline/steps/guard-memory-capture.js.map +1 -1
- package/dist/pipeline/steps/guard-reserved-labels.d.ts.map +1 -1
- package/dist/pipeline/steps/guard-reserved-labels.js +6 -7
- package/dist/pipeline/steps/guard-reserved-labels.js.map +1 -1
- package/dist/pipeline/steps/helpers.d.ts +9 -5
- package/dist/pipeline/steps/helpers.d.ts.map +1 -1
- package/dist/pipeline/steps/helpers.js +11 -15
- package/dist/pipeline/steps/helpers.js.map +1 -1
- package/dist/pipeline/steps/version-history.d.ts +11 -0
- package/dist/pipeline/steps/version-history.d.ts.map +1 -1
- package/dist/pipeline/steps/version-history.js +26 -0
- package/dist/pipeline/steps/version-history.js.map +1 -1
- package/package.json +6 -6
- package/src/authorization/__tests__/list-read-scope.test.ts +23 -12
- package/src/authorization/__tests__/skip-lane-inventory.test.ts +160 -0
- package/src/authorization/__tests__/wire-permissions.test.ts +5 -5
- package/src/authorization/evaluator.ts +7 -0
- package/src/authorization/list-read-scope.ts +22 -11
- package/src/authorization/model/__tests__/registry.test.ts +2 -0
- package/src/authorization/model/organization.ts +2 -0
- package/src/domain/agent/controller.ts +10 -0
- package/src/domain/agentchannel/__tests__/create-authorization.test.ts +58 -0
- package/src/domain/agentchannel/controller.ts +19 -0
- package/src/domain/agentchannel/steps.ts +40 -0
- package/src/domain/agentinstance/__tests__/create-authorization.composed.test.ts +243 -0
- package/src/domain/agentinstance/__tests__/create-authorization.test.ts +144 -0
- package/src/domain/agentinstance/controller.ts +24 -5
- package/src/domain/agentinstance/steps.ts +82 -8
- package/src/domain/agentshare/__tests__/create-authorization.test.ts +86 -0
- package/src/domain/agentshare/__tests__/member-audience.test.ts +113 -0
- package/src/domain/agentshare/controller.ts +21 -0
- package/src/domain/agentshare/steps.ts +181 -15
- package/src/domain/artifact/controller.ts +18 -22
- package/src/domain/channelapp/controller.ts +10 -0
- package/src/domain/environment/controller.ts +10 -0
- package/src/domain/executioncontext/__tests__/executioncontext.test.ts +1 -0
- package/src/domain/executioncontext/controller.ts +10 -0
- package/src/domain/executioncontext/steps.ts +2 -1
- package/src/domain/mcpserver/connect.ts +11 -10
- package/src/domain/mcpserver/controller.ts +13 -1
- package/src/domain/mcpserver/start-connect.ts +17 -11
- package/src/domain/memory/__tests__/create-authorization.test.ts +59 -0
- package/src/domain/memory/controller.ts +11 -0
- package/src/domain/memory/steps.ts +41 -0
- package/src/domain/oauthapp/controller.ts +10 -0
- package/src/domain/plugin/controller.ts +22 -36
- package/src/domain/schedule/__tests__/create-authorization.test.ts +58 -0
- package/src/domain/schedule/controller.ts +20 -0
- package/src/domain/schedule/steps.ts +45 -2
- package/src/domain/session/steps.ts +24 -32
- package/src/domain/skill/controller.ts +24 -23
- package/src/domain/workflow/controller.ts +58 -145
- package/src/domain/workflow/version-resolution.ts +166 -0
- package/src/domain/workflowinstance/__tests__/create-authorization.test.ts +109 -0
- package/src/domain/workflowinstance/controller.ts +19 -0
- package/src/domain/workflowinstance/steps.ts +49 -1
- package/src/extensions/__tests__/composed-support.ts +38 -4
- package/src/extensions/__tests__/identity.test.ts +44 -1
- package/src/extensions/__tests__/list-read-scope-composed.test.ts +87 -1
- package/src/extensions/__tests__/list-read-scope.test.ts +63 -0
- package/src/extensions/identity.ts +23 -5
- package/src/extensions/list-read-scope.ts +47 -7
- package/src/pipeline/steps/__tests__/authorize-resolved-target.test.ts +285 -0
- package/src/pipeline/steps/authorize-resolved-target.ts +129 -0
- package/src/pipeline/steps/authorize.ts +70 -13
- package/src/pipeline/steps/guard-memory-capture.ts +2 -1
- package/src/pipeline/steps/guard-reserved-labels.ts +6 -9
- package/src/pipeline/steps/helpers.ts +11 -15
- package/src/pipeline/steps/version-history.ts +34 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthorizeResolvedTarget — the ONE mid-chain authorization step: the
|
|
3
|
+
* question a lane can only ask once its chain has loaded something the
|
|
4
|
+
* position-1 annotation could not key on.
|
|
5
|
+
*
|
|
6
|
+
* The `Authorize` step resolves its target from the REQUEST (a field path
|
|
7
|
+
* over the input), so it cannot serve two shapes of lane, and both are
|
|
8
|
+
* `is_skip_authorization` on the wire for that reason alone:
|
|
9
|
+
*
|
|
10
|
+
* - a read by reference: the request carries an org and a slug, the
|
|
11
|
+
* target is the row the loader finds, and the question is exactly the
|
|
12
|
+
* one the kind's `get` asks by id — `can_view` on that row, with the
|
|
13
|
+
* `get` annotation's byte-pinned copy. `loadedTargetAsMethod(get)` is
|
|
14
|
+
* that resolver: it reads the row under TARGET_RESOURCE_KEY and asks the
|
|
15
|
+
* sibling `get` descriptor's annotation about its id, so the two lanes
|
|
16
|
+
* cannot drift (one annotation owns the permission and the copy; a
|
|
17
|
+
* `get` that is itself a skip makes the reference read a skip too).
|
|
18
|
+
* - a parent-gated create: the request names a parent (an agent to
|
|
19
|
+
* schedule, share, channel-bind or instantiate; a workflow to
|
|
20
|
+
* instantiate), the domain's resolve step loads and stashes it, and the
|
|
21
|
+
* question is the caller's standing on that parent (or on the row's
|
|
22
|
+
* organization), with the copy the lane has always answered.
|
|
23
|
+
*
|
|
24
|
+
* The step owns nothing but the position and the evaluation: a PURE
|
|
25
|
+
* resolver over the request context names the questions (kind, id,
|
|
26
|
+
* permission, copy), in the order the lane asks them; the first refusal
|
|
27
|
+
* answers. The evaluation is `authorizeTarget` (authorize.ts): allow
|
|
28
|
+
* proceeds, deny is PERMISSION_DENIED with the copy, not-found is NOT_FOUND
|
|
29
|
+
* as the load-first chain would answer, unavailable is INTERNAL, and the
|
|
30
|
+
* `internal` class alone is exempt — the annotation's skip arms do not
|
|
31
|
+
* apply, because the caller IS the enforcement the annotation opted out of.
|
|
32
|
+
*
|
|
33
|
+
* Two contracts a resolver keeps. It returns an EMPTY list only for an arm
|
|
34
|
+
* the lane has modelled as "nothing to ask" (a default instance the server
|
|
35
|
+
* composed for the run's human, whose access already follows the parent);
|
|
36
|
+
* an absent stash, a parent the chain guaranteed and did not deliver, is a
|
|
37
|
+
* chain invariant broken and the resolver THROWS, so a mis-ordered chain
|
|
38
|
+
* fails loudly instead of silently reopening the lane. And it names the
|
|
39
|
+
* questions in the anti-probing order: the organization's bar before the
|
|
40
|
+
* parent's where both are asked, so an outsider learns nothing about the
|
|
41
|
+
* parent's grants from which copy came back.
|
|
42
|
+
*
|
|
43
|
+
* Position: immediately after the step that loads what the resolver reads,
|
|
44
|
+
* before the duplicate check, before any engine or store side effect, and
|
|
45
|
+
* before any step whose refusal would reveal the loaded row (a same-org
|
|
46
|
+
* rule that names the parent's organization, an enrichment that reads the
|
|
47
|
+
* row's connections).
|
|
48
|
+
*
|
|
49
|
+
* The step's name is the shared vocabulary for every NEW lane. The lanes
|
|
50
|
+
* that carried a hand-written copy of this body before it existed keep
|
|
51
|
+
* their frozen names through `stepName` — the version ladder's own
|
|
52
|
+
* precedent (LoadSkillByReference and LoadPluginByReference are one
|
|
53
|
+
* factory) — because a step name is never renamed.
|
|
54
|
+
*
|
|
55
|
+
* Sibling: `AuthorizeRunTarget` runs the same evaluation over the record
|
|
56
|
+
* being built (`ctx.newState`) and carries the run-gate doctrine an
|
|
57
|
+
* edition's lane admission keys on; this step reads what the chain LOADED
|
|
58
|
+
* and carries no doctrine of its own.
|
|
59
|
+
*/
|
|
60
|
+
import type { DescMessage, DescMethod } from "@bufbuild/protobuf";
|
|
61
|
+
import type { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
62
|
+
import type { Authorizer } from "../../extensions/authorizer.js";
|
|
63
|
+
import type { PipelineStep } from "../pipeline.js";
|
|
64
|
+
import type { RequestContext } from "../request-context.js";
|
|
65
|
+
import { type AuthorizationTarget } from "./authorize.js";
|
|
66
|
+
/** The step's shared name; a folded lane passes its own frozen name instead. */
|
|
67
|
+
export declare const AUTHORIZE_RESOLVED_TARGET_STEP = "AuthorizeResolvedTarget";
|
|
68
|
+
/**
|
|
69
|
+
* Names the questions a lane asks, in order, over the request context after
|
|
70
|
+
* its chain has loaded the target. Pure: no store, no clock, no side effect.
|
|
71
|
+
* Empty means the lane has nothing to ask on this request; an invariant the
|
|
72
|
+
* chain broke (an absent stash) is a throw, never an empty list.
|
|
73
|
+
*/
|
|
74
|
+
export type ResolvedTargetResolver<Desc extends DescMessage> = (ctx: RequestContext<Desc>) => ReadonlyArray<AuthorizationTarget>;
|
|
75
|
+
export declare function newAuthorizeResolvedTargetStep<Desc extends DescMessage>(authorizer: Authorizer, resolve: ResolvedTargetResolver<Desc>, stepName?: string): PipelineStep<Desc>;
|
|
76
|
+
/** The request shape every `getByReference` lane runs on. */
|
|
77
|
+
export type GetByReferenceDesc = typeof ApiResourceReferenceSchema;
|
|
78
|
+
/**
|
|
79
|
+
* The reads' resolver: the row the loader stashed under TARGET_RESOURCE_KEY,
|
|
80
|
+
* authorized exactly as `get` would authorize it by id. The `get`
|
|
81
|
+
* descriptor's annotation supplies the kind, the permission and the copy;
|
|
82
|
+
* the loaded row's id is the target override (a reference has no `value`
|
|
83
|
+
* field for the annotation's path to read). A `get` that is public, skip
|
|
84
|
+
* or unannotated makes this a no-op — the reference read is never stricter
|
|
85
|
+
* than the read by id, and never laxer.
|
|
86
|
+
*/
|
|
87
|
+
export declare function loadedTargetAsMethod(get: DescMethod): ResolvedTargetResolver<GetByReferenceDesc>;
|
|
88
|
+
//# sourceMappingURL=authorize-resolved-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize-resolved-target.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/authorize-resolved-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAW,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAEvG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AAExE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,CAAC,IAAI,SAAS,WAAW,IAAI,CAC7D,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,KACtB,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAExC,wBAAgB,8BAA8B,CAAC,IAAI,SAAS,WAAW,EACrE,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,sBAAsB,CAAC,IAAI,CAAC,EACrC,QAAQ,GAAE,MAAuC,GAChD,YAAY,CAAC,IAAI,CAAC,CASpB;AAED,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAAG,OAAO,0BAA0B,CAAC;AAEnE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,UAAU,GACd,sBAAsB,CAAC,kBAAkB,CAAC,CAY5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { metadataOf } from "./shapes.js";
|
|
2
|
+
import { TARGET_RESOURCE_KEY } from "./load-target.js";
|
|
3
|
+
import { authorizeTarget, resolveAnnotatedCheck, } from "./authorize.js";
|
|
4
|
+
/** The step's shared name; a folded lane passes its own frozen name instead. */
|
|
5
|
+
export const AUTHORIZE_RESOLVED_TARGET_STEP = "AuthorizeResolvedTarget";
|
|
6
|
+
export function newAuthorizeResolvedTargetStep(authorizer, resolve, stepName = AUTHORIZE_RESOLVED_TARGET_STEP) {
|
|
7
|
+
return {
|
|
8
|
+
name: stepName,
|
|
9
|
+
async execute(ctx) {
|
|
10
|
+
for (const target of resolve(ctx)) {
|
|
11
|
+
await authorizeTarget(authorizer, ctx.callerIdentity, target);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The reads' resolver: the row the loader stashed under TARGET_RESOURCE_KEY,
|
|
18
|
+
* authorized exactly as `get` would authorize it by id. The `get`
|
|
19
|
+
* descriptor's annotation supplies the kind, the permission and the copy;
|
|
20
|
+
* the loaded row's id is the target override (a reference has no `value`
|
|
21
|
+
* field for the annotation's path to read). A `get` that is public, skip
|
|
22
|
+
* or unannotated makes this a no-op — the reference read is never stricter
|
|
23
|
+
* than the read by id, and never laxer.
|
|
24
|
+
*/
|
|
25
|
+
export function loadedTargetAsMethod(get) {
|
|
26
|
+
return (ctx) => {
|
|
27
|
+
const loaded = ctx.get(TARGET_RESOURCE_KEY);
|
|
28
|
+
const id = loaded === undefined ? undefined : metadataOf(loaded)?.id;
|
|
29
|
+
if (id === undefined) {
|
|
30
|
+
throw new Error(`${AUTHORIZE_RESOLVED_TARGET_STEP}: no loaded target with metadata under ${TARGET_RESOURCE_KEY}; the loader must run first`);
|
|
31
|
+
}
|
|
32
|
+
const target = resolveAnnotatedCheck(get, ctx.input, { resourceId: id });
|
|
33
|
+
return target === undefined ? [] : [target];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=authorize-resolved-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize-resolved-target.js","sourceRoot":"","sources":["../../../src/pipeline/steps/authorize-resolved-target.ts"],"names":[],"mappings":"AAkEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACL,eAAe,EACf,qBAAqB,GAEtB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AAYxE,MAAM,UAAU,8BAA8B,CAC5C,UAAsB,EACtB,OAAqC,EACrC,WAAmB,8BAA8B;IAEjD,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,CAAC,OAAO,CAAC,GAAyB;YACrC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,MAAM,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAKD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAe;IAEf,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAwB,CAAC;QACnE,MAAM,EAAE,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACrE,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,GAAG,8BAA8B,0CAA0C,mBAAmB,6BAA6B,CAC5H,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -38,6 +38,26 @@ export interface AuthorizeTargetOverride {
|
|
|
38
38
|
readonly resourceKind?: ApiResourceKind;
|
|
39
39
|
readonly resourceId: string;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* One question for the Authorizer together with the lane's deny copy: the
|
|
43
|
+
* unit `authorizeResolvedResource` consumes, whether the annotation named
|
|
44
|
+
* it (`resolveAnnotatedCheck`) or a chain's own resolver did (the run gate,
|
|
45
|
+
* the resolved-target step).
|
|
46
|
+
*/
|
|
47
|
+
export interface AuthorizationTarget extends AuthzCheck {
|
|
48
|
+
readonly deniedMessage: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The annotation's answer for one method: the target it names for this
|
|
52
|
+
* request, or `undefined` when it names none — `is_public`,
|
|
53
|
+
* `is_skip_authorization`, or no config at all. Pure over the descriptor
|
|
54
|
+
* and the request; the `internal` exemption is the evaluation's, not the
|
|
55
|
+
* annotation's, so it is not applied here. Exported so a chain step can
|
|
56
|
+
* authorize a loaded row exactly as a SIBLING method's annotation would
|
|
57
|
+
* (a read by reference asks what its `get` asks) without a second copy of
|
|
58
|
+
* the skip arms or the field-path resolution.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveAnnotatedCheck(method: DescMethod, input: Message, override?: AuthorizeTargetOverride): AuthorizationTarget | undefined;
|
|
41
61
|
/**
|
|
42
62
|
* The Authorize evaluation for direct handlers: identical skip arms,
|
|
43
63
|
* target resolution, and decision-to-wire mapping as the pipeline step
|
|
@@ -45,6 +65,13 @@ export interface AuthorizeTargetOverride {
|
|
|
45
65
|
* non-allow arm; resolves on allow and on every skip arm.
|
|
46
66
|
*/
|
|
47
67
|
export declare function authorizeDirect(method: DescMethod, authorizer: Authorizer, identity: CallerIdentity, input: Message, override?: AuthorizeTargetOverride): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* `authorizeResolvedResource` over an AuthorizationTarget: the check the
|
|
70
|
+
* Authorizer sees carries exactly the three fields of an AuthzCheck, never
|
|
71
|
+
* the copy, so a recording Authorizer (a test's, a driver's audit line)
|
|
72
|
+
* observes the question and nothing else.
|
|
73
|
+
*/
|
|
74
|
+
export declare function authorizeTarget(authorizer: Authorizer, identity: CallerIdentity, target: AuthorizationTarget): Promise<void>;
|
|
48
75
|
/**
|
|
49
76
|
* The SAME evaluation for a check whose target the HANDLER resolved —
|
|
50
77
|
* the mid-chain resolved-id pattern DD-007 names ("the pattern the two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/authorize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/authorize.ts"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAQtH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,+CACA,CAAC;AAE/C,uEAAuE;AACvE,eAAO,MAAM,qCAAqC,sBAAsB,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,iCAAiC,IAAI,UAAU,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,WAAW,EACvD,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,GACrB,YAAY,CAAC,IAAI,CAAC,CAOpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,uBAAuB,GACjC,mBAAmB,GAAG,SAAS,CAiBjC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,uBAAuB,GACjC,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CA4Cf;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,aAAa,CAAC,CASxB"}
|
|
@@ -56,6 +56,14 @@
|
|
|
56
56
|
* names no kind because the target is the loaded row's resource). The
|
|
57
57
|
* annotation keeps owning the permission, the copy and the skip arms in
|
|
58
58
|
* both shapes; only the target is the handler's.
|
|
59
|
+
*
|
|
60
|
+
* The annotation read itself is one pure function, `resolveAnnotatedCheck`,
|
|
61
|
+
* so a third entry shape needs no third copy of it: the resolved-target
|
|
62
|
+
* step (authorize-resolved-target.ts) authorizes a row a chain LOADED as
|
|
63
|
+
* a sibling method's annotation would — a read by reference asks exactly
|
|
64
|
+
* what its `get` asks, target override and all — and every lane whose
|
|
65
|
+
* position-1 annotation is a skip because the target is not in the request
|
|
66
|
+
* answers its question there, with the same four arms.
|
|
59
67
|
*/
|
|
60
68
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
61
69
|
import { getOption, hasOption } from "@bufbuild/protobuf";
|
|
@@ -98,6 +106,32 @@ export function newAuthorizeStep(method, authorizer) {
|
|
|
98
106
|
},
|
|
99
107
|
};
|
|
100
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* The annotation's answer for one method: the target it names for this
|
|
111
|
+
* request, or `undefined` when it names none — `is_public`,
|
|
112
|
+
* `is_skip_authorization`, or no config at all. Pure over the descriptor
|
|
113
|
+
* and the request; the `internal` exemption is the evaluation's, not the
|
|
114
|
+
* annotation's, so it is not applied here. Exported so a chain step can
|
|
115
|
+
* authorize a loaded row exactly as a SIBLING method's annotation would
|
|
116
|
+
* (a read by reference asks what its `get` asks) without a second copy of
|
|
117
|
+
* the skip arms or the field-path resolution.
|
|
118
|
+
*/
|
|
119
|
+
export function resolveAnnotatedCheck(method, input, override) {
|
|
120
|
+
if (getOption(method, is_public) ||
|
|
121
|
+
getOption(method, is_skip_authorization)) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
if (!hasOption(method, rpcAuthorizationConfig)) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const config = getOption(method, rpcAuthorizationConfig);
|
|
128
|
+
return {
|
|
129
|
+
permission: config.permission,
|
|
130
|
+
resourceKind: override?.resourceKind ?? resolveResourceKind(input, config),
|
|
131
|
+
resourceId: override?.resourceId ?? resolveResourceId(input, config),
|
|
132
|
+
deniedMessage: config.errorMsg,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
101
135
|
/**
|
|
102
136
|
* The Authorize evaluation for direct handlers: identical skip arms,
|
|
103
137
|
* target resolution, and decision-to-wire mapping as the pipeline step
|
|
@@ -108,19 +142,24 @@ export async function authorizeDirect(method, authorizer, identity, input, overr
|
|
|
108
142
|
if (identity.callerClass === "internal") {
|
|
109
143
|
return;
|
|
110
144
|
}
|
|
111
|
-
|
|
112
|
-
|
|
145
|
+
const target = resolveAnnotatedCheck(method, input, override);
|
|
146
|
+
if (target === undefined) {
|
|
113
147
|
return;
|
|
114
148
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
149
|
+
return authorizeTarget(authorizer, identity, target);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* `authorizeResolvedResource` over an AuthorizationTarget: the check the
|
|
153
|
+
* Authorizer sees carries exactly the three fields of an AuthzCheck, never
|
|
154
|
+
* the copy, so a recording Authorizer (a test's, a driver's audit line)
|
|
155
|
+
* observes the question and nothing else.
|
|
156
|
+
*/
|
|
157
|
+
export function authorizeTarget(authorizer, identity, target) {
|
|
119
158
|
return authorizeResolvedResource(authorizer, identity, {
|
|
120
|
-
permission:
|
|
121
|
-
resourceKind:
|
|
122
|
-
resourceId:
|
|
123
|
-
},
|
|
159
|
+
permission: target.permission,
|
|
160
|
+
resourceKind: target.resourceKind,
|
|
161
|
+
resourceId: target.resourceId,
|
|
162
|
+
}, target.deniedMessage);
|
|
124
163
|
}
|
|
125
164
|
/**
|
|
126
165
|
* The SAME evaluation for a check whose target the HANDLER resolved —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../../src/pipeline/steps/authorize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../../src/pipeline/steps/authorize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,EACL,MAAM,IAAI,sBAAsB,EACh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C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YACpD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAI,OAAmC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,8EAA8E;AAC9E,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAU,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-memory-capture.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-memory-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"guard-memory-capture.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-memory-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAG/F,wEAAwE;AACxE,eAAO,MAAM,6BAA6B,iEACsB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,wBAAgB,yBAAyB,CAAC,IAAI,SAAS,WAAW,EAChE,QAAQ,CAAC,EAAE,wBAAwB,GAClC,YAAY,CAAC,IAAI,CAAC,CAsDpB;AAED,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,SAAS,WAAW,EAChE,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,GACxB,uBAAuB,GAAG,SAAS,CAWrC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
2
|
+
import { isServerComposedRequest } from "../../extensions/identity.js";
|
|
2
3
|
import { metadataOf } from "./shapes.js";
|
|
3
4
|
/** The Java MemoryPolicy.MEMORY_CAPTURE_CALLER_MESSAGE, byte-pinned. */
|
|
4
5
|
export const MEMORY_CAPTURE_CALLER_MESSAGE = "memory can only be captured for a first-party human operator";
|
|
@@ -14,7 +15,7 @@ export function newGuardMemoryCaptureStep(provider) {
|
|
|
14
15
|
name: "GuardMemoryCapture",
|
|
15
16
|
async execute(ctx) {
|
|
16
17
|
const caller = ctx.callerIdentity;
|
|
17
|
-
if (caller
|
|
18
|
+
if (isServerComposedRequest(caller)) {
|
|
18
19
|
// Server-composed traversals are not capture requests from a
|
|
19
20
|
// credential; the entry-point request already passed the gate.
|
|
20
21
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-memory-capture.js","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-memory-capture.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"guard-memory-capture.js","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-memory-capture.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB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C,OAAO,CAAC,kBAAkB,KAAK,EAAE,CAClC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-reserved-labels.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-reserved-labels.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAK/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"guard-reserved-labels.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-reserved-labels.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAK/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAK5D,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAYnD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACxC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC1C,aAAa,CAAC,MAAM,CAAC,CAQvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B,CAAC,IAAI,SAAS,WAAW;IACpE,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,OAAO,GAAG,SAAS,CAAC;IACtE,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,0BAA0B,CAAC,IAAI,SAAS,WAAW,EACjE,UAAU,EAAE,UAAU,EACtB,SAAS,GAAE,4BAA4B,CAAC,IAAI,CAAM,GACjD,YAAY,CAAC,IAAI,CAAC,CAoEpB"}
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
52
52
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
53
53
|
import { IamPermission } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
54
|
+
import { isServerComposedRequest } from "../../extensions/identity.js";
|
|
54
55
|
import { internalError } from "../errors.js";
|
|
55
56
|
import { EXISTING_RESOURCE_KEY } from "./load-existing.js";
|
|
56
57
|
import { serverStampedReservedLabels } from "./server-stamped-reserved-labels.js";
|
|
@@ -83,13 +84,11 @@ export function newGuardReservedLabelsStep(authorizer, positions = {}) {
|
|
|
83
84
|
return {
|
|
84
85
|
name: "GuardReservedLabels",
|
|
85
86
|
async execute(ctx) {
|
|
86
|
-
if (ctx.callerIdentity
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
// labels by design, even when the call propagates the user's
|
|
92
|
-
// identity for attribution (ruling R5).
|
|
87
|
+
if (isServerComposedRequest(ctx.callerIdentity)) {
|
|
88
|
+
// The Java isInProcessCall arm (cloud#386): the trust decision was
|
|
89
|
+
// made by the service code that built the request — default-instance
|
|
90
|
+
// factories stamp reserved labels by design, even when the call
|
|
91
|
+
// propagates the user's identity for attribution (ruling R5).
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
const state = stateOf(ctx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-reserved-labels.js","sourceRoot":"","sources":["../../../src/pipeline/steps/guard-reserved-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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,EAAE,CAAC,CAC5D,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,SAAS,yBAAyB,CAAC,KAAc;IAC/C,OAAO,aAAa,CAClB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EACzD,kDAAkD,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -20,11 +20,15 @@ export declare function findResourceBySlug<Desc extends DescMessage>(store: Stor
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function findResourceByLabelAndOrg<Desc extends DescMessage>(store: Store, kind: ApiResourceKind, schema: Desc, labelKey: string, labelValue: string, org: string): Promise<MessageShape<Desc> | undefined>;
|
|
22
22
|
/**
|
|
23
|
-
* Rejects a getByReference lookup that omits org
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* Rejects a getByReference lookup that omits org — Go RequireOrgForReference,
|
|
24
|
+
* widened to every kind that has a reference lane. A slug is unique only
|
|
25
|
+
* WITHIN an org, so an org-less reference resolves globally and the first
|
|
26
|
+
* match wins: for an org-scoped kind that crosses tenant boundaries, and
|
|
27
|
+
* for an owner-only kind (the execution context) it let a caller name a
|
|
28
|
+
* slug and receive whichever organization's row matched first. Every kind
|
|
29
|
+
* with a reference lane is served per organization, so the rule is the
|
|
30
|
+
* same for all of them. The message matches the cloud edition verbatim
|
|
31
|
+
* (cross-edition error contract); the kind name comes from kind_meta.
|
|
28
32
|
*
|
|
29
33
|
* Belongs at the getByReference boundary only — the low-level slug finders
|
|
30
34
|
* are legitimately called with a relative (possibly empty) org by internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/helpers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,Y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;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,OAAO,CAIT"}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* interface, not here — D2 §3).
|
|
5
5
|
*/
|
|
6
6
|
import { fromBinary } from "@bufbuild/protobuf";
|
|
7
|
-
import { AuthorizationScopeType } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/authorization_config_pb";
|
|
8
7
|
import { getKindMeta } from "../apiresource-meta.js";
|
|
9
8
|
import { internalError, invalidArgumentError } from "../errors.js";
|
|
10
9
|
import { metadataOf } from "./shapes.js";
|
|
@@ -65,11 +64,15 @@ export async function findResourceByLabelAndOrg(store, kind, schema, labelKey, l
|
|
|
65
64
|
return undefined;
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
68
|
-
* Rejects a getByReference lookup that omits org
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
67
|
+
* Rejects a getByReference lookup that omits org — Go RequireOrgForReference,
|
|
68
|
+
* widened to every kind that has a reference lane. A slug is unique only
|
|
69
|
+
* WITHIN an org, so an org-less reference resolves globally and the first
|
|
70
|
+
* match wins: for an org-scoped kind that crosses tenant boundaries, and
|
|
71
|
+
* for an owner-only kind (the execution context) it let a caller name a
|
|
72
|
+
* slug and receive whichever organization's row matched first. Every kind
|
|
73
|
+
* with a reference lane is served per organization, so the rule is the
|
|
74
|
+
* same for all of them. The message matches the cloud edition verbatim
|
|
75
|
+
* (cross-edition error contract); the kind name comes from kind_meta.
|
|
73
76
|
*
|
|
74
77
|
* Belongs at the getByReference boundary only — the low-level slug finders
|
|
75
78
|
* are legitimately called with a relative (possibly empty) org by internal
|
|
@@ -79,21 +82,14 @@ export function requireOrgForReference(kind, org) {
|
|
|
79
82
|
if (org !== "") {
|
|
80
83
|
return;
|
|
81
84
|
}
|
|
82
|
-
let scopeType;
|
|
83
85
|
let kindName;
|
|
84
86
|
try {
|
|
85
|
-
|
|
86
|
-
scopeType = meta.authorization?.scopeType;
|
|
87
|
-
kindName = meta.name;
|
|
87
|
+
kindName = getKindMeta(kind).name;
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
90
|
throw internalError(error, "failed to resolve kind metadata for reference org check");
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
// AUTHORIZATION_SCOPE_TYPE_ORGANIZATION generates as ORGANIZATION.
|
|
94
|
-
if (scopeType === AuthorizationScopeType.ORGANIZATION) {
|
|
95
|
-
throw invalidArgumentError(`org is required for ${kindName} lookup`);
|
|
96
|
-
}
|
|
92
|
+
throw invalidArgumentError(`org is required for ${kindName} lookup`);
|
|
97
93
|
}
|
|
98
94
|
// The two list-step helpers below are duplicated per package in Go (each
|
|
99
95
|
// controller carries its own copy); the TS tree consolidates them here
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/pipeline/steps/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/pipeline/steps/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAY,EACZ,IAAqB,EACrB,MAAY,EACZ,IAAY,EACZ,GAAW;IAEX,MAAM,IAAI,GAAG,MAAM,KAAK,C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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAC9B,cAAsC,EACtC,YAAoC;IAEpC,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,KAAK,CACvC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,KAAK,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/
|
|
|
3
3
|
import type { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
4
4
|
import type { PipelineStep } from "../pipeline.js";
|
|
5
5
|
import type { Store } from "../../store/interface.js";
|
|
6
|
+
import type { ResolvedTargetResolver } from "./authorize-resolved-target.js";
|
|
6
7
|
export declare function isVersionHash(version: string): boolean;
|
|
7
8
|
/** What a content-versioned kind must say about itself for the ladder. */
|
|
8
9
|
export interface VersionedResourceBinding<Desc extends DescMessage> {
|
|
@@ -21,6 +22,16 @@ export declare function newLoadByReferenceWithVersionStep<Desc extends DescMessa
|
|
|
21
22
|
export declare const LIST_VERSIONS_RESOURCE_ID_KEY = "listVersionsResourceId";
|
|
22
23
|
export declare const LIST_VERSIONS_HEAD_HASH_KEY = "listVersionsHeadHash";
|
|
23
24
|
export declare const LIST_VERSIONS_RESPONSE_KEY = "listVersionsResponse";
|
|
25
|
+
/**
|
|
26
|
+
* The ListVersions lanes' authorization question, for the
|
|
27
|
+
* AuthorizeResolvedTarget step placed after the slug resolver: `can_view`
|
|
28
|
+
* on the resolved head's id (the version history of a row is readable by
|
|
29
|
+
* whoever may read the row), with the lane's byte-pinned copy. The id key
|
|
30
|
+
* is the resolver's own — the shared resolver stashes under
|
|
31
|
+
* LIST_VERSIONS_RESOURCE_ID_KEY; a domain resolver with its own key names
|
|
32
|
+
* it. An id the chain did not stash is a broken invariant and throws.
|
|
33
|
+
*/
|
|
34
|
+
export declare function versionHistoryTarget<Desc extends DescMessage>(kind: ApiResourceKind, deniedMessage: string, idKey?: string): ResolvedTargetResolver<Desc>;
|
|
24
35
|
/** The fields every ListVersions input carries; the binding reads them off its own message. */
|
|
25
36
|
export interface ListVersionsInputShape {
|
|
26
37
|
readonly org: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-history.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/version-history.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"version-history.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/version-history.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAQvG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAO7E,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,0EAA0E;AAC1E,MAAM,WAAW,wBAAwB,CAAC,IAAI,SAAS,WAAW;IAChE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,IA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AAY,CAAC,SAAS,CAAC,GAAG,sBAAsB,CAAC;IAChE,sEAAsE;IACtE,QAAQ,CACN,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,EAC5B,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,MAAM,GACV,KAAK,CAAC;IACT,QAAQ,CACN,OAAO,EAAE,KAAK,EAAE,EAChB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,QAAQ,CAAC;CACb;AAED,uGAAuG;AACvG,wBAAgB,+BAA+B,CAC7C,IAAI,SAAS,WAAW,EACxB,SAAS,SAAS,WAAW,EAC7B,KAAK,SAAS,OAAO,EACrB,QAAQ,SAAS,OAAO,EAExB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,EAChE,QAAQ,EAAE,MAAM,GACf,YAAY,CAAC,SAAS,CAAC,CA2BzB;AAED,mFAAmF;AACnF,wBAAgB,yBAAyB,CACvC,IAAI,SAAS,WAAW,EACxB,SAAS,SAAS,WAAW,EAC7B,KAAK,SAAS,OAAO,EACrB,QAAQ,SAAS,OAAO,EAExB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,EAChE,QAAQ,EAAE,MAAM,GACf,YAAY,CAAC,SAAS,CAAC,CAkEzB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWrD"}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { fromBinary } from "@bufbuild/protobuf";
|
|
30
30
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
31
|
+
import { IamPermission } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
31
32
|
import { internalError, invalidArgumentError, notFoundError, } from "../errors.js";
|
|
32
33
|
import { AuditNotFoundError } from "../../store/interface.js";
|
|
33
34
|
import { findResourceBySlug, requireOrgForReference } from "./helpers.js";
|
|
@@ -121,6 +122,31 @@ const MAX_PAGE_SIZE = 100;
|
|
|
121
122
|
export const LIST_VERSIONS_RESOURCE_ID_KEY = "listVersionsResourceId";
|
|
122
123
|
export const LIST_VERSIONS_HEAD_HASH_KEY = "listVersionsHeadHash";
|
|
123
124
|
export const LIST_VERSIONS_RESPONSE_KEY = "listVersionsResponse";
|
|
125
|
+
/**
|
|
126
|
+
* The ListVersions lanes' authorization question, for the
|
|
127
|
+
* AuthorizeResolvedTarget step placed after the slug resolver: `can_view`
|
|
128
|
+
* on the resolved head's id (the version history of a row is readable by
|
|
129
|
+
* whoever may read the row), with the lane's byte-pinned copy. The id key
|
|
130
|
+
* is the resolver's own — the shared resolver stashes under
|
|
131
|
+
* LIST_VERSIONS_RESOURCE_ID_KEY; a domain resolver with its own key names
|
|
132
|
+
* it. An id the chain did not stash is a broken invariant and throws.
|
|
133
|
+
*/
|
|
134
|
+
export function versionHistoryTarget(kind, deniedMessage, idKey = LIST_VERSIONS_RESOURCE_ID_KEY) {
|
|
135
|
+
return (ctx) => {
|
|
136
|
+
const resourceId = ctx.get(idKey);
|
|
137
|
+
if (typeof resourceId !== "string" || resourceId === "") {
|
|
138
|
+
throw new Error(`ListVersions: no resolved resource id under ${idKey}; the slug resolver must run first`);
|
|
139
|
+
}
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
permission: IamPermission.can_view,
|
|
143
|
+
resourceKind: kind,
|
|
144
|
+
resourceId,
|
|
145
|
+
deniedMessage,
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
};
|
|
149
|
+
}
|
|
124
150
|
/** Resolves the head by slug and captures its id and hash (Go ResolveSkillBySlugStep, generalised). */
|
|
125
151
|
export function newResolveBySlugForVersionsStep(store, binding, stepName) {
|
|
126
152
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-history.js","sourceRoot":"","sources":["../../../src/pipeline/steps/version-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;
|
|
1
|
+
{"version":3,"file":"version-history.js","sourceRoot":"","sources":["../../../src/pipeline/steps/version-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,oEAAoE;AACpE,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAgBD,iFAAiF;AACjF,MAAM,UAAU,iCAAiC,CAC/C,KAAY,EACZ,OAAuC,EACvC,QAAgB;IAEhB,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,CAAC,OAAO,CAAC,GAAuC;YACnD,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC;YAEtB,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE,CAAC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