@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
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import"../chunk-8mx7qw3y.js";
|
|
3
3
|
import"../chunk-z3y5kg1x.js";
|
|
4
|
-
import"../chunk-
|
|
5
|
-
import"../chunk-
|
|
4
|
+
import"../chunk-gsjm1wms.js";
|
|
5
|
+
import"../chunk-d0bqz29d.js";
|
|
6
6
|
import"../chunk-v4jbb3rs.js";
|
|
7
7
|
import"../chunk-jhm3zsa7.js";
|
|
8
8
|
import"../chunk-hvsb78a1.js";
|
|
9
9
|
import {
|
|
10
10
|
createConnectorCodedError,
|
|
11
11
|
getConnectorExecutionSourceResolver
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-tg2cw67r.js";
|
|
13
13
|
import"../chunk-a40ad1ft.js";
|
|
14
14
|
import"../chunk-b38szspf.js";
|
|
15
|
-
import"../chunk-
|
|
16
|
-
import"../chunk-
|
|
15
|
+
import"../chunk-vpq4shxz.js";
|
|
16
|
+
import"../chunk-es1gxsbf.js";
|
|
17
17
|
import"../chunk-v9xd5wzd.js";
|
|
18
|
-
import"../chunk-
|
|
18
|
+
import"../chunk-hcbyfxbe.js";
|
|
19
19
|
import"../chunk-pqajwytd.js";
|
|
20
20
|
import"../chunk-29yx306f.js";
|
|
21
21
|
import"../chunk-gfdh9kqa.js";
|
|
@@ -24,15 +24,15 @@ import"../chunk-s54c868q.js";
|
|
|
24
24
|
import"../chunk-ere85b8y.js";
|
|
25
25
|
import"../chunk-4as3wt1c.js";
|
|
26
26
|
import"../chunk-h89wz928.js";
|
|
27
|
-
import"../chunk-
|
|
27
|
+
import"../chunk-9w055r5b.js";
|
|
28
28
|
import {
|
|
29
29
|
ExecutionStorageError2
|
|
30
30
|
} from "../chunk-tw03bsmb.js";
|
|
31
|
-
import"../chunk-
|
|
31
|
+
import"../chunk-d09tj99x.js";
|
|
32
32
|
import"../chunk-7n440zgt.js";
|
|
33
33
|
import {
|
|
34
34
|
canRetryWebhookRun2
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-n33z5bjw.js";
|
|
36
36
|
import"../chunk-pbcbn83d.js";
|
|
37
37
|
import"../chunk-qczk96d9.js";
|
|
38
38
|
import"../chunk-mmagke4x.js";
|
|
@@ -42,10 +42,10 @@ import"../chunk-jmfet9r4.js";
|
|
|
42
42
|
import {
|
|
43
43
|
WebhookRunError2
|
|
44
44
|
} from "../chunk-qf954wje.js";
|
|
45
|
-
import"../chunk-
|
|
45
|
+
import"../chunk-rrzt8jdy.js";
|
|
46
46
|
import {
|
|
47
47
|
createPrimitiveExecutionRecord
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-9dmt152s.js";
|
|
49
49
|
import"../chunk-br3k6qbf.js";
|
|
50
50
|
import {
|
|
51
51
|
isStorageSerializationFailure2
|
package/dist/workflows/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
defineWorkflow2,
|
|
9
9
|
createWorkflowNodeFailure2,
|
|
10
10
|
unwrapWorkflowNodeFailure2
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-k6q3n2sc.js";
|
|
12
12
|
import"../chunk-nq6gpjt7.js";
|
|
13
13
|
import"../chunk-fb3feg1e.js";
|
|
14
14
|
import"../chunk-yxd3nnqt.js";
|
|
@@ -45,33 +45,33 @@ import {
|
|
|
45
45
|
snapshotWorkflowActionInput2,
|
|
46
46
|
WorkflowRunDispatcher2,
|
|
47
47
|
requestWorkflowRun2
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import"../chunk-
|
|
50
|
-
import"../chunk-
|
|
51
|
-
import"../chunk-
|
|
52
|
-
import"../chunk-
|
|
53
|
-
import"../chunk-
|
|
48
|
+
} from "../chunk-6c6sn0bh.js";
|
|
49
|
+
import"../chunk-xfs8x8m9.js";
|
|
50
|
+
import"../chunk-tg2cw67r.js";
|
|
51
|
+
import"../chunk-fkgc1wt8.js";
|
|
52
|
+
import"../chunk-4vyr1j8f.js";
|
|
53
|
+
import"../chunk-hjzdd750.js";
|
|
54
54
|
import"../chunk-mfs23znk.js";
|
|
55
|
-
import"../chunk-
|
|
55
|
+
import"../chunk-1zq2p6g0.js";
|
|
56
56
|
import"../chunk-99nd4rc1.js";
|
|
57
57
|
import"../chunk-vyf9kfqf.js";
|
|
58
|
-
import"../chunk-
|
|
59
|
-
import"../chunk-
|
|
60
|
-
import"../chunk-
|
|
61
|
-
import"../chunk-
|
|
58
|
+
import"../chunk-bx9q3cwv.js";
|
|
59
|
+
import"../chunk-yevzdx4y.js";
|
|
60
|
+
import"../chunk-9dmt152s.js";
|
|
61
|
+
import"../chunk-n33z5bjw.js";
|
|
62
|
+
import"../chunk-9ybhtmg4.js";
|
|
62
63
|
import"../chunk-br3k6qbf.js";
|
|
63
64
|
import"../chunk-jmfet9r4.js";
|
|
64
65
|
import"../chunk-qf954wje.js";
|
|
65
|
-
import"../chunk-
|
|
66
|
+
import"../chunk-rrzt8jdy.js";
|
|
66
67
|
import"../chunk-tw03bsmb.js";
|
|
67
|
-
import"../chunk-
|
|
68
|
+
import"../chunk-9w055r5b.js";
|
|
68
69
|
import"../chunk-s16apyk9.js";
|
|
70
|
+
import"../chunk-hn2r7z41.js";
|
|
69
71
|
import"../chunk-h89wz928.js";
|
|
70
72
|
import"../chunk-pbcbn83d.js";
|
|
71
73
|
import"../chunk-qczk96d9.js";
|
|
72
74
|
import"../chunk-mmagke4x.js";
|
|
73
|
-
import"../chunk-9ybhtmg4.js";
|
|
74
|
-
import"../chunk-hn2r7z41.js";
|
|
75
75
|
import"../chunk-b38szspf.js";
|
|
76
76
|
import"../chunk-a40ad1ft.js";
|
|
77
77
|
import"../chunk-s54c868q.js";
|
|
@@ -80,7 +80,7 @@ import"../chunk-rj69qcrd.js";
|
|
|
80
80
|
import"../chunk-4as3wt1c.js";
|
|
81
81
|
import"../chunk-29yx306f.js";
|
|
82
82
|
import"../chunk-pqajwytd.js";
|
|
83
|
-
import"../chunk-
|
|
83
|
+
import"../chunk-d09tj99x.js";
|
|
84
84
|
import"../chunk-3qms4nax.js";
|
|
85
85
|
import"../chunk-7n440zgt.js";
|
|
86
86
|
import"../chunk-m427qgq0.js";
|
|
@@ -88,22 +88,22 @@ import"../chunk-fa02jy15.js";
|
|
|
88
88
|
import"../chunk-7t429e3f.js";
|
|
89
89
|
import"../chunk-3zxk45er.js";
|
|
90
90
|
import"../chunk-5a4a52tq.js";
|
|
91
|
-
import"../chunk-
|
|
92
|
-
import"../chunk-
|
|
93
|
-
import"../chunk-
|
|
91
|
+
import"../chunk-t7x8dmn0.js";
|
|
92
|
+
import"../chunk-way52z4h.js";
|
|
93
|
+
import"../chunk-0yh890a4.js";
|
|
94
94
|
import"../chunk-gc4ntf7d.js";
|
|
95
95
|
import"../chunk-gfdh9kqa.js";
|
|
96
96
|
import"../chunk-pfp1txq2.js";
|
|
97
97
|
import"../chunk-5e43w60z.js";
|
|
98
|
-
import"../chunk-
|
|
98
|
+
import"../chunk-vpq4shxz.js";
|
|
99
99
|
import"../chunk-c85m1hyj.js";
|
|
100
100
|
import"../chunk-v9xd5wzd.js";
|
|
101
|
-
import"../chunk-
|
|
102
|
-
import"../chunk-
|
|
103
|
-
import"../chunk-
|
|
101
|
+
import"../chunk-es1gxsbf.js";
|
|
102
|
+
import"../chunk-hcbyfxbe.js";
|
|
103
|
+
import"../chunk-d0bqz29d.js";
|
|
104
104
|
import"../chunk-v4jbb3rs.js";
|
|
105
105
|
import"../chunk-hvsb78a1.js";
|
|
106
|
-
import"../chunk-
|
|
106
|
+
import"../chunk-gsjm1wms.js";
|
|
107
107
|
import"../chunk-jhm3zsa7.js";
|
|
108
108
|
import"../chunk-8mx7qw3y.js";
|
|
109
109
|
import"../chunk-z3y5kg1x.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "The ontology-first runtime for Sixb — objects, links, telemetry, actions, and provider contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -455,6 +455,12 @@
|
|
|
455
455
|
"import": "./dist/sandboxes/index.js",
|
|
456
456
|
"default": "./dist/sandboxes/index.js"
|
|
457
457
|
},
|
|
458
|
+
"./security": {
|
|
459
|
+
"types": "./dist/security/public.d.ts",
|
|
460
|
+
"bun": "./src/security/public.ts",
|
|
461
|
+
"import": "./dist/security/public.js",
|
|
462
|
+
"default": "./dist/security/public.js"
|
|
463
|
+
},
|
|
458
464
|
"./storage": {
|
|
459
465
|
"types": "./dist/storage/index.d.ts",
|
|
460
466
|
"bun": "./src/storage/index.ts",
|
|
@@ -472,7 +478,7 @@
|
|
|
472
478
|
"build": "bun ../../scripts/build-package.ts",
|
|
473
479
|
"typecheck": "tsc --noEmit",
|
|
474
480
|
"test": "bun test",
|
|
475
|
-
"test:e2e": "bun ../../scripts/ci-guard.ts --stall 120 --max 600 bun test ./tests/published-artifacts.e2e.ts",
|
|
481
|
+
"test:e2e": "bun ../../scripts/ci-guard.ts --stall 120 --max 600 bun test ./tests/published-artifacts.e2e.ts ./tests/browser-entries.e2e.ts",
|
|
476
482
|
"prepack": "bun run build"
|
|
477
483
|
},
|
|
478
484
|
"devDependencies": {
|
package/src/auth/cookies.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { AuthSessionAudience } from "./audience"
|
|
2
|
-
import { DEFAULT_AUTH_SESSION_AUDIENCE, resolveAuthSessionAudience } from "./audience"
|
|
3
1
|
import type { AuthCookieOptions } from "./types"
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
export const
|
|
3
|
+
// The names the app's cookies had beside Atlas's, so its sessions survived Atlas leaving.
|
|
4
|
+
export const DEFAULT_SESSION_COOKIE_NAME = "sixb_session_app"
|
|
5
|
+
export const DEFAULT_CSRF_COOKIE_NAME = "sixb_csrf_app"
|
|
7
6
|
|
|
8
7
|
export interface ResolvedAuthCookieOptions {
|
|
9
8
|
readonly sessionCookieName: string
|
|
@@ -41,22 +40,6 @@ export function resolveAuthCookieOptions(
|
|
|
41
40
|
return resolved
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
export function resolveAuthCookieOptionsForAudience(
|
|
45
|
-
options: ResolvedAuthCookieOptions,
|
|
46
|
-
audience: AuthSessionAudience | undefined
|
|
47
|
-
): ResolvedAuthCookieOptions {
|
|
48
|
-
const resolvedAudience = resolveAuthSessionAudience(audience)
|
|
49
|
-
if (resolvedAudience === DEFAULT_AUTH_SESSION_AUDIENCE) {
|
|
50
|
-
return options
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
...options,
|
|
55
|
-
sessionCookieName: `${options.sessionCookieName}_${resolvedAudience}`,
|
|
56
|
-
csrfCookieName: `${options.csrfCookieName}_${resolvedAudience}`,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
43
|
export function parseCookieHeader(header: string | null): ReadonlyMap<string, string> {
|
|
61
44
|
const cookies = new Map<string, string>()
|
|
62
45
|
if (!header) {
|
package/src/auth/index.ts
CHANGED
|
@@ -9,12 +9,6 @@ export {
|
|
|
9
9
|
parseAccessTokenValue,
|
|
10
10
|
SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX,
|
|
11
11
|
} from "./access-tokens"
|
|
12
|
-
export type { AuthSessionAudience, AuthSessionAudienceOptions } from "./audience"
|
|
13
|
-
export {
|
|
14
|
-
DEFAULT_AUTH_SESSION_AUDIENCE,
|
|
15
|
-
isValidAuthSessionAudience,
|
|
16
|
-
resolveAuthSessionAudience,
|
|
17
|
-
} from "./audience"
|
|
18
12
|
export { getRequestClientAddress, setRequestClientAddress } from "./client-address"
|
|
19
13
|
export {
|
|
20
14
|
clearCsrfCookieHeader,
|
package/src/auth/runtime.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto"
|
|
2
|
-
import {
|
|
3
|
-
type AuthorizationContext,
|
|
4
|
-
canAccessApplication,
|
|
5
|
-
resolveAuthorizationContext,
|
|
6
|
-
} from "../authorization"
|
|
2
|
+
import { type AuthorizationContext, resolveAuthorizationContext } from "../authorization"
|
|
7
3
|
import {
|
|
8
4
|
canPerformMembershipOperation,
|
|
9
5
|
type GroupReference,
|
|
@@ -33,13 +29,8 @@ import {
|
|
|
33
29
|
hashAccessTokenSecret,
|
|
34
30
|
parseAccessTokenValue,
|
|
35
31
|
} from "./access-tokens"
|
|
36
|
-
import { type AuthSessionAudience, DEFAULT_AUTH_SESSION_AUDIENCE } from "./audience"
|
|
37
32
|
import { getRequestClientAddress } from "./client-address"
|
|
38
|
-
import {
|
|
39
|
-
getCookie,
|
|
40
|
-
type ResolvedAuthCookieOptions,
|
|
41
|
-
resolveAuthCookieOptionsForAudience,
|
|
42
|
-
} from "./cookies"
|
|
33
|
+
import { getCookie, type ResolvedAuthCookieOptions } from "./cookies"
|
|
43
34
|
import { AuthRuntimeError } from "./errors"
|
|
44
35
|
import { SessionCache } from "./session-cache"
|
|
45
36
|
import {
|
|
@@ -108,7 +99,6 @@ import {
|
|
|
108
99
|
isInvitationDeliveryAuthStrategy,
|
|
109
100
|
normalizePagination,
|
|
110
101
|
resolveAuthConfig,
|
|
111
|
-
resolveAuthSessionAudience,
|
|
112
102
|
resolveInvitationExpiresAt,
|
|
113
103
|
} from "./validation"
|
|
114
104
|
|
|
@@ -184,8 +174,8 @@ export class AuthRuntime {
|
|
|
184
174
|
}
|
|
185
175
|
}
|
|
186
176
|
|
|
187
|
-
getCookieOptions(
|
|
188
|
-
return
|
|
177
|
+
getCookieOptions(): ResolvedAuthCookieOptions {
|
|
178
|
+
return this.config.cookies
|
|
189
179
|
}
|
|
190
180
|
|
|
191
181
|
assertCanServeHttp(params: { readonly production: boolean }): void {
|
|
@@ -240,8 +230,6 @@ export class AuthRuntime {
|
|
|
240
230
|
return { authenticated: false, reason: "auth_disabled" }
|
|
241
231
|
}
|
|
242
232
|
|
|
243
|
-
const audience = resolveAuthSessionAudience(options.audience)
|
|
244
|
-
|
|
245
233
|
if (options.credentialSource === "any") {
|
|
246
234
|
const tokenValue = getBearerAccessTokenValue(request)
|
|
247
235
|
if (tokenValue?.startsWith(SESSION_ACCESS_TOKEN_PREFIX)) {
|
|
@@ -257,15 +245,14 @@ export class AuthRuntime {
|
|
|
257
245
|
}
|
|
258
246
|
}
|
|
259
247
|
|
|
260
|
-
return this.resolveCookieSession(request,
|
|
248
|
+
return this.resolveCookieSession(request, options.sessionActivity)
|
|
261
249
|
}
|
|
262
250
|
|
|
263
251
|
private async resolveCookieSession(
|
|
264
252
|
request: Request,
|
|
265
|
-
audience: ReturnType<typeof resolveAuthSessionAudience>,
|
|
266
253
|
activity: AuthSessionResolutionOptions["sessionActivity"]
|
|
267
254
|
): Promise<AuthSessionResult> {
|
|
268
|
-
const cookieOptions = this.getCookieOptions(
|
|
255
|
+
const cookieOptions = this.getCookieOptions()
|
|
269
256
|
const cookieValue = getCookie(request, cookieOptions.sessionCookieName)
|
|
270
257
|
if (!cookieValue) {
|
|
271
258
|
return { authenticated: false, reason: "missing_cookie" }
|
|
@@ -283,7 +270,6 @@ export class AuthRuntime {
|
|
|
283
270
|
sessionId: parts.sessionId,
|
|
284
271
|
tokenHash,
|
|
285
272
|
transport: "cookie",
|
|
286
|
-
audience,
|
|
287
273
|
nowMs,
|
|
288
274
|
})
|
|
289
275
|
if (cached) {
|
|
@@ -298,7 +284,6 @@ export class AuthRuntime {
|
|
|
298
284
|
let session = await storage.sessions.findValidByTokenHash({
|
|
299
285
|
projectId: this.projectId,
|
|
300
286
|
id: parts.sessionId,
|
|
301
|
-
audience,
|
|
302
287
|
tokenHash,
|
|
303
288
|
now,
|
|
304
289
|
})
|
|
@@ -312,7 +297,6 @@ export class AuthRuntime {
|
|
|
312
297
|
const renewed = await storage.sessions.renewIfValid({
|
|
313
298
|
projectId: this.projectId,
|
|
314
299
|
id: parts.sessionId,
|
|
315
|
-
audience,
|
|
316
300
|
tokenHash,
|
|
317
301
|
now,
|
|
318
302
|
expiresAt: this.getRenewedSessionExpiresAt(session, nowMs),
|
|
@@ -388,7 +372,6 @@ export class AuthRuntime {
|
|
|
388
372
|
this.sessionCache?.set({
|
|
389
373
|
sessionId: session.id,
|
|
390
374
|
tokenHash,
|
|
391
|
-
audience: session.audience,
|
|
392
375
|
session: result,
|
|
393
376
|
nowMs: now.getTime(),
|
|
394
377
|
sessionExpiresAtMs: session.expiresAt.getTime(),
|
|
@@ -418,8 +401,6 @@ export class AuthRuntime {
|
|
|
418
401
|
projectId: this.projectId,
|
|
419
402
|
userId: input.userId,
|
|
420
403
|
strategyId: "device",
|
|
421
|
-
// A native session belongs to no web app. The column needs a value; nothing reads it.
|
|
422
|
-
audience: DEFAULT_AUTH_SESSION_AUDIENCE,
|
|
423
404
|
tokenHash: tokens.tokenHash,
|
|
424
405
|
createdAt: input.now,
|
|
425
406
|
...this.createSessionDeadlines(input.now),
|
|
@@ -712,6 +693,11 @@ export class AuthRuntime {
|
|
|
712
693
|
caller: AuthenticatedUserRequestSession
|
|
713
694
|
): Promise<ListServiceAccountsResult> {
|
|
714
695
|
const storage = this.requireAuthStorage()
|
|
696
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds)
|
|
697
|
+
if (scope.operations.serviceAccounts.policyIds.length === 0) {
|
|
698
|
+
return { serviceAccounts: [] }
|
|
699
|
+
}
|
|
700
|
+
|
|
715
701
|
const result = await storage.serviceAccounts.list({
|
|
716
702
|
projectId: this.projectId,
|
|
717
703
|
order: "desc",
|
|
@@ -724,11 +710,11 @@ export class AuthRuntime {
|
|
|
724
710
|
}))
|
|
725
711
|
)
|
|
726
712
|
|
|
727
|
-
// A caller only sees the service accounts
|
|
728
|
-
// listing never leaks the groups of
|
|
713
|
+
// A caller only sees the service accounts its membership policies cover, so
|
|
714
|
+
// listing never leaks the groups of accounts outside its scope.
|
|
729
715
|
return {
|
|
730
716
|
serviceAccounts: withGroups.filter(({ groupIds }) =>
|
|
731
|
-
|
|
717
|
+
canPerformMembershipOperation(scope, "serviceAccounts", groupIds)
|
|
732
718
|
),
|
|
733
719
|
}
|
|
734
720
|
}
|
|
@@ -738,11 +724,9 @@ export class AuthRuntime {
|
|
|
738
724
|
input: CreateServiceAccountInput
|
|
739
725
|
): Promise<CreateServiceAccountResult> {
|
|
740
726
|
const storage = this.requireAuthStorage()
|
|
741
|
-
// A caller can only place a service account in groups
|
|
742
|
-
const groupIds =
|
|
743
|
-
|
|
744
|
-
subject: "service account",
|
|
745
|
-
}) ?? []
|
|
727
|
+
// A caller can only place a service account in groups its `serviceAccounts` policies cover.
|
|
728
|
+
const groupIds = normalizeRequestedGroupIds(input.groupIds) ?? []
|
|
729
|
+
this.assertCanManageServiceAccountGroups(caller.groupIds, groupIds)
|
|
746
730
|
const now = new Date()
|
|
747
731
|
const serviceAccount = await storage.serviceAccounts.create({
|
|
748
732
|
id: input.id ?? `svc_${randomUUID()}`,
|
|
@@ -829,8 +813,8 @@ export class AuthRuntime {
|
|
|
829
813
|
}
|
|
830
814
|
|
|
831
815
|
// The token can only carry groups the service account already holds; the
|
|
832
|
-
// manageability check above guarantees those are
|
|
833
|
-
//
|
|
816
|
+
// manageability check above guarantees those are within the caller's
|
|
817
|
+
// `serviceAccounts` scope, so the token never reaches past that scope.
|
|
834
818
|
const groupIds = constrainRequestedGroupIds(input.groupIds, serviceAccountGroupIds, {
|
|
835
819
|
subject: "service account token",
|
|
836
820
|
})
|
|
@@ -888,12 +872,10 @@ export class AuthRuntime {
|
|
|
888
872
|
/**
|
|
889
873
|
* Resolve a service account the caller is allowed to manage.
|
|
890
874
|
*
|
|
891
|
-
* A caller
|
|
892
|
-
* the account is in ("you can manage what you could have created"). This
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
* caller's own access. Missing and non-manageable accounts raise the same
|
|
896
|
-
* error so callers cannot probe which privileged accounts exist.
|
|
875
|
+
* A caller needs a membership policy with the `serviceAccounts` operation whose scope covers every
|
|
876
|
+
* group the account is in ("you can manage what you could have created"). This confines token
|
|
877
|
+
* minting, disabling, and revocation to the groups the project's policies hand out. Missing and
|
|
878
|
+
* out-of-scope accounts raise the same error so callers cannot probe which accounts exist.
|
|
897
879
|
*/
|
|
898
880
|
private async requireManageableServiceAccount(
|
|
899
881
|
storage: AuthStorage,
|
|
@@ -903,6 +885,11 @@ export class AuthRuntime {
|
|
|
903
885
|
readonly serviceAccount: ServiceAccountRecord
|
|
904
886
|
readonly groupIds: readonly string[]
|
|
905
887
|
}> {
|
|
888
|
+
const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds)
|
|
889
|
+
if (scope.operations.serviceAccounts.policyIds.length === 0) {
|
|
890
|
+
throw missingServiceAccountsPolicyError()
|
|
891
|
+
}
|
|
892
|
+
|
|
906
893
|
const serviceAccount = await storage.serviceAccounts.getById({
|
|
907
894
|
projectId: this.projectId,
|
|
908
895
|
id: serviceAccountId,
|
|
@@ -911,7 +898,7 @@ export class AuthRuntime {
|
|
|
911
898
|
? await this.listServiceAccountGroupIds(storage, serviceAccountId)
|
|
912
899
|
: []
|
|
913
900
|
|
|
914
|
-
if (!serviceAccount || !
|
|
901
|
+
if (!serviceAccount || !canPerformMembershipOperation(scope, "serviceAccounts", groupIds)) {
|
|
915
902
|
throw new AuthStorageError(
|
|
916
903
|
"missing_service_account",
|
|
917
904
|
`[Sixb] Service account '${serviceAccountId}' not found for project '${this.projectId}'.`
|
|
@@ -975,6 +962,7 @@ export class AuthRuntime {
|
|
|
975
962
|
return {
|
|
976
963
|
// The member-admin edit-groups dialog assigns from the `assignGroups` scope.
|
|
977
964
|
groups: this.scopedGroupOptions(scope.operations.assignGroups.groupIds),
|
|
965
|
+
serviceAccountGroups: this.scopedGroupOptions(scope.operations.serviceAccounts.groupIds),
|
|
978
966
|
capabilities: membershipCapabilities(scope).holds,
|
|
979
967
|
}
|
|
980
968
|
}
|
|
@@ -1163,7 +1151,7 @@ export class AuthRuntime {
|
|
|
1163
1151
|
return { user: reactivated, groupIds, managedGroupIds }
|
|
1164
1152
|
}
|
|
1165
1153
|
|
|
1166
|
-
/** The caller's active sessions
|
|
1154
|
+
/** The caller's active sessions, most recently active first. */
|
|
1167
1155
|
async listSessions(caller: AuthenticatedUserRequestSession): Promise<readonly SessionRecord[]> {
|
|
1168
1156
|
return this.requireAuthStorage().sessions.listActiveByUserId({
|
|
1169
1157
|
projectId: this.projectId,
|
|
@@ -1195,7 +1183,7 @@ export class AuthRuntime {
|
|
|
1195
1183
|
return true
|
|
1196
1184
|
}
|
|
1197
1185
|
|
|
1198
|
-
/** End every active session of the caller
|
|
1186
|
+
/** End every active session of the caller. Returns how many ended. */
|
|
1199
1187
|
async revokeAllSessions(caller: AuthenticatedUserRequestSession): Promise<number> {
|
|
1200
1188
|
const revoked = await this.requireAuthStorage().sessions.revokeActiveForUser({
|
|
1201
1189
|
projectId: this.projectId,
|
|
@@ -1284,7 +1272,6 @@ export class AuthRuntime {
|
|
|
1284
1272
|
}
|
|
1285
1273
|
|
|
1286
1274
|
await this.assertCanInviteRecipient(strategy, authStorage, input.email, now)
|
|
1287
|
-
this.assertInvitationApplicationAccess(groupIds, destination.audience)
|
|
1288
1275
|
|
|
1289
1276
|
const invitation = await authStorage.invitations.createOrUpdateActive({
|
|
1290
1277
|
id: `inv_${randomUUID()}`,
|
|
@@ -1304,7 +1291,6 @@ export class AuthRuntime {
|
|
|
1304
1291
|
projectId: this.projectId,
|
|
1305
1292
|
authStorage,
|
|
1306
1293
|
invitation,
|
|
1307
|
-
audience: destination.audience,
|
|
1308
1294
|
returnTo: destination.returnTo,
|
|
1309
1295
|
requestOrigin: destination.requestOrigin,
|
|
1310
1296
|
revealLink: input.revealLink,
|
|
@@ -1451,27 +1437,6 @@ export class AuthRuntime {
|
|
|
1451
1437
|
return { state: "enabled" }
|
|
1452
1438
|
}
|
|
1453
1439
|
|
|
1454
|
-
private assertInvitationApplicationAccess(
|
|
1455
|
-
groupIds: readonly string[],
|
|
1456
|
-
audience: AuthSessionAudience
|
|
1457
|
-
): void {
|
|
1458
|
-
// Check only the groups this invitation assigns. Existing memberships may
|
|
1459
|
-
// be outside the caller's policy scope and must not affect this response.
|
|
1460
|
-
const roles = this.security.listResolvedRoles()
|
|
1461
|
-
const authorization = resolveAuthorizationContext({
|
|
1462
|
-
principal: { type: "user", id: "invited-user" },
|
|
1463
|
-
groupIds,
|
|
1464
|
-
roles,
|
|
1465
|
-
})
|
|
1466
|
-
|
|
1467
|
-
if (canAccessApplication(authorization, roles, audience)) return
|
|
1468
|
-
|
|
1469
|
-
throw new AuthRuntimeError(
|
|
1470
|
-
"authorization_denied",
|
|
1471
|
-
`[Sixb] Invitation groups do not grant access to application '${audience}'.`
|
|
1472
|
-
)
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
1440
|
private async assertCanInviteRecipient(
|
|
1476
1441
|
strategy: InvitationDeliveryAuthStrategy,
|
|
1477
1442
|
authStorage: AuthStorage,
|
|
@@ -1524,6 +1489,27 @@ export class AuthRuntime {
|
|
|
1524
1489
|
)
|
|
1525
1490
|
}
|
|
1526
1491
|
|
|
1492
|
+
private assertCanManageServiceAccountGroups(
|
|
1493
|
+
callerGroupIds: readonly string[],
|
|
1494
|
+
groupIds: readonly string[]
|
|
1495
|
+
): void {
|
|
1496
|
+
const scope = this.resolveMembershipPolicyScopeForUser(callerGroupIds)
|
|
1497
|
+
|
|
1498
|
+
if (canPerformMembershipOperation(scope, "serviceAccounts", groupIds)) {
|
|
1499
|
+
return
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
if (scope.operations.serviceAccounts.policyIds.length === 0) {
|
|
1503
|
+
throw missingServiceAccountsPolicyError()
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
const missing = missingMembershipGroupIds(scope, "serviceAccounts", groupIds)
|
|
1507
|
+
throw new AuthRuntimeError(
|
|
1508
|
+
"authorization_denied",
|
|
1509
|
+
`[Sixb] The current user is not allowed to place service accounts in group(s): ${missing.join(", ")}.`
|
|
1510
|
+
)
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1527
1513
|
private assertCanManageInvitationGroups(
|
|
1528
1514
|
callerGroupIds: readonly string[],
|
|
1529
1515
|
groupIds: readonly string[]
|
|
@@ -1590,15 +1576,11 @@ function constrainTokenGroupIds(
|
|
|
1590
1576
|
return principalGroupIds.filter((groupId) => allowed.has(groupId))
|
|
1591
1577
|
}
|
|
1592
1578
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
serviceAccountGroupIds: readonly string[]
|
|
1599
|
-
): boolean {
|
|
1600
|
-
const callerGroups = new Set(callerGroupIds)
|
|
1601
|
-
return serviceAccountGroupIds.every((groupId) => callerGroups.has(groupId))
|
|
1579
|
+
function missingServiceAccountsPolicyError(): AuthRuntimeError {
|
|
1580
|
+
return new AuthRuntimeError(
|
|
1581
|
+
"authorization_denied",
|
|
1582
|
+
"[Sixb] Managing service accounts needs a membership policy with the 'serviceAccounts' operation."
|
|
1583
|
+
)
|
|
1602
1584
|
}
|
|
1603
1585
|
|
|
1604
1586
|
function missingAccessTokenError(tokenId: string, projectId: string): AuthStorageError {
|
|
@@ -1701,6 +1683,7 @@ function membershipCapabilities(scope: MembershipPolicyScope): MembershipCapabil
|
|
|
1701
1683
|
invite: scope.operations.invite.policyIds.length > 0,
|
|
1702
1684
|
assignGroups: scope.operations.assignGroups.policyIds.length > 0,
|
|
1703
1685
|
suspend: scope.operations.suspend.policyIds.length > 0,
|
|
1686
|
+
serviceAccounts: scope.operations.serviceAccounts.policyIds.length > 0,
|
|
1704
1687
|
},
|
|
1705
1688
|
assignableGroupIds: [...scope.operations.assignGroups.groupIds],
|
|
1706
1689
|
covers: (operation, memberGroups) =>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { AuthSessionAudience } from "./audience"
|
|
2
1
|
import type { AuthenticatedAuthSession } from "./types"
|
|
3
2
|
|
|
4
3
|
interface SessionCacheEntry {
|
|
5
4
|
readonly tokenHash: string
|
|
6
5
|
readonly transport: "cookie" | "bearer"
|
|
7
|
-
readonly audience: AuthSessionAudience
|
|
8
6
|
readonly session: AuthenticatedAuthSession
|
|
9
7
|
readonly expiresAtMs: number
|
|
10
8
|
}
|
|
@@ -14,15 +12,12 @@ export interface SessionCacheGetInput {
|
|
|
14
12
|
readonly tokenHash: string
|
|
15
13
|
/** A cookie is only ever answered from a cookie entry, and a bearer token from a bearer entry. */
|
|
16
14
|
readonly transport: "cookie" | "bearer"
|
|
17
|
-
/** The browser audience a cookie was read for. Bearer sessions carry their own. */
|
|
18
|
-
readonly audience?: AuthSessionAudience
|
|
19
15
|
readonly nowMs: number
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
export interface SessionCacheSetInput {
|
|
23
19
|
readonly sessionId: string
|
|
24
20
|
readonly tokenHash: string
|
|
25
|
-
readonly audience: AuthSessionAudience
|
|
26
21
|
readonly nowMs: number
|
|
27
22
|
readonly session: AuthenticatedAuthSession
|
|
28
23
|
readonly sessionExpiresAtMs: number
|
|
@@ -38,7 +33,7 @@ export interface SessionCacheSetInput {
|
|
|
38
33
|
* API stalls. Caching the resolved result for a short TTL collapses those reads to one
|
|
39
34
|
* per session per window.
|
|
40
35
|
*
|
|
41
|
-
* Safety: entries are pinned to the exact token hash
|
|
36
|
+
* Safety: entries are pinned to the exact token hash and transport that produced them and
|
|
42
37
|
* are never served past the session's rolling or absolute deadline. The short TTL bounds how long
|
|
43
38
|
* a revoked session can linger; sign-out additionally invalidates eagerly via
|
|
44
39
|
* {@link SessionCache.invalidate}.
|
|
@@ -60,8 +55,7 @@ export class SessionCache {
|
|
|
60
55
|
if (
|
|
61
56
|
entry.expiresAtMs <= input.nowMs ||
|
|
62
57
|
entry.tokenHash !== input.tokenHash ||
|
|
63
|
-
entry.transport !== input.transport
|
|
64
|
-
(input.audience !== undefined && entry.audience !== input.audience)
|
|
58
|
+
entry.transport !== input.transport
|
|
65
59
|
) {
|
|
66
60
|
this.entries.delete(input.sessionId)
|
|
67
61
|
return undefined
|
|
@@ -88,7 +82,6 @@ export class SessionCache {
|
|
|
88
82
|
this.entries.set(input.sessionId, {
|
|
89
83
|
tokenHash: input.tokenHash,
|
|
90
84
|
transport: bearer ? "bearer" : "cookie",
|
|
91
|
-
audience: input.audience,
|
|
92
85
|
session: input.session,
|
|
93
86
|
expiresAtMs,
|
|
94
87
|
})
|