@sixb/core 0.1.19 → 0.1.20
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/actions/index.js +24 -24
- package/dist/agents/index.js +25 -25
- package/dist/agents/index.js.map +1 -1
- package/dist/auth/cookies.d.ts +2 -4
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/index.d.ts +0 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +8 -14
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +8 -10
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/session-cache.d.ts +1 -5
- package/dist/auth/session-cache.d.ts.map +1 -1
- package/dist/auth/strategy.js +1 -1
- package/dist/auth/types.d.ts +4 -8
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/validation.d.ts +0 -1
- package/dist/auth/validation.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +0 -4
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +6 -8
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.d.ts +0 -1
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +3 -7
- package/dist/authorization/index.js.map +1 -1
- package/dist/authorization/resolve.d.ts +1 -1
- package/dist/authorization/resolve.d.ts.map +1 -1
- package/dist/bootstrap/index.js +26 -26
- package/dist/{chunk-aff7cyea.js → chunk-0rbyz4qy.js} +21 -21
- package/dist/{chunk-aff7cyea.js.map → chunk-0rbyz4qy.js.map} +1 -1
- package/dist/{chunk-rz53yb4v.js → chunk-0yh890a4.js} +1 -1
- package/dist/{chunk-7mbzgd9m.js → chunk-1zq2p6g0.js} +1 -1
- package/dist/{chunk-dnmadg9k.js → chunk-3t2hgbgd.js} +2 -2
- package/dist/{chunk-wwdfe68s.js → chunk-4vyr1j8f.js} +2 -2
- package/dist/{chunk-kyzq4wy9.js → chunk-5j58wjct.js} +15 -15
- package/dist/chunk-5j58wjct.js.map +18 -0
- package/dist/{chunk-ey3pyej1.js → chunk-6c6sn0bh.js} +29 -24
- package/dist/{chunk-ey3pyej1.js.map → chunk-6c6sn0bh.js.map} +3 -3
- package/dist/{chunk-q1vkr2ys.js → chunk-6p49a5cq.js} +2 -2
- package/dist/{chunk-nre82s12.js → chunk-9dmt152s.js} +1 -1
- package/dist/{chunk-7kg3k1m9.js → chunk-9w055r5b.js} +1 -1
- package/dist/{chunk-4tcx876c.js → chunk-bx9q3cwv.js} +15 -15
- package/dist/{chunk-4tcx876c.js.map → chunk-bx9q3cwv.js.map} +1 -1
- package/dist/{chunk-bpgy64fw.js → chunk-d09tj99x.js} +1 -1
- package/dist/{chunk-y7rqfrgg.js → chunk-d0bqz29d.js} +23 -36
- package/dist/chunk-d0bqz29d.js.map +23 -0
- package/dist/{chunk-rhg02hxq.js → chunk-dk8tkk5f.js} +3 -3
- package/dist/{chunk-xt1zt7gv.js → chunk-es1gxsbf.js} +24 -15
- package/dist/chunk-es1gxsbf.js.map +13 -0
- package/dist/{chunk-52bk93x8.js → chunk-fkgc1wt8.js} +1 -1
- package/dist/{chunk-enpsx8k5.js → chunk-gsjm1wms.js} +16 -20
- package/dist/chunk-gsjm1wms.js.map +10 -0
- package/dist/{chunk-2jntasmh.js → chunk-hcbyfxbe.js} +25 -49
- package/dist/chunk-hcbyfxbe.js.map +12 -0
- package/dist/{chunk-zrmy8zvw.js → chunk-hjzdd750.js} +3 -3
- package/dist/chunk-hkc3jct7.js.map +1 -1
- package/dist/{chunk-85yvv5n0.js → chunk-k6q3n2sc.js} +3 -3
- package/dist/{chunk-j2bp5ryw.js → chunk-n33z5bjw.js} +11 -10
- package/dist/{chunk-j2bp5ryw.js.map → chunk-n33z5bjw.js.map} +3 -3
- package/dist/{chunk-80mc0971.js → chunk-ren4kg2j.js} +8 -8
- package/dist/{chunk-1f7wpmyp.js → chunk-rrzt8jdy.js} +2 -2
- package/dist/{chunk-6gmfggss.js → chunk-t7x8dmn0.js} +2 -2
- package/dist/{chunk-wz0xs816.js → chunk-tg2cw67r.js} +1 -1
- package/dist/{chunk-3gnrh4ve.js → chunk-vpq4shxz.js} +46 -106
- package/dist/chunk-vpq4shxz.js.map +39 -0
- package/dist/{chunk-bwjcehza.js → chunk-way52z4h.js} +1 -1
- package/dist/{chunk-tjb1mk5t.js → chunk-x6m907x7.js} +2 -2
- package/dist/{chunk-t6vq7bff.js → chunk-xfs8x8m9.js} +3 -3
- package/dist/{chunk-d2ync1v3.js → chunk-yevzdx4y.js} +3 -3
- package/dist/{chunk-kg5j6fct.js → chunk-z4m0yz8c.js} +1 -1
- package/dist/datasets/write.js +5 -5
- package/dist/deploy/internal.js +4 -3
- package/dist/deploy/internal.js.map +4 -4
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +1 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/execution/agent.js +24 -24
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/primitive.js +24 -24
- package/dist/execution/request.js +23 -23
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -46
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +5 -5
- package/dist/materializer/index.js +13 -13
- package/dist/models/execution/index.js +10 -10
- package/dist/objects/index.js +24 -24
- package/dist/objects/query/index.js +12 -12
- package/dist/objects/vectors/handle.d.ts.map +1 -1
- package/dist/objects/vectors/profile.d.ts +5 -0
- package/dist/objects/vectors/profile.d.ts.map +1 -1
- package/dist/ontology/index.js +3 -3
- package/dist/pipelines/index.js +15 -15
- package/dist/projections/internal.js +13 -13
- package/dist/runtime/internal.js +13 -13
- package/dist/security/builders.d.ts.map +1 -1
- package/dist/security/every.d.ts +1 -4
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +2 -4
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/membership-policies.d.ts.map +1 -1
- package/dist/security/public.d.ts +10 -0
- package/dist/security/public.d.ts.map +1 -0
- package/dist/security/public.js +10 -0
- package/dist/security/public.js.map +9 -0
- package/dist/security/registry.d.ts +0 -1
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +13 -18
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +0 -6
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/internal.js +10 -10
- package/dist/storage/agents/types.d.ts +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/magic-links.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/oidc-attempts.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/sessions.d.ts +0 -10
- package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/shared.d.ts +1 -2
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +1 -17
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +6 -6
- package/dist/storage/index.js +21 -21
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/workflow-runs/provider.js +6 -6
- package/dist/syncs/index.js +16 -16
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.js +41 -124
- package/dist/testing/index.js.map +4 -4
- package/dist/webhooks/internal.js +11 -11
- package/dist/workflows/index.js +25 -25
- package/package.json +8 -2
- package/src/auth/cookies.ts +3 -20
- package/src/auth/index.ts +0 -6
- package/src/auth/runtime.ts +59 -76
- package/src/auth/session-cache.ts +2 -9
- package/src/auth/types.ts +4 -8
- package/src/auth/validation.ts +0 -2
- package/src/authorization/decision.ts +8 -23
- package/src/authorization/grant-kinds.ts +20 -27
- package/src/authorization/index.ts +0 -1
- package/src/authorization/resolve.ts +10 -6
- package/src/deploy/services.ts +0 -1
- package/src/deploy/types.ts +1 -2
- package/src/deploy/validation.ts +3 -1
- package/src/execution/authorization.ts +11 -5
- package/src/index.ts +1 -14
- package/src/models/execution/embedding.ts +6 -6
- package/src/objects/vectors/README.md +4 -0
- package/src/objects/vectors/handle.ts +11 -2
- package/src/objects/vectors/indexing-generate.ts +2 -2
- package/src/objects/vectors/profile.ts +5 -0
- package/src/security/builders.ts +7 -2
- package/src/security/every.ts +0 -4
- package/src/security/grants.ts +5 -25
- package/src/security/index.ts +0 -3
- package/src/security/membership-policies.ts +3 -1
- package/src/security/public.ts +10 -0
- package/src/security/registry.ts +0 -8
- package/src/security/types.ts +19 -25
- package/src/security/validation.ts +19 -17
- package/src/storage/agents/types.ts +1 -1
- package/src/storage/auth/in-memory/auth-storage.ts +0 -18
- package/src/storage/auth/in-memory/magic-links.ts +0 -3
- package/src/storage/auth/in-memory/oidc-attempts.ts +0 -3
- package/src/storage/auth/in-memory/sessions.ts +1 -25
- package/src/storage/auth/in-memory/shared.ts +1 -10
- package/src/storage/auth/types.ts +2 -18
- package/src/testing/auth-storage-contract.ts +14 -107
- package/src/testing/execution-storage-contract.ts +0 -2
- package/dist/auth/audience.d.ts +0 -8
- package/dist/auth/audience.d.ts.map +0 -1
- package/dist/authorization/application-access.d.ts +0 -18
- package/dist/authorization/application-access.d.ts.map +0 -1
- package/dist/chunk-2jntasmh.js.map +0 -13
- package/dist/chunk-3gnrh4ve.js.map +0 -40
- package/dist/chunk-enpsx8k5.js.map +0 -10
- package/dist/chunk-kyzq4wy9.js.map +0 -18
- package/dist/chunk-xt1zt7gv.js.map +0 -13
- package/dist/chunk-y7rqfrgg.js.map +0 -24
- package/dist/security/applications.d.ts +0 -15
- package/dist/security/applications.d.ts.map +0 -1
- package/src/auth/audience.ts +0 -28
- package/src/authorization/application-access.ts +0 -34
- package/src/security/applications.ts +0 -11
- /package/dist/{chunk-rz53yb4v.js.map → chunk-0yh890a4.js.map} +0 -0
- /package/dist/{chunk-7mbzgd9m.js.map → chunk-1zq2p6g0.js.map} +0 -0
- /package/dist/{chunk-dnmadg9k.js.map → chunk-3t2hgbgd.js.map} +0 -0
- /package/dist/{chunk-wwdfe68s.js.map → chunk-4vyr1j8f.js.map} +0 -0
- /package/dist/{chunk-q1vkr2ys.js.map → chunk-6p49a5cq.js.map} +0 -0
- /package/dist/{chunk-nre82s12.js.map → chunk-9dmt152s.js.map} +0 -0
- /package/dist/{chunk-7kg3k1m9.js.map → chunk-9w055r5b.js.map} +0 -0
- /package/dist/{chunk-bpgy64fw.js.map → chunk-d09tj99x.js.map} +0 -0
- /package/dist/{chunk-rhg02hxq.js.map → chunk-dk8tkk5f.js.map} +0 -0
- /package/dist/{chunk-52bk93x8.js.map → chunk-fkgc1wt8.js.map} +0 -0
- /package/dist/{chunk-zrmy8zvw.js.map → chunk-hjzdd750.js.map} +0 -0
- /package/dist/{chunk-85yvv5n0.js.map → chunk-k6q3n2sc.js.map} +0 -0
- /package/dist/{chunk-80mc0971.js.map → chunk-ren4kg2j.js.map} +0 -0
- /package/dist/{chunk-1f7wpmyp.js.map → chunk-rrzt8jdy.js.map} +0 -0
- /package/dist/{chunk-6gmfggss.js.map → chunk-t7x8dmn0.js.map} +0 -0
- /package/dist/{chunk-wz0xs816.js.map → chunk-tg2cw67r.js.map} +0 -0
- /package/dist/{chunk-bwjcehza.js.map → chunk-way52z4h.js.map} +0 -0
- /package/dist/{chunk-tjb1mk5t.js.map → chunk-x6m907x7.js.map} +0 -0
- /package/dist/{chunk-t6vq7bff.js.map → chunk-xfs8x8m9.js.map} +0 -0
- /package/dist/{chunk-d2ync1v3.js.map → chunk-yevzdx4y.js.map} +0 -0
- /package/dist/{chunk-kg5j6fct.js.map → chunk-z4m0yz8c.js.map} +0 -0
|
@@ -13,31 +13,31 @@ import {
|
|
|
13
13
|
ShareDefinitionError2,
|
|
14
14
|
isShareDefinition,
|
|
15
15
|
snapshotShareDefinition
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-vpq4shxz.js";
|
|
17
17
|
import {
|
|
18
18
|
isProjectionDefinition2
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-d0bqz29d.js";
|
|
20
20
|
import {
|
|
21
21
|
isMarkingDefinition,
|
|
22
22
|
isGroupDefinition,
|
|
23
23
|
isMembershipPolicyDefinition,
|
|
24
24
|
isRoleDefinition
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-es1gxsbf.js";
|
|
26
26
|
import {
|
|
27
27
|
isWorkflowDefinition2
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6c6sn0bh.js";
|
|
29
29
|
import {
|
|
30
30
|
isDatasetDefinition2
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-0yh890a4.js";
|
|
32
32
|
import {
|
|
33
33
|
isPipelineDefinition2
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-x6m907x7.js";
|
|
35
35
|
import {
|
|
36
36
|
isSyncDefinition2
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-dk8tkk5f.js";
|
|
38
38
|
import {
|
|
39
39
|
compileShareAccessPlan
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-fkgc1wt8.js";
|
|
41
41
|
import {
|
|
42
42
|
RuntimeError2
|
|
43
43
|
} from "./chunk-m4ehq95f.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
AuthStorageError2,
|
|
4
4
|
SYSTEM_PRINCIPAL2,
|
|
5
5
|
principalsEqual2
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-vpq4shxz.js";
|
|
7
7
|
import {
|
|
8
8
|
createSixbError2
|
|
9
9
|
} from "./chunk-8mx7qw3y.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
agentServiceAccountId2,
|
|
12
12
|
AuthorizationError2,
|
|
13
13
|
resolveAuthorizationContext2
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-d0bqz29d.js";
|
|
15
15
|
import {
|
|
16
16
|
findPrimitiveRunExecution,
|
|
17
17
|
findAgentRunExecution
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-jhm3zsa7.js";
|
|
6
6
|
import {
|
|
7
7
|
getDatasetRowValidationFailure
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-0yh890a4.js";
|
|
9
9
|
import {
|
|
10
10
|
getDatasetMergeChangeValidationError2
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-way52z4h.js";
|
|
12
12
|
|
|
13
13
|
// src/datasets/write.ts
|
|
14
14
|
function lakeDatasetDefinition2(dataset) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
canAccessApplication2,
|
|
4
3
|
resolveRoleGrants2,
|
|
5
4
|
resolveAuthorizationContext2
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-d0bqz29d.js";
|
|
7
6
|
import {
|
|
8
7
|
assertValidFileRefs2
|
|
9
8
|
} from "./chunk-hvsb78a1.js";
|
|
@@ -13,19 +12,16 @@ import {
|
|
|
13
12
|
canPerformMembershipOperation,
|
|
14
13
|
missingMembershipGroupIds,
|
|
15
14
|
validateSecurityDefinitionsAtStartup
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-es1gxsbf.js";
|
|
17
16
|
import {
|
|
18
|
-
AuthRuntimeError2,
|
|
19
|
-
DEFAULT_AUTH_SESSION_AUDIENCE2,
|
|
20
|
-
resolveAuthSessionAudience2,
|
|
21
|
-
resolveAuthCookieOptionsForAudience,
|
|
22
17
|
getCookie2,
|
|
18
|
+
AuthRuntimeError2,
|
|
23
19
|
resolveAuthConfig2,
|
|
24
20
|
resolveInvitationExpiresAt,
|
|
25
21
|
assertNonEmpty3,
|
|
26
22
|
normalizePagination,
|
|
27
23
|
isInvitationDeliveryAuthStrategy2
|
|
28
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-hcbyfxbe.js";
|
|
29
25
|
import {
|
|
30
26
|
normalizeParams,
|
|
31
27
|
coerceParamsToTyped
|
|
@@ -161,13 +157,6 @@ function safeEqual(left, right) {
|
|
|
161
157
|
}
|
|
162
158
|
// src/auth/runtime.ts
|
|
163
159
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
164
|
-
|
|
165
|
-
// src/security/applications.ts
|
|
166
|
-
var applications2 = {
|
|
167
|
-
atlas: { kind: "application", id: "atlas", label: "Atlas" },
|
|
168
|
-
app: { kind: "application", id: "app", label: "Custom app" }
|
|
169
|
-
};
|
|
170
|
-
var APPLICATION_IDS = new Set(Object.values(applications2).map((application) => application.id));
|
|
171
160
|
// src/security/every.ts
|
|
172
161
|
var BREADTH_TARGETS = [
|
|
173
162
|
"object",
|
|
@@ -176,7 +165,6 @@ var BREADTH_TARGETS = [
|
|
|
176
165
|
"workflow",
|
|
177
166
|
"sync",
|
|
178
167
|
"pipeline",
|
|
179
|
-
"application",
|
|
180
168
|
"connector",
|
|
181
169
|
"share"
|
|
182
170
|
];
|
|
@@ -211,7 +199,6 @@ var every2 = {
|
|
|
211
199
|
workflow: () => all("workflow"),
|
|
212
200
|
sync: () => all("sync"),
|
|
213
201
|
pipeline: () => all("pipeline"),
|
|
214
|
-
application: () => all("application"),
|
|
215
202
|
connector: () => all("connector"),
|
|
216
203
|
share: () => all("share")
|
|
217
204
|
};
|
|
@@ -574,7 +561,6 @@ var TARGET_BY_DEFINITION_KIND = {
|
|
|
574
561
|
sync: "sync",
|
|
575
562
|
pipeline: "pipeline",
|
|
576
563
|
workflow: "workflow",
|
|
577
|
-
application: "application",
|
|
578
564
|
connector: "connector",
|
|
579
565
|
share: "share"
|
|
580
566
|
};
|
|
@@ -622,10 +608,6 @@ function resolveGrant(input, label, allowedTargets) {
|
|
|
622
608
|
const ids = [...new Set(items.map((item) => definitionIdOf(item, label)))];
|
|
623
609
|
return { target, selection: { all: false, ids } };
|
|
624
610
|
}
|
|
625
|
-
function access(input) {
|
|
626
|
-
const { selection } = resolveGrant(input, "can.access", ["application"]);
|
|
627
|
-
return { kind: "grant", capability: "access", target: "application", selection };
|
|
628
|
-
}
|
|
629
611
|
function view(input) {
|
|
630
612
|
if (isShareTarget(input))
|
|
631
613
|
return createShareViewGrant(input);
|
|
@@ -687,22 +669,11 @@ function observe(input) {
|
|
|
687
669
|
if (input !== "logs" && !isAgentUsageReference(input)) {
|
|
688
670
|
throw new SecurityValidationError2('[Sixb] can.observe accepts "logs" or agent.usage.');
|
|
689
671
|
}
|
|
690
|
-
|
|
691
|
-
return {
|
|
692
|
-
kind: "grant",
|
|
693
|
-
capability: "observe",
|
|
694
|
-
target,
|
|
695
|
-
selection: { all: false, ids: [target] }
|
|
696
|
-
};
|
|
672
|
+
return { kind: "grant", capability: "observe", target: input === "logs" ? "logs" : "aiUsage" };
|
|
697
673
|
}
|
|
698
674
|
function manage(input) {
|
|
699
675
|
if (isAgentUsageReference(input)) {
|
|
700
|
-
return {
|
|
701
|
-
kind: "grant",
|
|
702
|
-
capability: "manage",
|
|
703
|
-
target: "aiUsage",
|
|
704
|
-
selection: { all: false, ids: ["aiUsage"] }
|
|
705
|
-
};
|
|
676
|
+
return { kind: "grant", capability: "manage", target: "aiUsage" };
|
|
706
677
|
}
|
|
707
678
|
return {
|
|
708
679
|
kind: "grant",
|
|
@@ -712,7 +683,6 @@ function manage(input) {
|
|
|
712
683
|
};
|
|
713
684
|
}
|
|
714
685
|
var can2 = {
|
|
715
|
-
access,
|
|
716
686
|
view,
|
|
717
687
|
edit,
|
|
718
688
|
append,
|
|
@@ -735,7 +705,6 @@ class SecurityRegistry {
|
|
|
735
705
|
groups: input.groups ?? [],
|
|
736
706
|
roles: input.roles ?? [],
|
|
737
707
|
membershipPolicies: input.membershipPolicies ?? [],
|
|
738
|
-
applicationIds: input.applicationIds ?? APPLICATION_IDS,
|
|
739
708
|
objectTypeIds: input.objectTypeIds,
|
|
740
709
|
datasetIds: input.datasetIds,
|
|
741
710
|
actionIds: input.actionIds,
|
|
@@ -744,12 +713,9 @@ class SecurityRegistry {
|
|
|
744
713
|
pipelineIds: input.pipelineIds,
|
|
745
714
|
agentAvailable: input.agentAvailable,
|
|
746
715
|
connectorIds: input.connectorIds,
|
|
747
|
-
observableIds: new Set(["logs", "aiUsage"]),
|
|
748
|
-
manageableIds: new Set(["aiUsage"]),
|
|
749
716
|
shareIds: input.shareIds
|
|
750
717
|
});
|
|
751
718
|
const universe = {
|
|
752
|
-
applicationIds: input.applicationIds ?? APPLICATION_IDS,
|
|
753
719
|
objectTypeIds: input.objectTypeIds ?? new Set,
|
|
754
720
|
datasetIds: input.datasetIds ?? new Set,
|
|
755
721
|
actionIds: input.actionIds ?? new Set,
|
|
@@ -757,8 +723,6 @@ class SecurityRegistry {
|
|
|
757
723
|
syncIds: input.syncIds ?? new Set,
|
|
758
724
|
pipelineIds: input.pipelineIds ?? new Set,
|
|
759
725
|
connectorIds: input.connectorIds ?? new Set,
|
|
760
|
-
observableIds: new Set(["logs", "aiUsage"]),
|
|
761
|
-
manageableIds: new Set(["aiUsage"]),
|
|
762
726
|
shareIds: input.shareIds ?? new Set,
|
|
763
727
|
getSubTypes: input.getSubTypes ?? (() => [])
|
|
764
728
|
};
|
|
@@ -926,15 +890,12 @@ function getActiveInvitationByEmail(state, projectId, email, now) {
|
|
|
926
890
|
const invitations = [...state.invitations.values()].filter((invitation) => invitation.projectId === projectId).filter((invitation) => invitation.email === normalizedEmail).filter((invitation) => isActiveInvitation(invitation, now)).sort((a, b) => compareByCreatedAt(a, b, "desc"));
|
|
927
891
|
return invitations[0] ?? null;
|
|
928
892
|
}
|
|
929
|
-
function revokeActiveSessionsForUser(state, projectId, userId, revokedAt
|
|
893
|
+
function revokeActiveSessionsForUser(state, projectId, userId, revokedAt) {
|
|
930
894
|
const revoked = [];
|
|
931
895
|
for (const [key, session] of state.sessions) {
|
|
932
896
|
if (session.projectId !== projectId || session.userId !== userId) {
|
|
933
897
|
continue;
|
|
934
898
|
}
|
|
935
|
-
if (audience !== undefined && session.audience !== audience) {
|
|
936
|
-
continue;
|
|
937
|
-
}
|
|
938
899
|
if (!isActiveSession(session, revokedAt)) {
|
|
939
900
|
continue;
|
|
940
901
|
}
|
|
@@ -973,7 +934,6 @@ function assertSessionIdAvailable(state, projectId, sessionId) {
|
|
|
973
934
|
}
|
|
974
935
|
function validateCompleteSessionInput(state, projectId, session) {
|
|
975
936
|
const sessionId = assertNonEmpty4(session.id, "Session id");
|
|
976
|
-
assertNonEmpty4(session.audience, "Session audience");
|
|
977
937
|
assertNonEmpty4(session.tokenHash, "Session token hash");
|
|
978
938
|
assertSessionIdAvailable(state, projectId, sessionId);
|
|
979
939
|
}
|
|
@@ -982,7 +942,6 @@ function createSessionRecord(state, input) {
|
|
|
982
942
|
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
983
943
|
const userId = assertNonEmpty4(input.userId, "User id");
|
|
984
944
|
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
985
|
-
const audience = resolveAuthSessionAudience2(input.audience);
|
|
986
945
|
const tokenHash = assertNonEmpty4(input.tokenHash, "Session token hash");
|
|
987
946
|
assertSessionIdAvailable(state, projectId, id);
|
|
988
947
|
const session = {
|
|
@@ -990,7 +949,6 @@ function createSessionRecord(state, input) {
|
|
|
990
949
|
projectId,
|
|
991
950
|
userId,
|
|
992
951
|
strategyId,
|
|
993
|
-
audience,
|
|
994
952
|
tokenHash,
|
|
995
953
|
createdAt: cloneDate(input.createdAt),
|
|
996
954
|
expiresAt: cloneDate(input.expiresAt),
|
|
@@ -1510,7 +1468,6 @@ class InMemoryAuthMagicLinkStore {
|
|
|
1510
1468
|
const id = assertNonEmpty4(input.id, "Magic link id");
|
|
1511
1469
|
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1512
1470
|
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
1513
|
-
const audience = resolveAuthSessionAudience2(input.audience);
|
|
1514
1471
|
const email = normalizeEmail(input.email);
|
|
1515
1472
|
const tokenHash = assertNonEmpty4(input.tokenHash, "Magic link token hash");
|
|
1516
1473
|
const key = magicLinkKey(projectId, id);
|
|
@@ -1522,7 +1479,6 @@ class InMemoryAuthMagicLinkStore {
|
|
|
1522
1479
|
id,
|
|
1523
1480
|
projectId,
|
|
1524
1481
|
strategyId,
|
|
1525
|
-
audience,
|
|
1526
1482
|
email,
|
|
1527
1483
|
tokenHash,
|
|
1528
1484
|
returnTo: input.returnTo,
|
|
@@ -1559,7 +1515,6 @@ class InMemoryAuthOidcAuthorizationAttemptStore {
|
|
|
1559
1515
|
const id = assertNonEmpty4(input.id, "OIDC authorization attempt id");
|
|
1560
1516
|
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1561
1517
|
const strategyId = assertNonEmpty4(input.strategyId, "Strategy id");
|
|
1562
|
-
const audience = resolveAuthSessionAudience2(input.audience);
|
|
1563
1518
|
const stateHash = assertNonEmpty4(input.stateHash, "OIDC state hash");
|
|
1564
1519
|
const nonceHash = assertNonEmpty4(input.nonceHash, "OIDC nonce hash");
|
|
1565
1520
|
const codeVerifier = assertNonEmpty4(input.codeVerifier, "OIDC code verifier");
|
|
@@ -1571,7 +1526,6 @@ class InMemoryAuthOidcAuthorizationAttemptStore {
|
|
|
1571
1526
|
id,
|
|
1572
1527
|
projectId,
|
|
1573
1528
|
strategyId,
|
|
1574
|
-
audience,
|
|
1575
1529
|
stateHash,
|
|
1576
1530
|
nonceHash,
|
|
1577
1531
|
codeVerifier,
|
|
@@ -1697,10 +1651,6 @@ class InMemoryAuthSessionStore {
|
|
|
1697
1651
|
const record = this.state.sessions.get(sessionKey(params.projectId, params.id)) ?? null;
|
|
1698
1652
|
return cloneOptionalRecord(record);
|
|
1699
1653
|
}
|
|
1700
|
-
async getActiveByUserId(params) {
|
|
1701
|
-
const sessions = [...this.state.sessions.values()].filter((session) => session.projectId === params.projectId).filter((session) => session.userId === params.userId).filter((session) => session.audience === params.audience).filter((session) => isActiveSession(session, params.now)).sort((a, b) => compareByCreatedAt(a, b, "desc"));
|
|
1702
|
-
return cloneOptionalRecord(sessions[0] ?? null);
|
|
1703
|
-
}
|
|
1704
1654
|
async listActiveByUserId(params) {
|
|
1705
1655
|
return [...this.state.sessions.values()].filter((session) => session.projectId === params.projectId).filter((session) => session.userId === params.userId).filter((session) => isActiveSession(session, params.now)).sort((a, b) => {
|
|
1706
1656
|
const activity = (b.lastSeenAt ?? b.createdAt).getTime() - (a.lastSeenAt ?? a.createdAt).getTime();
|
|
@@ -1712,7 +1662,7 @@ class InMemoryAuthSessionStore {
|
|
|
1712
1662
|
}
|
|
1713
1663
|
async findValidByTokenHash(params) {
|
|
1714
1664
|
const session = this.state.sessions.get(sessionKey(params.projectId, params.id));
|
|
1715
|
-
if (!session || session.bearer || session.
|
|
1665
|
+
if (!session || session.bearer || session.tokenHash !== params.tokenHash || !isActiveSession(session, params.now)) {
|
|
1716
1666
|
return null;
|
|
1717
1667
|
}
|
|
1718
1668
|
return cloneRecord(session);
|
|
@@ -1759,7 +1709,7 @@ class InMemoryAuthSessionStore {
|
|
|
1759
1709
|
async renewIfValid(params) {
|
|
1760
1710
|
const key = sessionKey(params.projectId, params.id);
|
|
1761
1711
|
const session = this.state.sessions.get(key);
|
|
1762
|
-
if (!session || session.bearer || session.
|
|
1712
|
+
if (!session || session.bearer || session.tokenHash !== params.tokenHash || !isActiveSession(session, params.now)) {
|
|
1763
1713
|
return null;
|
|
1764
1714
|
}
|
|
1765
1715
|
const requestedExpiresAt = session.absoluteExpiresAt ? new Date(Math.min(params.expiresAt.getTime(), session.absoluteExpiresAt.getTime())) : params.expiresAt;
|
|
@@ -1785,7 +1735,7 @@ class InMemoryAuthSessionStore {
|
|
|
1785
1735
|
return cloneRecord(next);
|
|
1786
1736
|
}
|
|
1787
1737
|
async revokeActiveForUser(params) {
|
|
1788
|
-
return revokeActiveSessionsForUser(this.state, params.projectId, params.userId, params.revokedAt
|
|
1738
|
+
return revokeActiveSessionsForUser(this.state, params.projectId, params.userId, params.revokedAt).map(cloneRecord);
|
|
1789
1739
|
}
|
|
1790
1740
|
async touch(params) {
|
|
1791
1741
|
const key = sessionKey(params.projectId, params.id);
|
|
@@ -1993,7 +1943,6 @@ class InMemoryAuthStorage2 {
|
|
|
1993
1943
|
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
|
|
1994
1944
|
}
|
|
1995
1945
|
validateCompleteSessionInput(this.state, projectId, input.session);
|
|
1996
|
-
assertSignInSessionAudience(projectId, input.session.audience, magicLink.audience);
|
|
1997
1946
|
let newUserId;
|
|
1998
1947
|
if (shouldCreateUser) {
|
|
1999
1948
|
newUserId = assertNonEmpty4(input.newUserId, "User id");
|
|
@@ -2082,7 +2031,6 @@ class InMemoryAuthStorage2 {
|
|
|
2082
2031
|
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
|
|
2083
2032
|
}
|
|
2084
2033
|
validateCompleteSessionInput(this.state, projectId, input.session);
|
|
2085
|
-
assertSignInSessionAudience(projectId, input.session.audience, attempt.audience);
|
|
2086
2034
|
let newUserId;
|
|
2087
2035
|
if (shouldCreateUser) {
|
|
2088
2036
|
newUserId = assertNonEmpty4(input.newUserId, "User id");
|
|
@@ -2213,7 +2161,6 @@ class InMemoryAuthStorage2 {
|
|
|
2213
2161
|
projectId: input.projectId,
|
|
2214
2162
|
userId: input.userId,
|
|
2215
2163
|
strategyId: input.strategyId,
|
|
2216
|
-
audience: input.session.audience,
|
|
2217
2164
|
tokenHash: input.session.tokenHash,
|
|
2218
2165
|
createdAt: input.session.createdAt,
|
|
2219
2166
|
expiresAt: input.session.expiresAt,
|
|
@@ -2237,12 +2184,6 @@ function restoreMap(target, snapshot) {
|
|
|
2237
2184
|
target.set(key, value);
|
|
2238
2185
|
}
|
|
2239
2186
|
}
|
|
2240
|
-
function assertSignInSessionAudience(projectId, sessionAudience, storedAudience) {
|
|
2241
|
-
if (sessionAudience === storedAudience) {
|
|
2242
|
-
return;
|
|
2243
|
-
}
|
|
2244
|
-
throw new AuthStorageError2("invalid_input", `[Sixb] Sign-in session audience '${sessionAudience}' does not match stored auth audience '${storedAudience}' for project '${projectId}'.`);
|
|
2245
|
-
}
|
|
2246
2187
|
// src/auth/session-cache.ts
|
|
2247
2188
|
class SessionCache {
|
|
2248
2189
|
ttlMs;
|
|
@@ -2257,7 +2198,7 @@ class SessionCache {
|
|
|
2257
2198
|
if (!entry) {
|
|
2258
2199
|
return;
|
|
2259
2200
|
}
|
|
2260
|
-
if (entry.expiresAtMs <= input.nowMs || entry.tokenHash !== input.tokenHash || entry.transport !== input.transport
|
|
2201
|
+
if (entry.expiresAtMs <= input.nowMs || entry.tokenHash !== input.tokenHash || entry.transport !== input.transport) {
|
|
2261
2202
|
this.entries.delete(input.sessionId);
|
|
2262
2203
|
return;
|
|
2263
2204
|
}
|
|
@@ -2273,7 +2214,6 @@ class SessionCache {
|
|
|
2273
2214
|
this.entries.set(input.sessionId, {
|
|
2274
2215
|
tokenHash: input.tokenHash,
|
|
2275
2216
|
transport: bearer ? "bearer" : "cookie",
|
|
2276
|
-
audience: input.audience,
|
|
2277
2217
|
session: input.session,
|
|
2278
2218
|
expiresAtMs
|
|
2279
2219
|
});
|
|
@@ -2387,8 +2327,8 @@ class AuthRuntime2 {
|
|
|
2387
2327
|
...absoluteTimeoutMs === undefined ? {} : { absoluteExpiresAt: new Date(now.getTime() + absoluteTimeoutMs) }
|
|
2388
2328
|
};
|
|
2389
2329
|
}
|
|
2390
|
-
getCookieOptions(
|
|
2391
|
-
return
|
|
2330
|
+
getCookieOptions() {
|
|
2331
|
+
return this.config.cookies;
|
|
2392
2332
|
}
|
|
2393
2333
|
assertCanServeHttp(params) {
|
|
2394
2334
|
const strategy = this.config.strategy;
|
|
@@ -2409,7 +2349,6 @@ class AuthRuntime2 {
|
|
|
2409
2349
|
if (!this.isEnabled()) {
|
|
2410
2350
|
return { authenticated: false, reason: "auth_disabled" };
|
|
2411
2351
|
}
|
|
2412
|
-
const audience = resolveAuthSessionAudience2(options.audience);
|
|
2413
2352
|
if (options.credentialSource === "any") {
|
|
2414
2353
|
const tokenValue = getBearerAccessTokenValue2(request);
|
|
2415
2354
|
if (tokenValue?.startsWith(SESSION_ACCESS_TOKEN_PREFIX)) {
|
|
@@ -2422,10 +2361,10 @@ class AuthRuntime2 {
|
|
|
2422
2361
|
return { authenticated: false, reason: "invalid_access_token" };
|
|
2423
2362
|
}
|
|
2424
2363
|
}
|
|
2425
|
-
return this.resolveCookieSession(request,
|
|
2364
|
+
return this.resolveCookieSession(request, options.sessionActivity);
|
|
2426
2365
|
}
|
|
2427
|
-
async resolveCookieSession(request,
|
|
2428
|
-
const cookieOptions = this.getCookieOptions(
|
|
2366
|
+
async resolveCookieSession(request, activity) {
|
|
2367
|
+
const cookieOptions = this.getCookieOptions();
|
|
2429
2368
|
const cookieValue = getCookie2(request, cookieOptions.sessionCookieName);
|
|
2430
2369
|
if (!cookieValue) {
|
|
2431
2370
|
return { authenticated: false, reason: "missing_cookie" };
|
|
@@ -2440,7 +2379,6 @@ class AuthRuntime2 {
|
|
|
2440
2379
|
sessionId: parts.sessionId,
|
|
2441
2380
|
tokenHash,
|
|
2442
2381
|
transport: "cookie",
|
|
2443
|
-
audience,
|
|
2444
2382
|
nowMs
|
|
2445
2383
|
});
|
|
2446
2384
|
if (cached) {
|
|
@@ -2454,7 +2392,6 @@ class AuthRuntime2 {
|
|
|
2454
2392
|
let session = await storage.sessions.findValidByTokenHash({
|
|
2455
2393
|
projectId: this.projectId,
|
|
2456
2394
|
id: parts.sessionId,
|
|
2457
|
-
audience,
|
|
2458
2395
|
tokenHash,
|
|
2459
2396
|
now
|
|
2460
2397
|
});
|
|
@@ -2466,7 +2403,6 @@ class AuthRuntime2 {
|
|
|
2466
2403
|
const renewed = await storage.sessions.renewIfValid({
|
|
2467
2404
|
projectId: this.projectId,
|
|
2468
2405
|
id: parts.sessionId,
|
|
2469
|
-
audience,
|
|
2470
2406
|
tokenHash,
|
|
2471
2407
|
now,
|
|
2472
2408
|
expiresAt: this.getRenewedSessionExpiresAt(session, nowMs)
|
|
@@ -2529,7 +2465,6 @@ class AuthRuntime2 {
|
|
|
2529
2465
|
this.sessionCache?.set({
|
|
2530
2466
|
sessionId: session.id,
|
|
2531
2467
|
tokenHash,
|
|
2532
|
-
audience: session.audience,
|
|
2533
2468
|
session: result,
|
|
2534
2469
|
nowMs: now.getTime(),
|
|
2535
2470
|
sessionExpiresAtMs: session.expiresAt.getTime(),
|
|
@@ -2547,7 +2482,6 @@ class AuthRuntime2 {
|
|
|
2547
2482
|
projectId: this.projectId,
|
|
2548
2483
|
userId: input.userId,
|
|
2549
2484
|
strategyId: "device",
|
|
2550
|
-
audience: DEFAULT_AUTH_SESSION_AUDIENCE2,
|
|
2551
2485
|
tokenHash: tokens.tokenHash,
|
|
2552
2486
|
createdAt: input.now,
|
|
2553
2487
|
...this.createSessionDeadlines(input.now),
|
|
@@ -2749,6 +2683,10 @@ class AuthRuntime2 {
|
|
|
2749
2683
|
}
|
|
2750
2684
|
async listServiceAccounts(caller) {
|
|
2751
2685
|
const storage = this.requireAuthStorage();
|
|
2686
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
2687
|
+
if (scope.operations.serviceAccounts.policyIds.length === 0) {
|
|
2688
|
+
return { serviceAccounts: [] };
|
|
2689
|
+
}
|
|
2752
2690
|
const result = await storage.serviceAccounts.list({
|
|
2753
2691
|
projectId: this.projectId,
|
|
2754
2692
|
order: "desc",
|
|
@@ -2759,14 +2697,13 @@ class AuthRuntime2 {
|
|
|
2759
2697
|
groupIds: await this.listServiceAccountGroupIds(storage, serviceAccount.id)
|
|
2760
2698
|
})));
|
|
2761
2699
|
return {
|
|
2762
|
-
serviceAccounts: withGroups.filter(({ groupIds }) =>
|
|
2700
|
+
serviceAccounts: withGroups.filter(({ groupIds }) => canPerformMembershipOperation(scope, "serviceAccounts", groupIds))
|
|
2763
2701
|
};
|
|
2764
2702
|
}
|
|
2765
2703
|
async createServiceAccount(caller, input) {
|
|
2766
2704
|
const storage = this.requireAuthStorage();
|
|
2767
|
-
const groupIds =
|
|
2768
|
-
|
|
2769
|
-
}) ?? [];
|
|
2705
|
+
const groupIds = normalizeRequestedGroupIds(input.groupIds) ?? [];
|
|
2706
|
+
this.assertCanManageServiceAccountGroups(caller.groupIds, groupIds);
|
|
2770
2707
|
const now = new Date;
|
|
2771
2708
|
const serviceAccount = await storage.serviceAccounts.create({
|
|
2772
2709
|
id: input.id ?? `svc_${randomUUID3()}`,
|
|
@@ -2858,12 +2795,16 @@ class AuthRuntime2 {
|
|
|
2858
2795
|
return { serviceAccount, accessToken };
|
|
2859
2796
|
}
|
|
2860
2797
|
async requireManageableServiceAccount(storage, callerGroupIds, serviceAccountId) {
|
|
2798
|
+
const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds);
|
|
2799
|
+
if (scope.operations.serviceAccounts.policyIds.length === 0) {
|
|
2800
|
+
throw missingServiceAccountsPolicyError();
|
|
2801
|
+
}
|
|
2861
2802
|
const serviceAccount = await storage.serviceAccounts.getById({
|
|
2862
2803
|
projectId: this.projectId,
|
|
2863
2804
|
id: serviceAccountId
|
|
2864
2805
|
});
|
|
2865
2806
|
const groupIds = serviceAccount ? await this.listServiceAccountGroupIds(storage, serviceAccountId) : [];
|
|
2866
|
-
if (!serviceAccount || !
|
|
2807
|
+
if (!serviceAccount || !canPerformMembershipOperation(scope, "serviceAccounts", groupIds)) {
|
|
2867
2808
|
throw new AuthStorageError2("missing_service_account", `[Sixb] Service account '${serviceAccountId}' not found for project '${this.projectId}'.`);
|
|
2868
2809
|
}
|
|
2869
2810
|
return { serviceAccount, groupIds };
|
|
@@ -2897,6 +2838,7 @@ class AuthRuntime2 {
|
|
|
2897
2838
|
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
2898
2839
|
return {
|
|
2899
2840
|
groups: this.scopedGroupOptions(scope.operations.assignGroups.groupIds),
|
|
2841
|
+
serviceAccountGroups: this.scopedGroupOptions(scope.operations.serviceAccounts.groupIds),
|
|
2900
2842
|
capabilities: membershipCapabilities(scope).holds
|
|
2901
2843
|
};
|
|
2902
2844
|
}
|
|
@@ -3069,7 +3011,6 @@ class AuthRuntime2 {
|
|
|
3069
3011
|
throw new AuthRuntimeError2("invalid_auth_config", "[Sixb] The active auth strategy does not support invitations.");
|
|
3070
3012
|
}
|
|
3071
3013
|
await this.assertCanInviteRecipient(strategy, authStorage, input.email, now);
|
|
3072
|
-
this.assertInvitationApplicationAccess(groupIds, destination.audience);
|
|
3073
3014
|
const invitation = await authStorage.invitations.createOrUpdateActive({
|
|
3074
3015
|
id: `inv_${randomUUID3()}`,
|
|
3075
3016
|
projectId: this.projectId,
|
|
@@ -3087,7 +3028,6 @@ class AuthRuntime2 {
|
|
|
3087
3028
|
projectId: this.projectId,
|
|
3088
3029
|
authStorage,
|
|
3089
3030
|
invitation,
|
|
3090
|
-
audience: destination.audience,
|
|
3091
3031
|
returnTo: destination.returnTo,
|
|
3092
3032
|
requestOrigin: destination.requestOrigin,
|
|
3093
3033
|
revealLink: input.revealLink,
|
|
@@ -3184,17 +3124,6 @@ class AuthRuntime2 {
|
|
|
3184
3124
|
}
|
|
3185
3125
|
return { state: "enabled" };
|
|
3186
3126
|
}
|
|
3187
|
-
assertInvitationApplicationAccess(groupIds, audience) {
|
|
3188
|
-
const roles = this.security.listResolvedRoles();
|
|
3189
|
-
const authorization = resolveAuthorizationContext2({
|
|
3190
|
-
principal: { type: "user", id: "invited-user" },
|
|
3191
|
-
groupIds,
|
|
3192
|
-
roles
|
|
3193
|
-
});
|
|
3194
|
-
if (canAccessApplication2(authorization, roles, audience))
|
|
3195
|
-
return;
|
|
3196
|
-
throw new AuthRuntimeError2("authorization_denied", `[Sixb] Invitation groups do not grant access to application '${audience}'.`);
|
|
3197
|
-
}
|
|
3198
3127
|
async assertCanInviteRecipient(strategy, authStorage, email, now) {
|
|
3199
3128
|
if (!strategy.validateInvitationRecipient) {
|
|
3200
3129
|
return;
|
|
@@ -3223,6 +3152,17 @@ class AuthRuntime2 {
|
|
|
3223
3152
|
}
|
|
3224
3153
|
return new AuthRuntimeError2("invalid_auth_input", "[Sixb] Invitation delivery was skipped by the active auth strategy.");
|
|
3225
3154
|
}
|
|
3155
|
+
assertCanManageServiceAccountGroups(callerGroupIds, groupIds) {
|
|
3156
|
+
const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds);
|
|
3157
|
+
if (canPerformMembershipOperation(scope, "serviceAccounts", groupIds)) {
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
if (scope.operations.serviceAccounts.policyIds.length === 0) {
|
|
3161
|
+
throw missingServiceAccountsPolicyError();
|
|
3162
|
+
}
|
|
3163
|
+
const missing = missingMembershipGroupIds(scope, "serviceAccounts", groupIds);
|
|
3164
|
+
throw new AuthRuntimeError2("authorization_denied", `[Sixb] The current user is not allowed to place service accounts in group(s): ${missing.join(", ")}.`);
|
|
3165
|
+
}
|
|
3226
3166
|
assertCanManageInvitationGroups(callerGroupIds, groupIds) {
|
|
3227
3167
|
const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds);
|
|
3228
3168
|
if (canPerformMembershipOperation(scope, "invite", groupIds)) {
|
|
@@ -3256,9 +3196,8 @@ function constrainTokenGroupIds(principalGroupIds, accessToken) {
|
|
|
3256
3196
|
const allowed = new Set(accessToken.groupIds);
|
|
3257
3197
|
return principalGroupIds.filter((groupId) => allowed.has(groupId));
|
|
3258
3198
|
}
|
|
3259
|
-
function
|
|
3260
|
-
|
|
3261
|
-
return serviceAccountGroupIds.every((groupId) => callerGroups.has(groupId));
|
|
3199
|
+
function missingServiceAccountsPolicyError() {
|
|
3200
|
+
return new AuthRuntimeError2("authorization_denied", "[Sixb] Managing service accounts needs a membership policy with the 'serviceAccounts' operation.");
|
|
3262
3201
|
}
|
|
3263
3202
|
function missingAccessTokenError(tokenId, projectId) {
|
|
3264
3203
|
return new AuthStorageError2("missing_access_token", `[Sixb] Access token '${tokenId}' not found for project '${projectId}'.`);
|
|
@@ -3309,7 +3248,8 @@ function membershipCapabilities(scope) {
|
|
|
3309
3248
|
holds: {
|
|
3310
3249
|
invite: scope.operations.invite.policyIds.length > 0,
|
|
3311
3250
|
assignGroups: scope.operations.assignGroups.policyIds.length > 0,
|
|
3312
|
-
suspend: scope.operations.suspend.policyIds.length > 0
|
|
3251
|
+
suspend: scope.operations.suspend.policyIds.length > 0,
|
|
3252
|
+
serviceAccounts: scope.operations.serviceAccounts.policyIds.length > 0
|
|
3313
3253
|
},
|
|
3314
3254
|
assignableGroupIds: [...scope.operations.assignGroups.groupIds],
|
|
3315
3255
|
covers: (operation, memberGroups) => canPerformMembershipOperation(scope, operation, groupIdsOf(memberGroups))
|
|
@@ -3323,6 +3263,6 @@ var SYSTEM_PRINCIPAL2 = { type: "system", id: "system" };
|
|
|
3323
3263
|
function principalsEqual2(left, right) {
|
|
3324
3264
|
return left.type === right.type && left.id === right.id;
|
|
3325
3265
|
}
|
|
3326
|
-
export { ActionDefinitionError2, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2, isActionDefinition2, isGlobalActionDefinition2, isObjectActionDefinition2, normalizeActionParams, coerceActionParamsToTyped, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX2, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2, generateAccessTokenSecret2, hashAccessTokenSecret2, formatAccessTokenValue2, parseAccessTokenValue2, getBearerAccessTokenValue2, createAccessTokenCredential2, setRequestClientAddress2, getRequestClientAddress2, CSRF_HEADER_NAME2, generateCsrfToken2, isCsrfExemptMethod2, verifyDoubleSubmitCsrf2, verifyCsrfToken2,
|
|
3266
|
+
export { ActionDefinitionError2, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2, isActionDefinition2, isGlobalActionDefinition2, isObjectActionDefinition2, normalizeActionParams, coerceActionParamsToTyped, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX2, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2, generateAccessTokenSecret2, hashAccessTokenSecret2, formatAccessTokenValue2, parseAccessTokenValue2, getBearerAccessTokenValue2, createAccessTokenCredential2, setRequestClientAddress2, getRequestClientAddress2, CSRF_HEADER_NAME2, generateCsrfToken2, isCsrfExemptMethod2, verifyDoubleSubmitCsrf2, verifyCsrfToken2, every2, ShareDefinitionError2, defineShare2, isShareDefinition, snapshotShareDefinition, can2, SecurityRegistry, AuthStorageError2, MAX_PENDING_DEVICE_AUTHORIZATIONS2, paginate, InMemoryAuthStorage2, generateSessionSecret2, hashSessionSecret2, formatSessionCookieValue2, parseSessionCookieValue2, createSessionCredential2, AuthRuntime2, SYSTEM_PRINCIPAL2, principalsEqual2 };
|
|
3327
3267
|
|
|
3328
|
-
//# debugId=
|
|
3268
|
+
//# debugId=DF55B99B002A92F564756E2164756E21
|