@capybara-hq/kernel 0.1.0-rc.68 → 0.1.0-rc.69
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/admin/admin.module.js +2 -0
- package/dist/admin/health.service.d.ts +11 -4
- package/dist/admin/health.service.js +33 -17
- package/dist/background/poll.job.js +2 -2
- package/dist/background/tasks.service.d.ts +5 -5
- package/dist/background/tasks.service.js +9 -8
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/requests.service.js +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +9 -9
- package/dist/conversations/conversations.controller.d.ts +8 -3
- package/dist/conversations/conversations.controller.js +8 -3
- package/dist/conversations/conversations.service.d.ts +33 -15
- package/dist/conversations/conversations.service.js +60 -10
- package/dist/conversations/events.d.ts +21 -41
- package/dist/conversations/events.js +57 -31
- package/dist/conversations/permission-profiles.controller.d.ts +6 -4
- package/dist/conversations/permission-profiles.service.d.ts +6 -4
- package/dist/ctx/create-ctx.d.ts +20 -1
- package/dist/ctx/create-ctx.js +77 -6
- package/dist/ctx/device-provider-check.d.ts +6 -2
- package/dist/ctx/device-provider-check.js +17 -2
- package/dist/db/kernel-schema.d.ts +10 -48
- package/dist/devices/access.d.ts +3 -4
- package/dist/devices/access.js +3 -4
- package/dist/devices/conversation-devices.d.ts +1 -3
- package/dist/devices/conversation-devices.js +2 -7
- package/dist/devices/device-projects.service.js +24 -29
- package/dist/devices/device-provider-selection.d.ts +5 -6
- package/dist/devices/device-provider-selection.js +8 -9
- package/dist/devices/devices.controller.d.ts +8 -21
- package/dist/devices/devices.controller.js +9 -34
- package/dist/devices/devices.module.js +6 -4
- package/dist/devices/devices.schemas.d.ts +1 -5
- package/dist/devices/devices.schemas.js +1 -5
- package/dist/devices/devices.service.d.ts +84 -147
- package/dist/devices/devices.service.js +134 -229
- package/dist/devices/dto.d.ts +5 -32
- package/dist/devices/dto.js +5 -37
- package/dist/devices/errors.d.ts +6 -5
- package/dist/devices/errors.js +7 -8
- package/dist/devices/project-rules.d.ts +9 -11
- package/dist/devices/project-rules.js +7 -7
- package/dist/devices/working-root.d.ts +3 -6
- package/dist/devices/working-root.js +3 -8
- package/dist/dial-in/access.d.ts +23 -0
- package/dist/dial-in/access.js +64 -0
- package/dist/{local-devices/device-auth.controller.d.ts → dial-in/auth.controller.d.ts} +12 -6
- package/dist/{local-devices/device-auth.controller.js → dial-in/auth.controller.js} +30 -15
- package/dist/dial-in/auth.module.d.ts +7 -0
- package/dist/dial-in/auth.module.js +27 -0
- package/dist/{local-devices/device-auth.d.ts → dial-in/auth.service.d.ts} +42 -13
- package/dist/{local-devices/device-auth.js → dial-in/auth.service.js} +83 -32
- package/dist/dial-in/dial-in.module.d.ts +9 -0
- package/dist/dial-in/dial-in.module.js +37 -0
- package/dist/{local-devices → dial-in}/dto.d.ts +17 -2
- package/dist/{local-devices → dial-in}/dto.js +14 -2
- package/dist/dial-in/envelope.d.ts +95 -0
- package/dist/dial-in/envelope.js +89 -0
- package/dist/dial-in/gateway.d.ts +214 -0
- package/dist/{local-devices/local-device-gateway.js → dial-in/gateway.js} +337 -181
- package/dist/dial-in/handlers.d.ts +47 -0
- package/dist/dial-in/handlers.js +84 -0
- package/dist/dial-in/machines.d.ts +155 -0
- package/dist/dial-in/machines.js +383 -0
- package/dist/dial-in/relay.d.ts +135 -0
- package/dist/dial-in/relay.js +444 -0
- package/dist/dial-in/relay.module.d.ts +7 -0
- package/dist/dial-in/relay.module.js +24 -0
- package/dist/{local-devices/device-routes.d.ts → dial-in/routes.d.ts} +19 -11
- package/dist/{local-devices/device-routes.js → dial-in/routes.js} +45 -25
- package/dist/{local-devices → dial-in}/targets.d.ts +3 -18
- package/dist/{local-devices → dial-in}/targets.js +3 -48
- package/dist/errors.d.ts +8 -27
- package/dist/errors.js +8 -27
- package/dist/extensions/bootstrap.d.ts +5 -0
- package/dist/extensions/bootstrap.js +10 -1
- package/dist/extensions/extensions.module.js +6 -0
- package/dist/extensions/host.d.ts +6 -0
- package/dist/extensions/host.js +12 -2
- package/dist/extensions/permission-set.d.ts +15 -1
- package/dist/extensions/permission-set.js +11 -1
- package/dist/extensions/permission-view.d.ts +1 -1
- package/dist/extensions/permission-view.js +4 -1
- package/dist/http/api.module.js +4 -4
- package/dist/http/gateway-routes.d.ts +1 -1
- package/dist/http/gateway-routes.js +1 -1
- package/dist/http/meta.controller.js +1 -1
- package/dist/identity/settings.d.ts +1 -1
- package/dist/identity/settings.js +6 -8
- package/dist/infra/config/kernel-config.service.js +2 -2
- package/dist/infra/outbox/registry.d.ts +0 -14
- package/dist/infra/outbox/registry.js +0 -15
- package/dist/infra/throttler/named-throttlers.d.ts +1 -1
- package/dist/infra/throttler/named-throttlers.js +1 -1
- package/dist/kernel.module.js +0 -3
- package/dist/orgs/settings.service.js +5 -10
- package/dist/overrides.d.ts +0 -4
- package/dist/overrides.js +0 -2
- package/dist/platform/exclusions.js +5 -5
- package/dist/platform/ops/admin.ops.js +1 -1
- package/dist/platform/ops/conversations.ops.js +5 -2
- package/dist/platform/ops/devices.ops.js +11 -24
- package/dist/platform/ops/inbox.ops.js +1 -1
- package/dist/roles/gateway-role.d.ts +3 -3
- package/dist/roles/gateway-role.js +4 -4
- package/dist/roles/gateway.module.d.ts +1 -1
- package/dist/roles/gateway.module.js +5 -5
- package/dist/runtime/context/device-paths.d.ts +4 -1
- package/dist/runtime/context/permission-profile.js +5 -5
- package/dist/runtime/maintenance.d.ts +2 -5
- package/dist/runtime/maintenance.js +9 -19
- package/dist/runtime/project/knowledge.js +4 -5
- package/dist/runtime/project/knowledge.service.js +2 -1
- package/dist/sandbox/cloud-permission-snapshot.d.ts +1 -1
- package/dist/sandbox/cloud-permission-snapshot.js +1 -3
- package/dist/sandbox/device-reports.d.ts +74 -14
- package/dist/sandbox/device-reports.js +190 -33
- package/dist/sandbox/device-reports.module.d.ts +7 -0
- package/dist/sandbox/device-reports.module.js +25 -0
- package/dist/sandbox/device-sandbox.d.ts +39 -41
- package/dist/sandbox/device-sandbox.js +44 -83
- package/dist/sandbox/kernel-read.d.ts +2 -2
- package/dist/sandbox/legacy-retirement.d.ts +11 -59
- package/dist/sandbox/legacy-retirement.js +34 -186
- package/dist/sandbox/legacy-retirement.module.d.ts +2 -2
- package/dist/sandbox/legacy-retirement.module.js +2 -2
- package/dist/sandbox/managed-device-context.d.ts +16 -4
- package/dist/sandbox/managed-device-context.js +25 -8
- package/dist/sandbox/managed-device-context.module.js +4 -0
- package/dist/sandbox/modes.d.ts +3 -12
- package/dist/sandbox/modes.js +2 -14
- package/dist/{local-devices → sandbox}/network-grants.d.ts +2 -21
- package/dist/{local-devices → sandbox}/network-grants.js +4 -49
- package/dist/sandbox/operation-authority-types.d.ts +2 -1
- package/dist/sandbox/operation-authority.d.ts +6 -20
- package/dist/sandbox/operation-authority.js +43 -104
- package/dist/sandbox/operation-authority.module.js +1 -1
- package/dist/sandbox/operation-intents.d.ts +4 -1
- package/dist/sandbox/operation-intents.js +11 -2
- package/dist/sandbox/operation-reconcile.job.js +2 -4
- package/dist/sandbox/permission-availability.d.ts +6 -7
- package/dist/sandbox/permission-availability.js +7 -10
- package/dist/sandbox/permission-call-grants.d.ts +2 -1
- package/dist/sandbox/permission-call-grants.js +1 -7
- package/dist/sandbox/permission-call-types.d.ts +4 -4
- package/dist/sandbox/permission-ceiling-writes.d.ts +7 -23
- package/dist/sandbox/permission-ceiling-writes.js +8 -35
- package/dist/sandbox/permission-config-publication.d.ts +9 -1
- package/dist/sandbox/permission-config-publication.js +29 -21
- package/dist/sandbox/permission-context-types.d.ts +17 -10
- package/dist/sandbox/permission-facts.d.ts +98 -95
- package/dist/sandbox/permission-facts.js +160 -314
- package/dist/sandbox/permission-instance-writes.d.ts +23 -37
- package/dist/sandbox/permission-instance-writes.js +44 -121
- package/dist/sandbox/permission-runtime-reports.d.ts +38 -30
- package/dist/sandbox/permission-runtime-reports.js +105 -122
- package/dist/sandbox/providers.d.ts +26 -38
- package/dist/sandbox/providers.js +36 -18
- package/dist/sandbox/request-not-sent.d.ts +2 -13
- package/dist/sandbox/request-not-sent.js +2 -13
- package/dist/sandbox/review/permission-candidate.d.ts +13 -8
- package/dist/sandbox/review/permission-candidate.js +38 -48
- package/dist/sandbox/sandbox.module.js +7 -3
- package/dist/sandbox/sandbox.service.d.ts +49 -59
- package/dist/sandbox/sandbox.service.js +139 -259
- package/dist/schedules/fire.d.ts +15 -6
- package/dist/schedules/fire.js +27 -13
- package/dist/schedules/grant-rules.js +1 -1
- package/dist/schedules/scheduled-tasks.service.d.ts +0 -7
- package/dist/schedules/scheduled-tasks.service.js +1 -4
- package/dist/schedules/schedules.module.js +5 -3
- package/dist/skills/invoke.d.ts +1 -1
- package/dist/skills/invoke.js +2 -3
- package/dist/tools/approvals.service.d.ts +8 -5
- package/dist/tools/approvals.service.js +5 -5
- package/dist/tools/builtins/sandbox/bash.js +1 -2
- package/dist/tools/builtins/sandbox/common.d.ts +15 -9
- package/dist/tools/builtins/sandbox/common.js +37 -38
- package/dist/tools/network-asks.d.ts +19 -22
- package/dist/tools/network-asks.js +15 -21
- package/dist/tools/pipeline.d.ts +6 -7
- package/dist/tools/pipeline.js +17 -21
- package/dist/tools/tools.module.js +3 -7
- package/package.json +3 -4
- package/src/migrations/0177_dial_in_contract.sql +32 -0
- package/dist/local-devices/device-auth.module.d.ts +0 -7
- package/dist/local-devices/device-auth.module.js +0 -25
- package/dist/local-devices/device-policy.service.d.ts +0 -213
- package/dist/local-devices/device-policy.service.js +0 -605
- package/dist/local-devices/instance-bindings.d.ts +0 -82
- package/dist/local-devices/instance-bindings.js +0 -307
- package/dist/local-devices/local-device-gateway.d.ts +0 -153
- package/dist/local-devices/local-device-provider.d.ts +0 -122
- package/dist/local-devices/local-device-provider.js +0 -326
- package/dist/local-devices/local-devices.module.d.ts +0 -31
- package/dist/local-devices/local-devices.module.js +0 -100
- package/dist/local-devices/machines.d.ts +0 -211
- package/dist/local-devices/machines.js +0 -766
- package/dist/local-devices/owner-report.d.ts +0 -81
- package/dist/local-devices/owner-report.js +0 -150
- package/dist/local-devices/owner-reports.d.ts +0 -48
- package/dist/local-devices/owner-reports.js +0 -208
- package/dist/local-devices/policy-op-jobs.d.ts +0 -15
- package/dist/local-devices/policy-op-jobs.js +0 -12
- package/dist/local-devices/policy-summary.d.ts +0 -102
- package/dist/local-devices/policy-summary.js +0 -155
- package/dist/local-devices/relay.d.ts +0 -166
- package/dist/local-devices/relay.js +0 -559
- package/dist/tools/device-op-resolver.d.ts +0 -34
- package/dist/tools/device-op-resolver.js +0 -120
- /package/dist/{local-devices → dial-in}/keys.d.ts +0 -0
- /package/dist/{local-devices → dial-in}/keys.js +0 -0
- /package/dist/{local-devices → sandbox}/network-grants.module.d.ts +0 -0
- /package/dist/{local-devices → sandbox}/network-grants.module.js +0 -0
|
@@ -26,15 +26,15 @@ export function orgHostsOf(platform, org) {
|
|
|
26
26
|
/**
|
|
27
27
|
* Computes the effective device sandbox from its four layers. Pure; no I/O.
|
|
28
28
|
*
|
|
29
|
-
* - `outsideSandbox`: only when the platform, the org
|
|
30
|
-
*
|
|
29
|
+
* - `outsideSandbox`: only when the platform, the org and the provider's support all allow it; an
|
|
30
|
+
* instance-boundary provider never does.
|
|
31
31
|
* - The network ceiling is the narrower of the platform's and the org's (and what the provider can
|
|
32
32
|
* enforce); the kill switch closes it (`none`).
|
|
33
|
-
* - The mode is the device's choice (
|
|
34
|
-
*
|
|
33
|
+
* - The mode is the device's choice (`network_mode`), else the org default, else the platform
|
|
34
|
+
* default, clamped to the ceiling.
|
|
35
35
|
* - Allowlist hosts are the org's effective hosts, narrowed by the device's own list: a device list
|
|
36
|
-
* never adds a host
|
|
37
|
-
*
|
|
36
|
+
* never adds a host, and an empty one adds no narrowing.
|
|
37
|
+
* - `perCallHosts`: only an operation-boundary provider that reports `perOperationHosts`.
|
|
38
38
|
*/
|
|
39
39
|
export function effectiveDeviceSandbox(platform, org, device, provider) {
|
|
40
40
|
const instance = provider.boundary === "instance";
|
|
@@ -45,9 +45,7 @@ export function effectiveDeviceSandbox(platform, org, device, provider) {
|
|
|
45
45
|
? "org"
|
|
46
46
|
: !provider.outsideSandbox || instance
|
|
47
47
|
? "provider"
|
|
48
|
-
:
|
|
49
|
-
? "device"
|
|
50
|
-
: null;
|
|
48
|
+
: null;
|
|
51
49
|
// the network ceiling: platform, then org, then what the provider can enforce
|
|
52
50
|
let ceiling;
|
|
53
51
|
let networkLayer = null;
|
|
@@ -74,9 +72,7 @@ export function effectiveDeviceSandbox(platform, org, device, provider) {
|
|
|
74
72
|
networkLayer = "provider";
|
|
75
73
|
}
|
|
76
74
|
// the device's choice, else the org default, else the platform default; then the ceiling
|
|
77
|
-
const chosen = device.
|
|
78
|
-
? device.network
|
|
79
|
-
: (device.networkMode ?? org.deviceNetwork?.default ?? platform.settings.network.default);
|
|
75
|
+
const chosen = device.networkMode ?? org.deviceNetwork?.default ?? platform.settings.network.default;
|
|
80
76
|
let networkMode = ceiling === "none" || chosen === "none"
|
|
81
77
|
? "none"
|
|
82
78
|
: ceiling === "allowlist"
|
|
@@ -84,22 +80,11 @@ export function effectiveDeviceSandbox(platform, org, device, provider) {
|
|
|
84
80
|
: chosen;
|
|
85
81
|
if (networkMode === "allowlist" && !provider.network.allowlist)
|
|
86
82
|
networkMode = "none";
|
|
87
|
-
// a local owner's allowlist is a ceiling only the machine widens
|
|
88
|
-
if (networkLayer === null && device.location === "local" && device.network === "allowlist")
|
|
89
|
-
networkLayer = "device";
|
|
90
83
|
let hosts = [];
|
|
91
84
|
if (networkMode === "allowlist") {
|
|
92
85
|
const orgHosts = orgHostsOf(platform, org);
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
// (an owner whose network is open narrows nothing: the device takes the kernel's hosts)
|
|
96
|
-
const own = device.location === "local"
|
|
97
|
-
? device.network === "allowlist"
|
|
98
|
-
? device.allowedDomains
|
|
99
|
-
: null
|
|
100
|
-
: device.networkHosts.length > 0
|
|
101
|
-
? device.networkHosts
|
|
102
|
-
: null;
|
|
86
|
+
// the device's own list narrows the org's hosts; an empty one follows them
|
|
87
|
+
const own = device.networkHosts.length > 0 ? device.networkHosts : null;
|
|
103
88
|
hosts =
|
|
104
89
|
own === null
|
|
105
90
|
? [...new Set(orgHosts.map((h) => h.toLowerCase()))]
|
|
@@ -111,67 +96,48 @@ export function effectiveDeviceSandbox(platform, org, device, provider) {
|
|
|
111
96
|
networkCeiling: ceiling,
|
|
112
97
|
hosts,
|
|
113
98
|
outsideSandbox: outsideLayer === null,
|
|
114
|
-
|
|
115
|
-
platform.settings.outsideSandbox === "allowed" &&
|
|
116
|
-
org.outsideSandbox !== "off" &&
|
|
117
|
-
device.restrictedProjectReach === "os-user"
|
|
118
|
-
? "os-user"
|
|
119
|
-
: "workspace",
|
|
99
|
+
perCallHosts: !instance && provider.network.perOperationHosts,
|
|
120
100
|
layer: { network: networkLayer, outsideSandbox: outsideLayer },
|
|
121
101
|
};
|
|
122
102
|
}
|
|
123
103
|
/**
|
|
124
|
-
* The provider layer of a device
|
|
125
|
-
* else
|
|
126
|
-
*
|
|
127
|
-
*
|
|
104
|
+
* The provider layer of a device from its provider's permission support (support v2): the current
|
|
105
|
+
* runtime report, else the support stored with the device's report, the one layer the crossing
|
|
106
|
+
* ceilings and the Full access consent reach both read. With no support known yet, the kernel
|
|
107
|
+
* assumes no crossing for every provider: the networks open to the device's own choice (the
|
|
108
|
+
* provider still enforces its own, and admission refuses until a report is recorded), no per-call
|
|
109
|
+
* host (as an instance boundary) and nothing outside the sandbox. A support that later allows a
|
|
110
|
+
* crossing therefore widens the reach, so a Full access consent given before it no longer holds
|
|
111
|
+
* and the person confirms again with that crossing shown.
|
|
128
112
|
*/
|
|
129
|
-
export function providerLayerOf(
|
|
130
|
-
if (
|
|
113
|
+
export function providerLayerOf(support) {
|
|
114
|
+
if (support !== null)
|
|
131
115
|
return {
|
|
132
|
-
boundary:
|
|
133
|
-
network: { ...
|
|
134
|
-
outsideSandbox:
|
|
135
|
-
};
|
|
136
|
-
return location === "local"
|
|
137
|
-
? {
|
|
138
|
-
boundary: "operation",
|
|
139
|
-
network: { openPublic: true, allowlist: true, perOperationHosts: true },
|
|
140
|
-
outsideSandbox: true,
|
|
141
|
-
}
|
|
142
|
-
: {
|
|
143
|
-
boundary: "instance",
|
|
144
|
-
network: { openPublic: true, allowlist: true, perOperationHosts: false },
|
|
145
|
-
outsideSandbox: false,
|
|
116
|
+
boundary: support.boundary,
|
|
117
|
+
network: { ...support.network },
|
|
118
|
+
outsideSandbox: support.outsideSandbox,
|
|
146
119
|
};
|
|
120
|
+
return {
|
|
121
|
+
boundary: "instance",
|
|
122
|
+
network: { openPublic: true, allowlist: true, perOperationHosts: false },
|
|
123
|
+
outsideSandbox: false,
|
|
124
|
+
};
|
|
147
125
|
}
|
|
148
|
-
export function hostGrantCeiling(box, platform, org
|
|
149
|
-
if (box.boundary === "instance" ||
|
|
126
|
+
export function hostGrantCeiling(box, platform, org) {
|
|
127
|
+
if (box.boundary === "instance" ||
|
|
128
|
+
box.perCallHosts === false ||
|
|
129
|
+
box.networkMode === "none" ||
|
|
130
|
+
platform.egress === "none")
|
|
150
131
|
return { kind: "hosts", hosts: [] };
|
|
151
132
|
// the platform's or org's allowlist ceiling is hard; a provider that cannot enforce the open
|
|
152
133
|
// network clamps the sandbox network, not what an org allows per call
|
|
153
134
|
const hard = box.networkCeiling === "allowlist" && box.layer?.network !== "provider";
|
|
154
|
-
|
|
135
|
+
return hard || platform.orgHosts === "within"
|
|
155
136
|
? { kind: "hosts", hosts: orgHostsOf(platform, org) }
|
|
156
137
|
: {
|
|
157
138
|
kind: "any",
|
|
158
139
|
excluded: [...(org.deviceNetwork?.excludedHosts ?? [])].map((h) => h.toLowerCase()),
|
|
159
140
|
};
|
|
160
|
-
if (owner?.network === "allowlist") {
|
|
161
|
-
const own = owner.allowedDomains;
|
|
162
|
-
if (ceiling.kind === "any") {
|
|
163
|
-
const excluded = ceiling.excluded;
|
|
164
|
-
// an own entry an exclusion covers is dropped; an own wildcard that covers an excluded host
|
|
165
|
-
// stays, with the exclusion carried so that host is still refused
|
|
166
|
-
const hosts = own
|
|
167
|
-
.map((h) => h.toLowerCase())
|
|
168
|
-
.filter((h) => !excluded.some((x) => coversHost(x, h)));
|
|
169
|
-
ceiling = excluded.length ? { kind: "hosts", hosts, excluded } : { kind: "hosts", hosts };
|
|
170
|
-
}
|
|
171
|
-
else
|
|
172
|
-
ceiling = { kind: "hosts", hosts: intersectHosts(ceiling.hosts, own) };
|
|
173
|
-
}
|
|
174
|
-
return ceiling;
|
|
175
141
|
}
|
|
176
142
|
/** Whether a per-call grant may name `host` under `ceiling`. */
|
|
177
143
|
export function hostGrantable(ceiling, host) {
|
|
@@ -193,23 +159,20 @@ export function canonicalHostCeiling(ceiling) {
|
|
|
193
159
|
}
|
|
194
160
|
/**
|
|
195
161
|
* Why a per-call grant for `host` is unavailable on this device, naming who can add it, or null
|
|
196
|
-
* when the grant ceiling covers it ({@link hostGrantCeiling}).
|
|
197
|
-
* named first: the machine's owner can widen only within them.
|
|
162
|
+
* when the grant ceiling covers it ({@link hostGrantCeiling}).
|
|
198
163
|
*/
|
|
199
|
-
export function hostGrantRefusal(host, box, platform, org
|
|
200
|
-
|
|
164
|
+
export function hostGrantRefusal(host, box, platform, org) {
|
|
165
|
+
const ceiling = hostGrantCeiling(box, platform, org);
|
|
166
|
+
if (hostGrantable(ceiling, host))
|
|
201
167
|
return null;
|
|
202
168
|
if (box.networkMode === "none" || platform.egress === "none")
|
|
203
169
|
return "network access is turned off for this device's sandbox";
|
|
204
|
-
if (box.boundary === "instance")
|
|
170
|
+
if (box.boundary === "instance" || box.perCallHosts === false)
|
|
205
171
|
return `a host cannot be granted per call on this device; add ${host} to the device's network list`;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
? `an organization admin adds ${host} to the organization's device network list`
|
|
211
|
-
: `${host} is outside the platform's host list; a super admin adds the host`;
|
|
212
|
-
return `the device owner adds it on the machine: capybara-device policy add allowedDomains ${host}`;
|
|
172
|
+
return (box.networkCeiling === "allowlist" && box.layer?.network !== "provider") ||
|
|
173
|
+
ceiling.kind === "any"
|
|
174
|
+
? `an organization admin adds ${host} to the organization's device network list`
|
|
175
|
+
: `${host} is outside the platform's host list; a super admin adds the host`;
|
|
213
176
|
}
|
|
214
177
|
const MODE_RANK = { none: 0, allowlist: 1, open: 2 };
|
|
215
178
|
/**
|
|
@@ -223,8 +186,6 @@ export function reachWithin(now, consented) {
|
|
|
223
186
|
return false;
|
|
224
187
|
if (MODE_RANK[now.networkMode] > MODE_RANK[consented.networkMode])
|
|
225
188
|
return false;
|
|
226
|
-
if (now.restrictedProjectReach === "os-user" && consented.restrictedProjectReach !== "os-user")
|
|
227
|
-
return false;
|
|
228
189
|
const a = now.hostCeiling, b = consented.hostCeiling;
|
|
229
190
|
// every exclusion consented to still holds now: no host it covers became grantable
|
|
230
191
|
const keepsExclusions = (b.excluded ?? []).every((x) => (a.excluded ?? []).some((y) => coversHost(y, x)) || !hostGrantable(a, x));
|
|
@@ -34,8 +34,8 @@ export declare class KernelReadNotAdmitted extends Error {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* How a kernel read is sent, from the device's recorded runtime support and whether its runtime is
|
|
37
|
-
* isolated (its file system holds no host home:
|
|
38
|
-
*
|
|
37
|
+
* isolated (its provider reports the instance boundary, so its file system holds no host home):
|
|
38
|
+
* `restricted` whenever the runtime enforces the restricted profiles (the read-only
|
|
39
39
|
* scope, whatever the conversation selected); `full` only for an isolated Full-only runtime (the
|
|
40
40
|
* conversation's admitted Full access, still with the one covering path and the read methods);
|
|
41
41
|
* `refused` otherwise (a host machine without restricted enforcement: fail closed).
|
|
@@ -12,21 +12,9 @@ export interface RetirementObligation {
|
|
|
12
12
|
state: "open" | "quarantined" | "resolved" | "abandoned";
|
|
13
13
|
reason: string | null;
|
|
14
14
|
attempts: number;
|
|
15
|
-
/** A local incarnation's boot identity when recorded; null: none (never resolves by itself). */
|
|
16
|
-
bootId: string | null;
|
|
17
15
|
/** When it was recorded (a cloud `unknown` one resolves only if recorded after the freeze). */
|
|
18
16
|
createdAt: Date;
|
|
19
17
|
}
|
|
20
|
-
/** {@link LegacyRetirementStore.recordBoot}'s answer. */
|
|
21
|
-
export type BootReport =
|
|
22
|
-
/** First seen for the machine: its current boot now (a restart when one was seen before). */
|
|
23
|
-
"new"
|
|
24
|
-
/** The machine's current boot again (a reconnect). */
|
|
25
|
-
| "current"
|
|
26
|
-
/** A boot seen before a later one (stale or replayed): ignored. */
|
|
27
|
-
| "stale"
|
|
28
|
-
/** Malformed, or the machine is unknown or revoked: ignored. */
|
|
29
|
-
| "ignored";
|
|
30
18
|
/** {@link LegacyRetirementStore.freeze}'s answer: the freeze is published and enumerated. */
|
|
31
19
|
export interface LegacyFreezeResult {
|
|
32
20
|
/** When the freeze was first published (a rerun keeps it). */
|
|
@@ -107,8 +95,6 @@ export interface LegacyRetirementReport {
|
|
|
107
95
|
deviceId: string;
|
|
108
96
|
provider: string;
|
|
109
97
|
instanceGeneration: string;
|
|
110
|
-
local: boolean;
|
|
111
|
-
bootKnown: boolean;
|
|
112
98
|
abandonedAt: Date;
|
|
113
99
|
}[];
|
|
114
100
|
/**
|
|
@@ -129,24 +115,12 @@ export interface LegacyRetirementReport {
|
|
|
129
115
|
noInstance: boolean;
|
|
130
116
|
currentUnconfirmed: boolean;
|
|
131
117
|
}[];
|
|
132
|
-
/**
|
|
133
|
-
* The cutover pre-check (before the freeze, too): local devices with legacy rows whose processes
|
|
134
|
-
* may still exist and whose current machine has no recorded boot identity. Their obligations
|
|
135
|
-
* could never resolve by a restart: ship the boot-reporting device build and wait for these to
|
|
136
|
-
* report before publishing the freeze.
|
|
137
|
-
*/
|
|
138
|
-
localWithoutBoot: {
|
|
139
|
-
deviceId: string;
|
|
140
|
-
machineId: string | null;
|
|
141
|
-
}[];
|
|
142
118
|
unresolved: {
|
|
143
119
|
deviceId: string;
|
|
144
120
|
provider: string;
|
|
145
121
|
instanceGeneration: string;
|
|
146
122
|
state: "open" | "quarantined";
|
|
147
123
|
reason: string | null;
|
|
148
|
-
/** A local incarnation with a recorded boot: a restart of that computer resolves it. */
|
|
149
|
-
bootKnown: boolean;
|
|
150
124
|
}[];
|
|
151
125
|
}
|
|
152
126
|
/** A member of an obligation (a legacy task row, or a revoked managed start). */
|
|
@@ -155,8 +129,12 @@ export interface RetirementMember {
|
|
|
155
129
|
kind: "legacy-task" | "revoked-start";
|
|
156
130
|
refId: string;
|
|
157
131
|
}
|
|
158
|
-
/**
|
|
159
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Whether `provider` names a provider (one whose whole-instance destroy is confirmed): any
|
|
134
|
+
* recorded provider, the same for every one, never the `unknown` of an incarnation the kernel
|
|
135
|
+
* cannot name.
|
|
136
|
+
*/
|
|
137
|
+
export declare const isKnownProvider: (provider: string) => boolean;
|
|
160
138
|
export declare class LegacyRetirementStore {
|
|
161
139
|
private readonly db;
|
|
162
140
|
readonly txHost: TransactionHost;
|
|
@@ -183,11 +161,11 @@ export declare class LegacyRetirementStore {
|
|
|
183
161
|
/**
|
|
184
162
|
* The worker's sweep of obligations whose device is gone (its row missing, `deleted_at` set, or
|
|
185
163
|
* its org soft-deleted), at most `limit` per call:
|
|
186
|
-
* -
|
|
164
|
+
* - one waits while the device's instance row exists:
|
|
187
165
|
* its destroy is still owed (the destroy job or the destruction sweep deletes the row when it
|
|
188
166
|
* is done) and records the destruction then;
|
|
189
167
|
* - one whose exact incarnation has a recorded confirmed destruction resolves
|
|
190
|
-
* `provider-destroyed`, an already `abandoned`
|
|
168
|
+
* `provider-destroyed`, an already `abandoned` one too (provider evidence, not a
|
|
191
169
|
* reopen);
|
|
192
170
|
* - every other one becomes `abandoned`. Device ids are never reused, so no device can acquire
|
|
193
171
|
* that incarnation again, but abandonment is no evidence that its processes ended (they may
|
|
@@ -225,32 +203,6 @@ export declare class LegacyRetirementStore {
|
|
|
225
203
|
private scanRevokedStarts;
|
|
226
204
|
/** The obligation of the incarnation (created when missing), with the member added. */
|
|
227
205
|
private addMember;
|
|
228
|
-
/** The device's active machine and the boot it reported last (null: no machine). */
|
|
229
|
-
private currentBoot;
|
|
230
|
-
/**
|
|
231
|
-
* Records the OS boot identity an authenticated hello of `machineId` reported. The caller is the
|
|
232
|
-
* gateway's hello record, after the connection authenticated with the machine's credential and
|
|
233
|
-
* claimed the device, inside its transaction with the machine row locked. A boot first seen for
|
|
234
|
-
* the machine becomes its current one; the current one again is a reconnect; one seen before a
|
|
235
|
-
* later one (stale, replayed) changes nothing. A new or current boot then settles the device's
|
|
236
|
-
* local obligations recorded under another boot of the computer ({@link settleRebooted}).
|
|
237
|
-
*/
|
|
238
|
-
recordBoot(machineId: string, bootId: unknown): Promise<BootReport>;
|
|
239
|
-
/**
|
|
240
|
-
* A hello without a boot identity: the machine has no current boot any more, so a boot it
|
|
241
|
-
* reported earlier is never taken as the one its later work ran under (M2).
|
|
242
|
-
*/
|
|
243
|
-
clearBoot(machineId: string): Promise<void>;
|
|
244
|
-
/**
|
|
245
|
-
* Resolves (`host-rebooted`) every unresolved local obligation of the device for which a current
|
|
246
|
-
* (non-revoked) machine of the device has recorded a boot other than the obligation's: the
|
|
247
|
-
* evidence is the OS instance, not the credential, so a re-login on the same computer reporting
|
|
248
|
-
* the same boot changes nothing, and one after a restart (or any later boot) resolves it. A boot
|
|
249
|
-
* that some machine of the device had already reported when the obligation's boot was first
|
|
250
|
-
* seen is an older boot, never evidence (a replay through another credential). An obligation
|
|
251
|
-
* without a recorded boot never resolves here. Returns how many resolved.
|
|
252
|
-
*/
|
|
253
|
-
settleRebooted(deviceId: string): Promise<number>;
|
|
254
206
|
/** The device's unresolved obligations (open and quarantined), oldest first. */
|
|
255
207
|
unresolved(deviceId: string): Promise<RetirementObligation[]>;
|
|
256
208
|
/**
|
|
@@ -293,11 +245,11 @@ export declare class LegacyRetirementStore {
|
|
|
293
245
|
/** The members of one obligation, oldest first. */
|
|
294
246
|
membersOf(obligationId: string): Promise<RetirementMember[]>;
|
|
295
247
|
/**
|
|
296
|
-
* Records the provider-confirmed destruction of
|
|
297
|
-
* provider
|
|
248
|
+
* Records the provider-confirmed destruction of an incarnation, the same for every provider (a
|
|
249
|
+
* provider is trusted like every extension). An `unknown` provider names nothing and is refused.
|
|
298
250
|
*/
|
|
299
251
|
recordDestruction(deviceId: string, provider: string, generation: string): Promise<void>;
|
|
300
|
-
/** Whether a confirmed destruction of exactly that
|
|
252
|
+
/** Whether a confirmed destruction of exactly that incarnation was recorded. */
|
|
301
253
|
destructionRecorded(deviceId: string, provider: string, generation: string): Promise<boolean>;
|
|
302
254
|
/**
|
|
303
255
|
* Devices with an unresolved obligation the worker should try now: never attempted, or last
|