@capybara-hq/kernel 0.1.0-rc.54 → 0.1.0-rc.55
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.schemas.d.ts +11 -1
- package/dist/catalog/catalog.module.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/requests.service.d.ts +5 -5
- package/dist/catalog/requests.service.js +9 -9
- package/dist/channels/cards.d.ts +4 -3
- package/dist/channels/cards.js +25 -16
- package/dist/channels/phrases.d.ts +15 -4
- package/dist/channels/phrases.js +15 -1
- package/dist/config/load.d.ts +26 -7
- package/dist/config/load.js +60 -9
- package/dist/config/permission-migration.d.ts +17 -9
- package/dist/config/permission-migration.js +60 -9
- package/dist/config/schema.d.ts +11 -1
- package/dist/config/schema.js +37 -11
- package/dist/conversations/events.d.ts +247 -5
- package/dist/conversations/events.js +127 -16
- package/dist/conversations/permission-profiles.controller.d.ts +12 -2
- package/dist/conversations/permission-profiles.service.d.ts +12 -2
- package/dist/conversations/permission-profiles.service.js +11 -4
- package/dist/db/kernel-schema.d.ts +8 -2
- package/dist/devices/device-projects.service.d.ts +1 -1
- package/dist/devices/device-projects.service.js +6 -6
- package/dist/devices/devices.controller.d.ts +10 -8
- package/dist/devices/devices.controller.js +14 -18
- package/dist/devices/devices.schemas.d.ts +5 -5
- package/dist/devices/devices.schemas.js +5 -5
- package/dist/devices/devices.service.d.ts +188 -175
- package/dist/devices/devices.service.js +284 -292
- package/dist/devices/dto.d.ts +43 -23
- package/dist/devices/dto.js +45 -49
- package/dist/devices/project-rules.d.ts +0 -10
- package/dist/devices/project-rules.js +0 -5
- package/dist/errors.d.ts +24 -19
- package/dist/errors.js +24 -19
- package/dist/evals/reconstruct.d.ts +12 -3
- package/dist/evals/reconstruct.js +10 -6
- package/dist/evals/recorded-permission-context.d.ts +6 -4
- package/dist/evals/recorded-permission-context.js +15 -9
- package/dist/evals/run-replay.d.ts +6 -1
- package/dist/evals/run-replay.js +7 -2
- package/dist/evals/worker.js +3 -1
- package/dist/identity/settings.d.ts +45 -18
- package/dist/identity/settings.js +151 -51
- package/dist/infra/config/kernel-config.service.d.ts +1 -1
- package/dist/infra/config/kernel-config.service.js +17 -5
- package/dist/local-devices/device-auth.controller.d.ts +1 -1
- package/dist/local-devices/device-auth.controller.js +1 -1
- package/dist/local-devices/device-auth.d.ts +4 -4
- package/dist/local-devices/device-auth.js +1 -1
- package/dist/local-devices/device-policy.service.d.ts +18 -9
- package/dist/local-devices/device-policy.service.js +21 -61
- package/dist/local-devices/device-routes.d.ts +3 -1
- package/dist/local-devices/device-routes.js +15 -4
- package/dist/local-devices/instance-bindings.js +5 -2
- package/dist/local-devices/local-device-gateway.d.ts +2 -2
- package/dist/local-devices/local-device-gateway.js +3 -3
- package/dist/local-devices/local-device-provider.d.ts +4 -4
- package/dist/local-devices/local-device-provider.js +23 -9
- package/dist/local-devices/local-devices.module.d.ts +1 -1
- package/dist/local-devices/local-devices.module.js +1 -1
- package/dist/local-devices/machines.d.ts +40 -16
- package/dist/local-devices/machines.js +89 -61
- package/dist/local-devices/owner-report.d.ts +16 -14
- package/dist/local-devices/owner-report.js +24 -30
- package/dist/local-devices/owner-reports.js +26 -8
- package/dist/local-devices/policy-summary.d.ts +25 -44
- package/dist/local-devices/policy-summary.js +26 -71
- package/dist/local-devices/relay.d.ts +6 -6
- package/dist/local-devices/relay.js +10 -8
- package/dist/net/public-address.d.ts +1 -1
- package/dist/net/public-address.js +5 -2
- package/dist/orgs/device-network-setting.d.ts +82 -0
- package/dist/orgs/device-network-setting.js +142 -0
- package/dist/orgs/settings.service.d.ts +103 -66
- package/dist/orgs/settings.service.js +201 -137
- package/dist/overrides.d.ts +5 -1
- package/dist/overrides.js +2 -0
- package/dist/platform/exclusions.js +1 -1
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/admin.ops.js +20 -11
- package/dist/platform/ops/devices.ops.js +70 -5
- package/dist/platform/ops/org-settings.ops.js +10 -6
- package/dist/platform/ops/orgs.ops.js +2 -1
- package/dist/runtime/context/permission-profile.d.ts +17 -8
- package/dist/runtime/context/permission-profile.js +126 -45
- package/dist/runtime/permission-context.service.d.ts +1 -1
- package/dist/runtime/permission-context.service.js +5 -3
- package/dist/runtime/project/knowledge.d.ts +5 -4
- package/dist/runtime/project/knowledge.js +2 -1
- package/dist/runtime/project/knowledge.service.js +16 -13
- package/dist/sandbox/cloud-permission-snapshot.js +22 -3
- package/dist/sandbox/device-sandbox-settings.d.ts +230 -0
- package/dist/sandbox/device-sandbox-settings.js +470 -0
- package/dist/sandbox/device-sandbox.d.ts +187 -0
- package/dist/sandbox/device-sandbox.js +236 -0
- package/dist/sandbox/held-operations.js +15 -7
- package/dist/sandbox/modes.d.ts +49 -24
- package/dist/sandbox/modes.js +27 -19
- package/dist/sandbox/operation-authority-types.d.ts +6 -5
- package/dist/sandbox/operation-authority-types.js +7 -8
- package/dist/sandbox/operation-authority.d.ts +23 -9
- package/dist/sandbox/operation-authority.js +179 -97
- package/dist/sandbox/permission-auto-grants.d.ts +42 -0
- package/dist/sandbox/permission-auto-grants.js +145 -0
- package/dist/sandbox/permission-call-grants.d.ts +12 -4
- package/dist/sandbox/permission-call-grants.js +84 -35
- package/dist/sandbox/permission-call-grants.module.js +10 -3
- package/dist/sandbox/permission-call-types.d.ts +39 -5
- package/dist/sandbox/permission-ceiling-writes.d.ts +29 -3
- package/dist/sandbox/permission-ceiling-writes.js +38 -4
- package/dist/sandbox/permission-config-publication.d.ts +44 -2
- package/dist/sandbox/permission-config-publication.js +230 -59
- package/dist/sandbox/permission-context-types.d.ts +2 -2
- package/dist/sandbox/permission-facts.d.ts +144 -15
- package/dist/sandbox/permission-facts.js +258 -70
- package/dist/sandbox/permission-runtime-reports.d.ts +5 -4
- package/dist/sandbox/permission-runtime-reports.js +19 -29
- package/dist/sandbox/review/classifier.d.ts +8 -0
- package/dist/sandbox/review/classifier.js +10 -0
- package/dist/sandbox/review/permission-candidate.d.ts +69 -5
- package/dist/sandbox/review/permission-candidate.js +153 -30
- package/dist/sandbox/review/review.service.d.ts +19 -3
- package/dist/sandbox/review/review.service.js +59 -11
- package/dist/sandbox/review/rules.js +23 -3
- package/dist/sandbox/sandbox.service.d.ts +29 -11
- package/dist/sandbox/sandbox.service.js +51 -26
- package/dist/skills/invoke.js +3 -2
- package/dist/tools/approvals.service.d.ts +26 -116
- package/dist/tools/approvals.service.js +42 -346
- package/dist/tools/builtins/sandbox/bash.d.ts +16 -3
- package/dist/tools/builtins/sandbox/bash.js +80 -28
- package/dist/tools/builtins/sandbox/common.d.ts +39 -14
- package/dist/tools/builtins/sandbox/common.js +47 -24
- package/dist/tools/builtins/sandbox/deliver.js +7 -4
- package/dist/tools/builtins/skill-load.d.ts +2 -2
- package/dist/tools/builtins/skill-load.js +4 -3
- package/dist/tools/device-op-resolver.d.ts +4 -10
- package/dist/tools/device-op-resolver.js +8 -19
- package/dist/tools/network-asks.d.ts +52 -15
- package/dist/tools/network-asks.js +55 -25
- package/dist/tools/pipeline.d.ts +26 -14
- package/dist/tools/pipeline.js +144 -61
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/tools.module.js +1 -1
- package/package.json +4 -4
- package/src/migrations/0165_device_network_columns.sql +50 -0
- package/src/migrations/0166_permission_grant_full_access.sql +17 -0
- package/src/migrations/0167_device_network_backfill.sql +32 -0
- package/src/migrations/0168_binding_installed_connection.sql +6 -0
- package/dist/orgs/cloud-network-setting.d.ts +0 -33
- package/dist/orgs/cloud-network-setting.js +0 -47
- package/dist/sandbox/platform-full-access.d.ts +0 -110
- package/dist/sandbox/platform-full-access.js +0 -198
|
@@ -5,8 +5,8 @@ import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
|
5
5
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
6
6
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
7
7
|
import type { KernelLogger } from "../log.js";
|
|
8
|
+
import { type DeviceSandboxSettingsView, type DevicesNetworkPatch, type DevicesNetworkStored, type DevicesNetworkView, type DevicesOutsideSandboxPatch, type DevicesOutsideSandboxStored, type DevicesOutsideSandboxView } from "../sandbox/device-sandbox-settings.js";
|
|
8
9
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
9
|
-
import { type DevicesFullAccessPatch, type DevicesFullAccessStored, type DevicesFullAccessView } from "../sandbox/platform-full-access.js";
|
|
10
10
|
import { type ExternalSharingView, type ShareMaxExpiryView } from "../shares/settings.js";
|
|
11
11
|
import { type UiArrangement } from "../ui/arrangement.js";
|
|
12
12
|
import { SuperAdminLock } from "./super-admin.js";
|
|
@@ -163,13 +163,16 @@ export declare const DEPLOYMENT_SETTINGS: z.ZodObject<{
|
|
|
163
163
|
}, z.core.$strip>;
|
|
164
164
|
export type DeploymentSettings = z.infer<typeof DEPLOYMENT_SETTINGS>;
|
|
165
165
|
/**
|
|
166
|
-
* What `GET /api/v1/admin/settings` answers: the stored settings, the platform's
|
|
167
|
-
*
|
|
168
|
-
* read-only here; `db`: chosen in the admin console; `default`), and the platform's
|
|
169
|
-
* attribution defaults with their sources the same way.
|
|
166
|
+
* What `GET /api/v1/admin/settings` answers: the stored settings, the platform's device sandbox
|
|
167
|
+
* settings as they are in effect with where each comes from (`env` / `file` / `nacos`: the startup
|
|
168
|
+
* config, read-only here; `db`: chosen in the admin console; `default`), and the platform's
|
|
169
|
+
* effective attribution defaults with their sources the same way.
|
|
170
170
|
*/
|
|
171
171
|
export type DeploymentSettingsView = DeploymentSettings & {
|
|
172
|
-
|
|
172
|
+
/** Whether a device may be granted running a call outside its sandbox. */
|
|
173
|
+
devicesOutsideSandbox: DevicesOutsideSandboxView;
|
|
174
|
+
/** The sandbox network's default and ceiling (the default never above the ceiling). */
|
|
175
|
+
devicesNetwork: DevicesNetworkView;
|
|
173
176
|
attribution: PlatformAttributionView;
|
|
174
177
|
/** The platform's external sharing switch in effect and where it comes from. */
|
|
175
178
|
externalSharing: ExternalSharingView;
|
|
@@ -227,12 +230,22 @@ export declare const DEPLOYMENT_SETTINGS_PATCH: z.ZodObject<{
|
|
|
227
230
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
228
231
|
disabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
232
|
}, z.core.$strict>>;
|
|
230
|
-
|
|
233
|
+
devicesOutsideSandbox: z.ZodOptional<z.ZodObject<{
|
|
231
234
|
permission: z.ZodNullable<z.ZodEnum<{
|
|
232
235
|
allowed: "allowed";
|
|
233
236
|
off: "off";
|
|
234
237
|
}>>;
|
|
235
238
|
}, z.core.$strict>>;
|
|
239
|
+
devicesNetwork: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
default: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
241
|
+
allowlist: "allowlist";
|
|
242
|
+
open: "open";
|
|
243
|
+
}>>>;
|
|
244
|
+
ceiling: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
245
|
+
allowlist: "allowlist";
|
|
246
|
+
open: "open";
|
|
247
|
+
}>>>;
|
|
248
|
+
}, z.core.$strict>>;
|
|
236
249
|
attribution: z.ZodOptional<z.ZodObject<{
|
|
237
250
|
commit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
238
251
|
pr: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -312,26 +325,39 @@ export declare class SettingsService {
|
|
|
312
325
|
readonly txHost: TransactionHost;
|
|
313
326
|
private readonly adminLock;
|
|
314
327
|
private readonly log;
|
|
315
|
-
/** The startup config's `devices.
|
|
328
|
+
/** The startup config's `devices.outsideSandbox` / `devices.network.*`, which win over the stored choice. */
|
|
316
329
|
private readonly config;
|
|
317
330
|
private readonly ceilings;
|
|
318
331
|
constructor(db: KernelDb, txHost: TransactionHost, adminLock: SuperAdminLock, log: Pick<KernelLogger, "warn">,
|
|
319
|
-
/** The startup config's `devices.
|
|
332
|
+
/** The startup config's `devices.outsideSandbox` / `devices.network.*`, which win over the stored choice. */
|
|
320
333
|
config: Pick<KernelConfigService, "get" | "fieldSource">, ceilings: PermissionCeilingWrites);
|
|
321
|
-
/** The settings with the platform's
|
|
334
|
+
/** The settings with the platform's device sandbox settings and attribution defaults in effect. */
|
|
322
335
|
view(): Promise<DeploymentSettingsView>;
|
|
323
336
|
private attributionView;
|
|
337
|
+
/** The cloud devices following the platform's network default (their org sets none). */
|
|
338
|
+
private devicesFollowingPlatformDefault;
|
|
324
339
|
/**
|
|
325
|
-
* The refusals of a `
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
340
|
+
* The refusals of a `devicesOutsideSandbox` / `devicesNetwork` change against the stored choice
|
|
341
|
+
* and the startup config: a field set in the startup config (`deployment.setting_readonly`); a
|
|
342
|
+
* network default above the effective ceiling (`deployment.network_not_allowed`); and, with
|
|
343
|
+
* `onlyNarrows` (an API token, the Platform tool), any widening: allowing outside-sandbox runs
|
|
344
|
+
* where it is off (`deployment.outside_sandbox_not_allowed`; clearing it goes back to the default
|
|
345
|
+
* allowed, a widening too) or a network default or ceiling opened where it is the allowlist
|
|
346
|
+
* (`deployment.network_not_allowed`). Returns the next stored choices and the effective view
|
|
347
|
+
* before and after.
|
|
329
348
|
*/
|
|
330
|
-
|
|
349
|
+
checkDeviceSandbox(patch: {
|
|
350
|
+
devicesOutsideSandbox?: DevicesOutsideSandboxPatch | undefined;
|
|
351
|
+
devicesNetwork?: DevicesNetworkPatch | undefined;
|
|
352
|
+
}, opts?: {
|
|
331
353
|
onlyNarrows?: boolean;
|
|
332
354
|
}): Promise<{
|
|
333
|
-
next:
|
|
334
|
-
|
|
355
|
+
next: {
|
|
356
|
+
outsideSandbox: DevicesOutsideSandboxStored;
|
|
357
|
+
network: DevicesNetworkStored;
|
|
358
|
+
};
|
|
359
|
+
before: DeviceSandboxSettingsView;
|
|
360
|
+
after: DeviceSandboxSettingsView;
|
|
335
361
|
}>;
|
|
336
362
|
/**
|
|
337
363
|
* The refusals of an `externalSharing` / `shareMaxExpiryDays` / `htmlRenderCdnAllowlist` change:
|
|
@@ -358,7 +384,8 @@ export declare class SettingsService {
|
|
|
358
384
|
get(): Promise<DeploymentSettings>;
|
|
359
385
|
/**
|
|
360
386
|
* Updates settings under the super admin lock, re-checking the actor (else `forbidden`).
|
|
361
|
-
* `onlyNarrows` (an API token, the Platform tool): `
|
|
387
|
+
* `onlyNarrows` (an API token, the Platform tool): `devicesOutsideSandbox` may only turn it off,
|
|
388
|
+
* `devicesNetwork` may only narrow to the allowlist,
|
|
362
389
|
* `externalSharing` may only turn external sharing off, `shareMaxExpiryDays` may only decrease and
|
|
363
390
|
* `htmlRenderCdnAllowlist` may only shrink.
|
|
364
391
|
*/
|
|
@@ -17,8 +17,8 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
17
17
|
import { TransactionHost, withOrderedLocks } from "../infra/database/transaction-host.js";
|
|
18
18
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
19
19
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { applyDevicesNetworkPatch, applyDevicesOutsideSandboxPatch, configuredDeviceSandbox, DEVICES_NETWORK_PATCH, DEVICES_NETWORK_SETTING, DEVICES_OUTSIDE_SANDBOX_PATCH, DEVICES_OUTSIDE_SANDBOX_SETTING, legacyPermissionFor, legacyPlatformKeysStored, legacyPlatformValue, orgDeviceSandboxOf, readDeviceSandboxSettingsView, readStoredDeviceSandbox, resolveDeviceSandboxSettings, } from "../sandbox/device-sandbox-settings.js";
|
|
21
|
+
import { cloudDevicesFollowingDefault, localMachineRoots, needsOpenNetwork, needsWiderDeviceCeiling, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
|
|
22
22
|
import { EXTERNAL_SHARING_SETTING, ExternalSharingValue, HTML_CDN_ALLOWLIST_DEFAULT, HtmlCdnAllowlistSchema, readExternalSharing, readHtmlCdnAllowlist, readShareMaxExpiry, SHARE_MAX_EXPIRY_DEFAULT, SHARE_MAX_EXPIRY_SETTING, ShareMaxExpiryDays, } from "../shares/settings.js";
|
|
23
23
|
import { assertPlatformDefaultEligible, lockThemeShared } from "../themes/theme-state.js";
|
|
24
24
|
import { mergeArrangement, UiArrangementPatchSchema, UiArrangementSchema, } from "../ui/arrangement.js";
|
|
@@ -218,7 +218,8 @@ export const DEPLOYMENT_SETTINGS = z.object({
|
|
|
218
218
|
htmlRenderCdnAllowlist: HtmlCdnAllowlistSchema.default(() => [...HTML_CDN_ALLOWLIST_DEFAULT]),
|
|
219
219
|
});
|
|
220
220
|
const DEFAULTS = DEPLOYMENT_SETTINGS.parse({});
|
|
221
|
-
const
|
|
221
|
+
const outsideSandboxWidenRefused = () => new ApiError("deployment.outside_sandbox_not_allowed", "Allowing devices to run outside the sandbox at the platform level (devicesOutsideSandbox) needs a super admin in the admin console; an API token or the Platform tool may only turn it off.");
|
|
222
|
+
const networkNotAllowed = (message, field) => new ApiError("deployment.network_not_allowed", message, [{ path: `devicesNetwork.${field}` }]);
|
|
222
223
|
/** The `deployment_settings` key of the platform's prompt suggestions switch (`"on" | "off"`). */
|
|
223
224
|
export const PROMPT_SUGGESTIONS_SETTING = "promptSuggestions";
|
|
224
225
|
const PromptSuggestionsValue = z.enum(["on", "off"]);
|
|
@@ -290,12 +291,19 @@ export const DEPLOYMENT_SETTINGS_PATCH = z
|
|
|
290
291
|
})
|
|
291
292
|
.optional(),
|
|
292
293
|
/**
|
|
293
|
-
* The platform's
|
|
294
|
-
*
|
|
294
|
+
* The platform's outside-sandbox ceiling: `permission` replaced, null clears it (back to the
|
|
295
|
+
* default, allowed). A value set in the startup config is read-only (409
|
|
295
296
|
* `deployment.setting_readonly`); an API token or the Platform tool may only turn it off (400
|
|
296
|
-
* `deployment.
|
|
297
|
+
* `deployment.outside_sandbox_not_allowed`).
|
|
297
298
|
*/
|
|
298
|
-
|
|
299
|
+
devicesOutsideSandbox: DEVICES_OUTSIDE_SANDBOX_PATCH.optional(),
|
|
300
|
+
/**
|
|
301
|
+
* The platform's sandbox network: each given field replaces the stored one, null clears it
|
|
302
|
+
* (back to the default, open). A default above the ceiling, or (an API token or the Platform
|
|
303
|
+
* tool) any widening is refused (400 `deployment.network_not_allowed`); a field set in the
|
|
304
|
+
* startup config is read-only (409 `deployment.setting_readonly`).
|
|
305
|
+
*/
|
|
306
|
+
devicesNetwork: DEVICES_NETWORK_PATCH.optional(),
|
|
299
307
|
/**
|
|
300
308
|
* The platform's attribution defaults for agent-created git commits and pull requests (spec
|
|
301
309
|
* 2026-11-14-agent-attribution): each given field replaces the stored one, null clears it
|
|
@@ -496,7 +504,7 @@ let SettingsService = class SettingsService {
|
|
|
496
504
|
config;
|
|
497
505
|
ceilings;
|
|
498
506
|
constructor(db, txHost, adminLock, log,
|
|
499
|
-
/** The startup config's `devices.
|
|
507
|
+
/** The startup config's `devices.outsideSandbox` / `devices.network.*`, which win over the stored choice. */
|
|
500
508
|
config, ceilings) {
|
|
501
509
|
this.db = db;
|
|
502
510
|
this.txHost = txHost;
|
|
@@ -505,11 +513,11 @@ let SettingsService = class SettingsService {
|
|
|
505
513
|
this.config = config;
|
|
506
514
|
this.ceilings = ceilings;
|
|
507
515
|
}
|
|
508
|
-
/** The settings with the platform's
|
|
516
|
+
/** The settings with the platform's device sandbox settings and attribution defaults in effect. */
|
|
509
517
|
async view() {
|
|
510
|
-
const [settings,
|
|
518
|
+
const [settings, deviceSandbox, attribution, externalSharing, shareMaxExpiryDays, promptSuggestions,] = await Promise.all([
|
|
511
519
|
this.get(),
|
|
512
|
-
|
|
520
|
+
readDeviceSandboxSettingsView(this.db.db, this.config, this.log),
|
|
513
521
|
readStoredPlatformAttribution(this.db.db, this.log),
|
|
514
522
|
readExternalSharing(this.db.db, this.config, this.log),
|
|
515
523
|
readShareMaxExpiry(this.db.db, this.config, this.log),
|
|
@@ -517,7 +525,8 @@ let SettingsService = class SettingsService {
|
|
|
517
525
|
]);
|
|
518
526
|
return {
|
|
519
527
|
...settings,
|
|
520
|
-
|
|
528
|
+
devicesOutsideSandbox: deviceSandbox.outsideSandbox,
|
|
529
|
+
devicesNetwork: deviceSandbox.network,
|
|
521
530
|
attribution: this.attributionView(attribution),
|
|
522
531
|
externalSharing,
|
|
523
532
|
shareMaxExpiryDays,
|
|
@@ -532,24 +541,82 @@ let SettingsService = class SettingsService {
|
|
|
532
541
|
]));
|
|
533
542
|
return { ...resolvePlatformAttribution(config, stored), sources };
|
|
534
543
|
}
|
|
544
|
+
/** The cloud devices following the platform's network default (their org sets none). */
|
|
545
|
+
async devicesFollowingPlatformDefault() {
|
|
546
|
+
const devices = await cloudDevicesFollowingDefault(this.db.db);
|
|
547
|
+
const orgs = await this.db.selectFrom("orgs").select(["id", "settings"]).execute();
|
|
548
|
+
const ownDefault = new Set(orgs
|
|
549
|
+
.filter((o) => orgDeviceSandboxOf(o.settings).deviceNetwork?.default !== undefined)
|
|
550
|
+
.map((o) => o.id));
|
|
551
|
+
return new Set([...devices].filter(([, org]) => !ownDefault.has(org)).map(([id]) => id));
|
|
552
|
+
}
|
|
535
553
|
/**
|
|
536
|
-
* The refusals of a `
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
554
|
+
* The refusals of a `devicesOutsideSandbox` / `devicesNetwork` change against the stored choice
|
|
555
|
+
* and the startup config: a field set in the startup config (`deployment.setting_readonly`); a
|
|
556
|
+
* network default above the effective ceiling (`deployment.network_not_allowed`); and, with
|
|
557
|
+
* `onlyNarrows` (an API token, the Platform tool), any widening: allowing outside-sandbox runs
|
|
558
|
+
* where it is off (`deployment.outside_sandbox_not_allowed`; clearing it goes back to the default
|
|
559
|
+
* allowed, a widening too) or a network default or ceiling opened where it is the allowlist
|
|
560
|
+
* (`deployment.network_not_allowed`). Returns the next stored choices and the effective view
|
|
561
|
+
* before and after.
|
|
540
562
|
*/
|
|
541
|
-
async
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
563
|
+
async checkDeviceSandbox(patch, opts = {}) {
|
|
564
|
+
const configured = configuredDeviceSandbox(this.config);
|
|
565
|
+
const readonly = [
|
|
566
|
+
[
|
|
567
|
+
"devicesOutsideSandbox.permission",
|
|
568
|
+
patch.devicesOutsideSandbox !== undefined,
|
|
569
|
+
configured.sources.outsideSandbox,
|
|
570
|
+
],
|
|
571
|
+
[
|
|
572
|
+
"devicesNetwork.default",
|
|
573
|
+
patch.devicesNetwork?.default !== undefined,
|
|
574
|
+
configured.sources.networkDefault,
|
|
575
|
+
],
|
|
576
|
+
[
|
|
577
|
+
"devicesNetwork.ceiling",
|
|
578
|
+
patch.devicesNetwork?.ceiling !== undefined,
|
|
579
|
+
configured.sources.networkCeiling,
|
|
580
|
+
],
|
|
581
|
+
];
|
|
582
|
+
const fixed = readonly.filter(([, given, source]) => given && source !== undefined);
|
|
583
|
+
if (fixed.length > 0) {
|
|
584
|
+
throw new ApiError("deployment.setting_readonly", `These device sandbox settings are set in the startup config (file, Nacos or environment) and are read-only here: ${fixed.map(([path]) => path).join(", ")}`, fixed.map(([path, , source]) => ({ path, source })));
|
|
545
585
|
}
|
|
546
|
-
const
|
|
547
|
-
const
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
586
|
+
const configuredCeiling = configured.sources.networkCeiling !== undefined ? configured.networkCeiling : undefined;
|
|
587
|
+
const stored = await readStoredDeviceSandbox(this.db.db, this.log, configuredCeiling);
|
|
588
|
+
const next = {
|
|
589
|
+
outsideSandbox: patch.devicesOutsideSandbox === undefined
|
|
590
|
+
? stored.outsideSandbox
|
|
591
|
+
: applyDevicesOutsideSandboxPatch(stored.outsideSandbox, patch.devicesOutsideSandbox),
|
|
592
|
+
network: patch.devicesNetwork === undefined
|
|
593
|
+
? stored.network
|
|
594
|
+
: applyDevicesNetworkPatch(stored.network, patch.devicesNetwork),
|
|
595
|
+
};
|
|
596
|
+
const before = resolveDeviceSandboxSettings(configured, stored);
|
|
597
|
+
const after = resolveDeviceSandboxSettings(configured, next);
|
|
598
|
+
// opening the stored default above the stored ceiling (one source) is refused; across
|
|
599
|
+
// sources, and for a change that only narrows, the reader clamps the default to the ceiling
|
|
600
|
+
if (patch.devicesNetwork?.default === "open" && next.network.ceiling === "allowlist")
|
|
601
|
+
throw networkNotAllowed("The network default open is above the ceiling allowlist; set the default to allowlist too, or open the ceiling", "default");
|
|
602
|
+
if (opts.onlyNarrows) {
|
|
603
|
+
if (patch.devicesOutsideSandbox !== undefined &&
|
|
604
|
+
before.outsideSandbox.permission === "off" &&
|
|
605
|
+
after.outsideSandbox.permission === "allowed")
|
|
606
|
+
throw outsideSandboxWidenRefused();
|
|
607
|
+
for (const field of ["default", "ceiling"]) {
|
|
608
|
+
if (patch.devicesNetwork?.[field] === undefined)
|
|
609
|
+
continue;
|
|
610
|
+
// both the stored choice (it takes effect when the startup config lets it) and the
|
|
611
|
+
// effective value (it may follow the default) must not open
|
|
612
|
+
const storedWidens = (stored.network[field] ?? "open") === "allowlist" &&
|
|
613
|
+
(next.network[field] ?? "open") === "open";
|
|
614
|
+
const effectiveWidens = before.network[field] === "allowlist" && after.network[field] === "open";
|
|
615
|
+
if (storedWidens || effectiveWidens)
|
|
616
|
+
throw networkNotAllowed(`Opening the platform's network ${field} needs a super admin in the admin console; an API token or the Platform tool may only narrow it to the allowlist.`, field);
|
|
617
|
+
}
|
|
551
618
|
}
|
|
552
|
-
return { next, before };
|
|
619
|
+
return { next, before, after };
|
|
553
620
|
}
|
|
554
621
|
/**
|
|
555
622
|
* The refusals of an `externalSharing` / `shareMaxExpiryDays` / `htmlRenderCdnAllowlist` change:
|
|
@@ -630,7 +697,8 @@ let SettingsService = class SettingsService {
|
|
|
630
697
|
}
|
|
631
698
|
/**
|
|
632
699
|
* Updates settings under the super admin lock, re-checking the actor (else `forbidden`).
|
|
633
|
-
* `onlyNarrows` (an API token, the Platform tool): `
|
|
700
|
+
* `onlyNarrows` (an API token, the Platform tool): `devicesOutsideSandbox` may only turn it off,
|
|
701
|
+
* `devicesNetwork` may only narrow to the allowlist,
|
|
634
702
|
* `externalSharing` may only turn external sharing off, `shareMaxExpiryDays` may only decrease and
|
|
635
703
|
* `htmlRenderCdnAllowlist` may only shrink.
|
|
636
704
|
*/
|
|
@@ -642,7 +710,7 @@ let SettingsService = class SettingsService {
|
|
|
642
710
|
throw new ApiError("validation_failed", "Invalid deployment settings", check.error.issues.map((i) => ({ path: i.path.join("."), message: i.message })));
|
|
643
711
|
}
|
|
644
712
|
const valid = check.data;
|
|
645
|
-
// the super admin lock, then (for a
|
|
713
|
+
// the super admin lock, then (for a device sandbox change) the platform permission authority
|
|
646
714
|
// lock: the ordered prelude, so inside a run's fence (the Platform tool's
|
|
647
715
|
// `admin.update-settings`) they precede the conversation rows; the patch decides the lock
|
|
648
716
|
await withOrderedLocks(() => this.lockFor(valid, actorAccountId), () => this.write(valid, actorAccountId, actorTokenId, auditDetail, opts));
|
|
@@ -650,7 +718,7 @@ let SettingsService = class SettingsService {
|
|
|
650
718
|
}
|
|
651
719
|
async lockFor(patch, actorAccountId) {
|
|
652
720
|
await this.adminLock.lockAndAuthorize(actorAccountId);
|
|
653
|
-
if (patch.
|
|
721
|
+
if (patch.devicesOutsideSandbox !== undefined || patch.devicesNetwork !== undefined)
|
|
654
722
|
await this.ceilings.lock({}, "platform");
|
|
655
723
|
}
|
|
656
724
|
async write(patch, actorAccountId, actorTokenId, auditDetail, opts) {
|
|
@@ -726,29 +794,61 @@ let SettingsService = class SettingsService {
|
|
|
726
794
|
next.subagentLimitOverrides = mergeByOrg(current.subagentLimitOverrides, subagentPatch);
|
|
727
795
|
}
|
|
728
796
|
}
|
|
729
|
-
// the platform's
|
|
730
|
-
//
|
|
731
|
-
let
|
|
797
|
+
// the platform's device sandbox settings: checked against the stored choices under the lock;
|
|
798
|
+
// the stored shapes keep every field optional, so clearing one (null) writes it out
|
|
799
|
+
let deviceSandboxChange;
|
|
732
800
|
const writes = Object.entries(next);
|
|
733
|
-
if (patch.
|
|
734
|
-
const r = await this.
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
//
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
801
|
+
if (patch.devicesOutsideSandbox !== undefined || patch.devicesNetwork !== undefined) {
|
|
802
|
+
const r = await this.checkDeviceSandbox(patch, opts);
|
|
803
|
+
deviceSandboxChange = { before: r.before, after: r.after };
|
|
804
|
+
const legacy = await legacyPlatformKeysStored(this.db.db);
|
|
805
|
+
// old keys the publication conversion has not reached yet (a mismatch window before
|
|
806
|
+
// activation): the new keys are stored as every reader sees them, and each old key is
|
|
807
|
+
// rewritten in step for replicas of the previous version (Full allowed only when running
|
|
808
|
+
// outside the sandbox is allowed and the effective network ceiling is open)
|
|
809
|
+
if (patch.devicesOutsideSandbox !== undefined || legacy.length > 0)
|
|
810
|
+
writes.push([DEVICES_OUTSIDE_SANDBOX_SETTING, r.next.outsideSandbox]);
|
|
811
|
+
if (patch.devicesNetwork !== undefined || legacy.length > 0) {
|
|
812
|
+
if (legacy.length > 0 && Object.keys(r.next.network).length === 0)
|
|
813
|
+
await this.db
|
|
814
|
+
.deleteFrom("deployment_settings")
|
|
815
|
+
.where("key", "=", DEVICES_NETWORK_SETTING)
|
|
816
|
+
.execute();
|
|
817
|
+
else
|
|
818
|
+
writes.push([DEVICES_NETWORK_SETTING, r.next.network]);
|
|
819
|
+
}
|
|
820
|
+
const inStep = legacyPermissionFor(r.next.outsideSandbox.permission, r.after.network.ceiling);
|
|
821
|
+
for (const key of legacy)
|
|
822
|
+
writes.push([key, legacyPlatformValue(key, inStep)]);
|
|
823
|
+
const outsideOff = r.before.outsideSandbox.permission === "allowed" &&
|
|
824
|
+
r.after.outsideSandbox.permission === "off";
|
|
825
|
+
const outsideChanged = r.before.outsideSandbox.permission !== r.after.outsideSandbox.permission;
|
|
826
|
+
const widened = (a, b) => (a.ceiling === "allowlist" && b.ceiling === "open") ||
|
|
827
|
+
(a.default === "allowlist" && b.default === "open");
|
|
828
|
+
const networkChanged = r.before.network.default !== r.after.network.default ||
|
|
829
|
+
r.before.network.ceiling !== r.after.network.ceiling;
|
|
830
|
+
if (outsideChanged || networkChanged) {
|
|
831
|
+
const machineRoots = outsideOff ? await localMachineRoots(this.db.db) : null;
|
|
832
|
+
// a network ceiling narrowed to the allowlist takes running open-network work
|
|
833
|
+
const networkNarrowed = r.before.network.ceiling === "open" && r.after.network.ceiling === "allowlist";
|
|
834
|
+
// a default narrowed to the allowlist takes it from the cloud devices that follow it
|
|
835
|
+
// (their org sets no default of its own)
|
|
836
|
+
const following = !networkNarrowed &&
|
|
837
|
+
r.before.network.default === "open" &&
|
|
838
|
+
r.after.network.default === "allowlist"
|
|
839
|
+
? await this.devicesFollowingPlatformDefault()
|
|
840
|
+
: null;
|
|
841
|
+
const narrows = machineRoots !== null || networkNarrowed || following !== null;
|
|
842
|
+
await this.ceilings.publishLocked({}, "platform", !narrows
|
|
750
843
|
? false
|
|
751
|
-
: (scope, row) =>
|
|
844
|
+
: (scope, row) => (needsOpenNetwork(scope) &&
|
|
845
|
+
(networkNarrowed || following?.has(row.device_id) === true)) ||
|
|
846
|
+
(machineRoots !== null &&
|
|
847
|
+
needsWiderDeviceCeiling(scope, machineRoots.get(row.device_id))),
|
|
848
|
+
// only a widening resets Full consent: a narrowing keeps what it covered
|
|
849
|
+
(r.before.outsideSandbox.permission === "off" &&
|
|
850
|
+
r.after.outsideSandbox.permission === "allowed") ||
|
|
851
|
+
widened(r.before.network, r.after.network));
|
|
752
852
|
}
|
|
753
853
|
}
|
|
754
854
|
// the platform's attribution defaults: a field set in the startup config is read-only
|
|
@@ -797,7 +897,7 @@ let SettingsService = class SettingsService {
|
|
|
797
897
|
action: "deployment.settings.updated",
|
|
798
898
|
detail: {
|
|
799
899
|
...patch,
|
|
800
|
-
...(
|
|
900
|
+
...(deviceSandboxChange !== undefined && { deviceSandboxEffective: deviceSandboxChange }),
|
|
801
901
|
...auditDetail,
|
|
802
902
|
},
|
|
803
903
|
});
|
|
@@ -19,7 +19,7 @@ export declare class KernelConfigService {
|
|
|
19
19
|
* Where the current value of a field without a schema default comes from: `env` when an
|
|
20
20
|
* environment variable sets it, else the config source (`file` / `nacos`) when it is set at all;
|
|
21
21
|
* undefined when nothing sets it (a layer below the startup config decides, e.g. the deployment
|
|
22
|
-
* settings for `devices.
|
|
22
|
+
* settings for `devices.outsideSandbox`). Such fields are read-only in the admin console.
|
|
23
23
|
*/
|
|
24
24
|
fieldSource(path: string): "env" | "file" | "nacos" | undefined;
|
|
25
25
|
/** Subscribes to applied changes (hot fields only); returns the unsubscribe function. */
|
|
@@ -54,8 +54,11 @@ const HOT_APPLIERS = {
|
|
|
54
54
|
// The command-review service reads the classifier's bounds at every classifier call.
|
|
55
55
|
"sandbox.review.timeoutMs": () => { },
|
|
56
56
|
"sandbox.review.messageTokens": () => { },
|
|
57
|
-
// The
|
|
58
|
-
|
|
57
|
+
// The device sandbox settings reader reads these at every device use and settings read; a
|
|
58
|
+
// change is published first (`PERMISSION_CONFIG_PATHS`).
|
|
59
|
+
"devices.outsideSandbox": () => { },
|
|
60
|
+
"devices.network.default": () => { },
|
|
61
|
+
"devices.network.ceiling": () => { },
|
|
59
62
|
// The devices service reads the personal limit at every create.
|
|
60
63
|
"devices.maxPersonal": () => { },
|
|
61
64
|
// The local device relay reads the reconnect grace at every disconnect and token response.
|
|
@@ -86,6 +89,15 @@ const HOT_APPLIERS = {
|
|
|
86
89
|
"sharing.external": () => { },
|
|
87
90
|
"sharing.maxExpiryDays": () => { },
|
|
88
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* The hot fields the permission configuration publication covers: a change to any of them is
|
|
94
|
+
* published (fingerprint compare-and-set) before this replica applies it.
|
|
95
|
+
*/
|
|
96
|
+
const PERMISSION_CONFIG_PATHS = [
|
|
97
|
+
"devices.outsideSandbox",
|
|
98
|
+
"devices.network.default",
|
|
99
|
+
"devices.network.ceiling",
|
|
100
|
+
];
|
|
89
101
|
const HOT_PATHS = configFields(KernelConfigSchema)
|
|
90
102
|
.filter((f) => f.meta?.hot)
|
|
91
103
|
.map((f) => f.path);
|
|
@@ -114,7 +126,7 @@ let KernelConfigService = class KernelConfigService {
|
|
|
114
126
|
* Where the current value of a field without a schema default comes from: `env` when an
|
|
115
127
|
* environment variable sets it, else the config source (`file` / `nacos`) when it is set at all;
|
|
116
128
|
* undefined when nothing sets it (a layer below the startup config decides, e.g. the deployment
|
|
117
|
-
* settings for `devices.
|
|
129
|
+
* settings for `devices.outsideSandbox`). Such fields are read-only in the admin console.
|
|
118
130
|
*/
|
|
119
131
|
fieldSource(path) {
|
|
120
132
|
if (getPath(this.current, path) === undefined)
|
|
@@ -137,7 +149,7 @@ let KernelConfigService = class KernelConfigService {
|
|
|
137
149
|
const log = this.log;
|
|
138
150
|
let next;
|
|
139
151
|
try {
|
|
140
|
-
next = resolveConfig(raw, this.env);
|
|
152
|
+
next = resolveConfig(raw, this.env, this.current);
|
|
141
153
|
}
|
|
142
154
|
catch (e) {
|
|
143
155
|
log.error("config reload rejected; keeping current config", { error: errMsg(e) });
|
|
@@ -155,7 +167,7 @@ let KernelConfigService = class KernelConfigService {
|
|
|
155
167
|
setPath(updated, p, getPath(next, p));
|
|
156
168
|
applied.push(p);
|
|
157
169
|
}
|
|
158
|
-
if (applied.includes(
|
|
170
|
+
if (applied.some((p) => PERMISSION_CONFIG_PATHS.includes(p))) {
|
|
159
171
|
if (!publish) {
|
|
160
172
|
log.error("permission config reload rejected: durable publication is required");
|
|
161
173
|
return;
|
|
@@ -12,7 +12,7 @@ import { type DeviceAuthorizeBody, type DeviceConfirmBody, type DeviceTokenBody,
|
|
|
12
12
|
* - `POST /authorize { name, os, arch, programVersion }` → `{ deviceCode, userCode,
|
|
13
13
|
* verificationUri, verificationUriComplete, interval, expiresIn }` (`device-authorize-ip`);
|
|
14
14
|
* - `POST /token { deviceCode }` → `{ credential, orgId, deviceId, connectUrl,
|
|
15
|
-
* reconnectGraceSeconds, maxFrameBytes,
|
|
15
|
+
* reconnectGraceSeconds, maxFrameBytes, outsideSandbox }` once, else `device_sign_in.authorization_pending` / `device_sign_in.slow_down` /
|
|
16
16
|
* `device_sign_in.denied` / `device_sign_in.expired` (`device-token-ip`).
|
|
17
17
|
*
|
|
18
18
|
* The person's routes need a web session (the confirmation page `/device`); each try of a user
|
|
@@ -24,7 +24,7 @@ const CODE_THROTTLER = ["device-code-account"];
|
|
|
24
24
|
* - `POST /authorize { name, os, arch, programVersion }` → `{ deviceCode, userCode,
|
|
25
25
|
* verificationUri, verificationUriComplete, interval, expiresIn }` (`device-authorize-ip`);
|
|
26
26
|
* - `POST /token { deviceCode }` → `{ credential, orgId, deviceId, connectUrl,
|
|
27
|
-
* reconnectGraceSeconds, maxFrameBytes,
|
|
27
|
+
* reconnectGraceSeconds, maxFrameBytes, outsideSandbox }` once, else `device_sign_in.authorization_pending` / `device_sign_in.slow_down` /
|
|
28
28
|
* `device_sign_in.denied` / `device_sign_in.expired` (`device-token-ip`).
|
|
29
29
|
*
|
|
30
30
|
* The person's routes need a web session (the confirmation page `/device`); each try of a user
|
|
@@ -44,11 +44,11 @@ export interface DeviceGrant extends Grant {
|
|
|
44
44
|
/** `devices.local.maxFrameBytes`: the program never sends a larger frame (ruling R26). */
|
|
45
45
|
maxFrameBytes: number;
|
|
46
46
|
/**
|
|
47
|
-
* Whether the platform and the organization allow
|
|
48
|
-
* org's `
|
|
49
|
-
* when the machine's owner ceiling does.
|
|
47
|
+
* Whether the platform and the organization allow running outside the sandbox now
|
|
48
|
+
* (`devices.outsideSandbox` and the org's `outsideSandbox`): `off` makes `login` say that the org
|
|
49
|
+
* does not allow it, even when the machine's owner ceiling does.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
outsideSandbox: "allowed" | "off";
|
|
52
52
|
}
|
|
53
53
|
/** A user code as typed → `XXXX-XXXX`, or null when it cannot be one. */
|
|
54
54
|
export declare function normalizeUserCode(input: string): string | null;
|
|
@@ -192,7 +192,7 @@ let DeviceAuthService = class DeviceAuthService {
|
|
|
192
192
|
connectUrl,
|
|
193
193
|
reconnectGraceSeconds: local.reconnectGraceSeconds,
|
|
194
194
|
maxFrameBytes: local.maxFrameBytes,
|
|
195
|
-
|
|
195
|
+
outsideSandbox: allowedDeviceMode(deployment.fullAccess, settings.outsideSandbox) === "auto"
|
|
196
196
|
? "allowed"
|
|
197
197
|
: "off",
|
|
198
198
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DeviceFeature, type DeviceLocalPolicySummary, type DevicePolicyArgs, type LegacyDevicePolicyArgs, type LegacyDevicePolicyStatus } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import { type DeviceFeature, type DeviceLocalPolicySummary, type DeviceOwnerCeilingNarrowing, type DevicePolicyArgs, type LegacyDevicePolicyArgs, type LegacyDevicePolicyStatus } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
3
3
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
4
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
@@ -12,8 +12,17 @@ import { LocalDeviceRelay } from "./relay.js";
|
|
|
12
12
|
export declare const POLICY_DEADLINE_MS = 30000;
|
|
13
13
|
/** How long an op left `unknown` waits for the machine's hello to report it (from its intent). */
|
|
14
14
|
export declare const UNKNOWN_OP_MS: number;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A policy change as callers ask for it (the op id and the source are added here): narrowings
|
|
17
|
+
* only. Under device protocol 4 the deployment never widens a local device: its owner adds hosts,
|
|
18
|
+
* opens the network or allows running outside the sandbox on the machine.
|
|
19
|
+
*/
|
|
20
|
+
export interface PolicyChange {
|
|
21
|
+
remove?: string[];
|
|
22
|
+
ownerCeiling?: DeviceOwnerCeilingNarrowing;
|
|
23
|
+
}
|
|
24
|
+
/** Who asked for a change, for the device's local audit line (never a network ask). */
|
|
25
|
+
export type PolicyChangeSource = Omit<LegacyDevicePolicyArgs["source"], "approvalId">;
|
|
17
26
|
/**
|
|
18
27
|
* Test seam (`KernelOverride`): called by {@link DevicePolicyService.send} right after the `policy`
|
|
19
28
|
* op's call returned, before its outcome is recorded (by `apply` or a network ask's decision);
|
|
@@ -41,7 +50,7 @@ export interface PolicyIntent {
|
|
|
41
50
|
opId: string;
|
|
42
51
|
args: DevicePolicyArgs;
|
|
43
52
|
/**
|
|
44
|
-
* The staged (protocol
|
|
53
|
+
* The staged (protocol 4) connection the op goes to, when the device's machine is connected
|
|
45
54
|
* over one: the op is sent as a v3 `policy` request fenced to it (not sent at all once it
|
|
46
55
|
* changed), and its answer's owner report is recorded with its id. Absent: protocol 2.
|
|
47
56
|
*/
|
|
@@ -80,8 +89,9 @@ export type PolicyOpStatus = (LegacyDevicePolicyStatus & {
|
|
|
80
89
|
outcome: "offline";
|
|
81
90
|
};
|
|
82
91
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
92
|
+
* Narrows a local device's policy on its machine (approval-only profiles design, "Settings model":
|
|
93
|
+
* hosts removed, the network to the allowlist, no running outside the sandbox, the workspace
|
|
94
|
+
* reach): the kernel→device `policy`
|
|
85
95
|
* op over the {@link LocalDeviceRelay}. The machine is the authority: it refuses what its owner
|
|
86
96
|
* forbids, validates every host and answers with the policy as written, which the kernel then
|
|
87
97
|
* keeps on the active machine's row (§5.4).
|
|
@@ -119,7 +129,7 @@ export declare class DevicePolicyService {
|
|
|
119
129
|
orgId: string;
|
|
120
130
|
deviceId: string;
|
|
121
131
|
change: PolicyChange;
|
|
122
|
-
source:
|
|
132
|
+
source: PolicyChangeSource;
|
|
123
133
|
actorTokenId?: string;
|
|
124
134
|
}): Promise<PolicyChangeOutcome>;
|
|
125
135
|
/**
|
|
@@ -132,7 +142,7 @@ export declare class DevicePolicyService {
|
|
|
132
142
|
orgId: string;
|
|
133
143
|
deviceId: string;
|
|
134
144
|
change: PolicyChange;
|
|
135
|
-
source:
|
|
145
|
+
source: PolicyChangeSource;
|
|
136
146
|
actorTokenId?: string;
|
|
137
147
|
}): Promise<{
|
|
138
148
|
intent: PolicyIntent;
|
|
@@ -201,4 +211,3 @@ export declare class DevicePolicyService {
|
|
|
201
211
|
*/
|
|
202
212
|
private recordIntent;
|
|
203
213
|
}
|
|
204
|
-
export {};
|