@capybara-hq/kernel 0.1.0-rc.146 → 0.1.0-rc.148
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/extensions.controller.d.ts +0 -11
- package/dist/admin/extensions.controller.js +0 -28
- package/dist/admin/health.service.d.ts +25 -1
- package/dist/admin/health.service.js +50 -18
- package/dist/audit/full-access.d.ts +78 -0
- package/dist/audit/full-access.js +283 -0
- package/dist/automations/automations.service.d.ts +1 -0
- package/dist/automations/automations.service.js +3 -1
- package/dist/automations/calendar.js +3 -1
- package/dist/automations/grant-rules.d.ts +2 -1
- package/dist/automations/grant-rules.js +8 -1
- package/dist/automations/unattended.d.ts +13 -1
- package/dist/automations/unattended.js +13 -1
- package/dist/catalog/admin-catalog.controller.d.ts +8 -0
- package/dist/catalog/admin-catalog.controller.js +8 -2
- package/dist/catalog/admin-catalog.schemas.d.ts +10 -0
- package/dist/catalog/admin-catalog.schemas.js +8 -1
- package/dist/catalog/catalog-content.d.ts +6 -0
- package/dist/catalog/catalog-scope.service.d.ts +22 -2
- package/dist/catalog/catalog-scope.service.js +27 -3
- package/dist/catalog/catalog.service.js +19 -2
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +8 -1
- package/dist/catalog/org-catalog.service.js +36 -3
- package/dist/catalog/platform-components.js +3 -2
- package/dist/catalog/platform-import-update.d.ts +2 -0
- package/dist/catalog/platform-import-update.js +8 -1
- package/dist/catalog/plugin-connectors.d.ts +11 -0
- package/dist/catalog/plugin-connectors.js +33 -0
- package/dist/catalog/plugin-import.d.ts +35 -15
- package/dist/catalog/plugin-import.js +110 -35
- package/dist/catalog/plugin-install.js +6 -0
- package/dist/catalog/provenance.d.ts +2 -0
- package/dist/catalog/provenance.js +5 -1
- package/dist/config/auto-approve.d.ts +16 -0
- package/dist/config/auto-approve.js +24 -0
- package/dist/config/capacity-presets.d.ts +243 -0
- package/dist/config/capacity-presets.js +195 -0
- package/dist/config/env.d.ts +2 -1
- package/dist/config/env.js +6 -1
- package/dist/config/load.js +15 -0
- package/dist/config/schema.d.ts +46 -9
- package/dist/config/schema.js +154 -30
- package/dist/ctx/net.d.ts +5 -1
- package/dist/ctx/net.js +62 -12
- package/dist/db/kernel-schema.d.ts +31 -0
- package/dist/db/migrator.js +0 -36
- package/dist/dial-in/routes.js +1 -1
- package/dist/erasure/org-batches.js +1 -6
- package/dist/erasure/org-catalog.js +6 -2
- package/dist/erasure/org-rules.js +1 -0
- package/dist/erasure/org-worker.js +0 -13
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/extensions/admin-ops.d.ts +14 -1
- package/dist/extensions/admin-ops.js +30 -3
- package/dist/extensions/admin-view.d.ts +21 -1
- package/dist/extensions/admin-view.js +43 -0
- package/dist/extensions/bootstrap-packages.d.ts +5 -0
- package/dist/extensions/bootstrap-packages.js +1 -1
- package/dist/extensions/bootstrap-review.d.ts +251 -0
- package/dist/extensions/bootstrap-review.js +676 -0
- package/dist/extensions/bootstrap.d.ts +21 -1
- package/dist/extensions/bootstrap.js +72 -2
- package/dist/extensions/cli.d.ts +6 -0
- package/dist/extensions/cli.js +4 -0
- package/dist/extensions/enabled.d.ts +3 -0
- package/dist/extensions/extensions.module.js +9 -0
- package/dist/extensions/full-access-disclosure.d.ts +15 -0
- package/dist/extensions/full-access-disclosure.js +57 -0
- package/dist/extensions/grant-epoch.d.ts +5 -0
- package/dist/extensions/grant-epoch.js +9 -0
- package/dist/extensions/host.d.ts +71 -2
- package/dist/extensions/host.js +293 -27
- package/dist/extensions/installs.d.ts +18 -0
- package/dist/extensions/installs.js +28 -0
- package/dist/extensions/isolated/admission.d.ts +17 -2
- package/dist/extensions/isolated/admission.js +18 -8
- package/dist/extensions/isolated/authorization.d.ts +8 -2
- package/dist/extensions/isolated/authorization.js +11 -3
- package/dist/extensions/isolated/broker.d.ts +3 -0
- package/dist/extensions/isolated/broker.js +50 -14
- package/dist/extensions/isolated/configured-package.d.ts +5 -0
- package/dist/extensions/isolated/configured-package.js +2 -0
- package/dist/extensions/isolated/lanes.d.ts +44 -3
- package/dist/extensions/isolated/lanes.js +263 -80
- package/dist/extensions/isolated/metrics.d.ts +146 -0
- package/dist/extensions/isolated/metrics.js +304 -0
- package/dist/extensions/isolated/revision.d.ts +7 -1
- package/dist/extensions/isolated/revision.js +26 -5
- package/dist/extensions/isolated/rpc.d.ts +5 -0
- package/dist/extensions/isolated/rpc.js +7 -2
- package/dist/extensions/isolated/sandbox.d.ts +23 -0
- package/dist/extensions/isolated/sandbox.js +50 -0
- package/dist/extensions/isolated/status.d.ts +79 -0
- package/dist/extensions/isolated/status.js +216 -0
- package/dist/extensions/isolated/tier.d.ts +127 -2
- package/dist/extensions/isolated/tier.js +266 -7
- package/dist/extensions/isolated/usage.d.ts +134 -0
- package/dist/extensions/isolated/usage.js +322 -0
- package/dist/extensions/lifecycle.d.ts +42 -2
- package/dist/extensions/lifecycle.js +100 -4
- package/dist/extensions/org-config.js +11 -0
- package/dist/extensions/package.d.ts +14 -0
- package/dist/extensions/package.js +24 -3
- package/dist/extensions/permission-set.d.ts +12 -3
- package/dist/extensions/permission-set.js +5 -5
- package/dist/extensions/permission-view.d.ts +12 -5
- package/dist/extensions/permission-view.js +23 -2
- package/dist/extensions/permissions.controller.d.ts +35 -0
- package/dist/extensions/permissions.controller.js +98 -0
- package/dist/extensions/permissions.schemas.d.ts +288 -0
- package/dist/extensions/permissions.schemas.js +96 -0
- package/dist/extensions/permissions.service.d.ts +116 -0
- package/dist/extensions/permissions.service.js +428 -0
- package/dist/extensions/realm-retirement.d.ts +65 -0
- package/dist/extensions/realm-retirement.js +150 -0
- package/dist/extensions/revision-approvals.d.ts +58 -3
- package/dist/extensions/revision-approvals.js +135 -14
- package/dist/extensions/revision-review.d.ts +144 -0
- package/dist/extensions/revision-review.js +297 -0
- package/dist/extensions/revocation.js +3 -0
- package/dist/extensions/state.module.js +12 -0
- package/dist/git/run-end.d.ts +35 -7
- package/dist/git/run-end.js +87 -38
- package/dist/http/api.module.js +2 -0
- package/dist/identity/audit.d.ts +2 -1
- package/dist/identity/audit.js +4 -17
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/infra/config/kernel-config.service.d.ts +6 -0
- package/dist/infra/config/kernel-config.service.js +21 -0
- package/dist/infra/outbox/registry.d.ts +13 -0
- package/dist/infra/outbox/registry.js +8 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +25 -1
- package/dist/lifecycle/kernel-lifecycle.js +73 -18
- package/dist/net/private-endpoint-preflight.d.ts +159 -0
- package/dist/net/private-endpoint-preflight.js +417 -0
- package/dist/net/private-endpoints.d.ts +68 -0
- package/dist/net/private-endpoints.js +164 -0
- package/dist/net/public-address.d.ts +14 -0
- package/dist/net/public-address.js +15 -1
- package/dist/net/safe-fetch.d.ts +2 -1
- package/dist/net/safe-fetch.js +10 -3
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/packages/official-publisher.d.ts +26 -1
- package/dist/packages/official-publisher.js +48 -1
- package/dist/packages/provenance.d.ts +11 -0
- package/dist/packages/provenance.js +24 -0
- package/dist/platform/exclusions.js +4 -4
- package/dist/platform/ops/automations.ops.js +1 -1
- package/dist/platform/ops/catalog-admin.ops.js +25 -4
- package/dist/platform/ops/extension-permissions.ops.d.ts +11 -0
- package/dist/platform/ops/extension-permissions.ops.js +159 -0
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +2 -0
- package/dist/platform/route-schemas.js +2 -0
- package/dist/retention/purge-batch.js +10 -14
- package/dist/runtime/maintenance.d.ts +4 -2
- package/dist/runtime/maintenance.js +16 -3
- package/dist/runtime/run-finish.d.ts +3 -3
- package/dist/runtime/run-finish.js +7 -3
- package/dist/sandbox/permission-availability.d.ts +17 -2
- package/dist/sandbox/permission-availability.js +22 -1
- package/dist/sandbox/permission-facts.js +7 -1
- package/dist/tools/builtins/sandbox/common.js +2 -0
- package/dist/tools/pipeline.d.ts +2 -1
- package/dist/tools/pipeline.js +7 -2
- package/package.json +4 -3
- package/src/migrations/0238_extension_usage.sql +40 -0
- package/src/migrations/0239_extension_replica_isolation.sql +28 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExtensionManifest, type ExtensionPermissions, type HttpAccess, type PermissionPurpose } from "@capybara-hq/plugin-sdk";
|
|
2
|
-
export { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_HOST_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, POLICY_HOOK_KEY_PREFIX, SETUP_CHECK_KEY_PREFIX, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, UI_VIEW_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
export { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_HOST_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, POLICY_HOOK_KEY_PREFIX, RAW_EGRESS_PERMISSION_KEY, SETUP_CHECK_KEY_PREFIX, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, UI_VIEW_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "@capybara-hq/plugin-sdk";
|
|
3
3
|
/** 一个配置字段:点路径(根即叶子时为空串)与是否密钥。 */
|
|
4
4
|
export interface PermissionConfigField {
|
|
5
5
|
path: string;
|
|
@@ -119,6 +119,17 @@ export interface PermissionSet {
|
|
|
119
119
|
people?: {
|
|
120
120
|
read: true;
|
|
121
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* Raw network egress outside `ctx.net` (`permissions.fullAccess.rawEgress`: node:http2,
|
|
124
|
+
* WebSocket long connections, a Docker Engine over node:http until brokered access arrives,
|
|
125
|
+
* plan 3.1c), with the declared purpose. One sensitive, blocking key; the execution decision
|
|
126
|
+
* forces the server realm into full access for it. Absent when not declared.
|
|
127
|
+
*/
|
|
128
|
+
fullAccess?: {
|
|
129
|
+
rawEgress: {
|
|
130
|
+
purpose: PermissionPurpose;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
122
133
|
};
|
|
123
134
|
/**
|
|
124
135
|
* 安装记录包迁移警告的摘要(`warningsDigest`,Ruling P4);没有警告或不是安装记录时省略。
|
|
@@ -160,8 +171,6 @@ export declare function buildPermissionSet(input: {
|
|
|
160
171
|
warningsDigest?: string | undefined;
|
|
161
172
|
purposes?: ReadonlyMap<string, PermissionPurpose>;
|
|
162
173
|
}): PermissionSet;
|
|
163
|
-
/** Legacy approval cannot authorize a privileged execution realm. */
|
|
164
|
-
export declare const FULL_ACCESS_UNSUPPORTED = "permissions.fullAccess is not yet supported by extension approval";
|
|
165
174
|
/** Expand the kernel snapshot's declarations using the SDK's canonical catalog. */
|
|
166
175
|
export declare function permissionKeys(set: PermissionSet): string[];
|
|
167
176
|
/**
|
|
@@ -4,7 +4,7 @@ import { permissionKeys as catalogPermissionKeys, SETUP_CHECK_KEY_PREFIX, static
|
|
|
4
4
|
import { configFields } from "../config/fields.js";
|
|
5
5
|
import { pluginSchemaName } from "../ctx/create-ctx.js";
|
|
6
6
|
import { MIGRATION_FILE_RE } from "../db/migrator.js";
|
|
7
|
-
export { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_HOST_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, POLICY_HOOK_KEY_PREFIX, SETUP_CHECK_KEY_PREFIX, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, UI_VIEW_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "@capybara-hq/plugin-sdk";
|
|
7
|
+
export { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_HOST_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, POLICY_HOOK_KEY_PREFIX, RAW_EGRESS_PERMISSION_KEY, SETUP_CHECK_KEY_PREFIX, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, UI_VIEW_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "@capybara-hq/plugin-sdk";
|
|
8
8
|
const cmp = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
9
9
|
const sortedUnique = (xs) => [...new Set(xs ?? [])].sort(cmp);
|
|
10
10
|
const IDENT = '(?:"(?:[^"]|"")+"|[A-Za-z_][A-Za-z0-9_$]*)';
|
|
@@ -81,8 +81,6 @@ export async function computePermissionSet(manifest, pluginDir) {
|
|
|
81
81
|
*/
|
|
82
82
|
export function buildPermissionSet(input) {
|
|
83
83
|
const p = input.permissions ?? {};
|
|
84
|
-
if (p.fullAccess !== undefined)
|
|
85
|
-
throw new Error(FULL_ACCESS_UNSUPPORTED);
|
|
86
84
|
const byPath = (a, b) => cmp(a.path, b.path);
|
|
87
85
|
return {
|
|
88
86
|
provides: sortedUnique(input.provides),
|
|
@@ -148,12 +146,14 @@ export function buildPermissionSet(input) {
|
|
|
148
146
|
...(p.agents?.read === true ? { agents: { read: true } } : {}),
|
|
149
147
|
...(p.conversations?.subjects === true ? { conversations: { subjects: true } } : {}),
|
|
150
148
|
...(p.people?.read === true ? { people: { read: true } } : {}),
|
|
149
|
+
// only when declared: raw egress (its purpose kept for the review); one blocking key
|
|
150
|
+
...(p.fullAccess?.rawEgress
|
|
151
|
+
? { fullAccess: { rawEgress: { purpose: p.fullAccess.rawEgress.purpose } } }
|
|
152
|
+
: {}),
|
|
151
153
|
},
|
|
152
154
|
...(input.warningsDigest ? { warningsDigest: input.warningsDigest } : {}),
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
|
-
/** Legacy approval cannot authorize a privileged execution realm. */
|
|
156
|
-
export const FULL_ACCESS_UNSUPPORTED = "permissions.fullAccess is not yet supported by extension approval";
|
|
157
157
|
/** Expand the kernel snapshot's declarations using the SDK's canonical catalog. */
|
|
158
158
|
export function permissionKeys(set) {
|
|
159
159
|
return catalogPermissionKeys(set);
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { type LocalizedName, type UiDropReason } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import { type LocalizedName, type PermissionPurpose, type UiDropReason } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { PluginScope } from "../catalog/scope.js";
|
|
3
3
|
import type { ReportBodyInput } from "../client/client.schemas.js";
|
|
4
4
|
import { type PermissionSet } from "./permission-set.js";
|
|
5
5
|
import type { ExtensionSource } from "./sources.js";
|
|
6
|
+
/**
|
|
7
|
+
* The declared purpose of each permission key of a snapshot (inline purposes plus the raw egress
|
|
8
|
+
* purpose), for the legacy listings (`capybara extensions approve`, `review`). Plain text.
|
|
9
|
+
*/
|
|
10
|
+
export declare function permissionPurposes(set: PermissionSet): Map<string, PermissionPurpose>;
|
|
6
11
|
/** Review data contains plain purpose text. Renderers escape it as text on output. */
|
|
7
12
|
export declare function reviewPermissionRows(set: PermissionSet): {
|
|
8
13
|
rows: {
|
|
@@ -10,7 +15,7 @@ export declare function reviewPermissionRows(set: PermissionSet): {
|
|
|
10
15
|
family: "config.deployment" | "config.deployment.secret" | "execution.config.unsupported" | "execution.full-access" | "execution.provider.unsupported" | "host.no-isolation" | "migration.warnings" | "optional" | "optional.custodian" | "permissions.agents" | "permissions.bus" | "permissions.client" | "permissions.conversations" | "permissions.deviceaccess" | "permissions.deviceaccess.host" | "permissions.deviceaccess.loopbackports" | "permissions.deviceaccess.siteaccess" | "permissions.dialin" | "permissions.fullaccess.rawegress" | "permissions.hooks.observe" | "permissions.hooks.policy" | "permissions.hooks.sensitive" | "permissions.http" | "permissions.inbox" | "permissions.kv" | "permissions.lock" | "permissions.models" | "permissions.network" | "permissions.outbox" | "permissions.people" | "permissions.queue" | "permissions.secrets" | "permissions.storage" | "permissions.tools" | "permissions.triggers" | "provides" | "provides.standard" | "requires" | "requires.custodian" | "setup.check" | "table" | "ui.action" | "ui.component" | "ui.embed" | "ui.query" | "ui.view";
|
|
11
16
|
risk: "custodian" | "fullAccess" | "informational" | "sensitive" | "standard";
|
|
12
17
|
reason: "Accepts connections from devices that use this protocol." | "Calls the model mapped to this declared purpose." | "Can deny the protected action at this mount." | "Can request a grant for a device loopback port." | "Can request approved actions on websites from the person's device." | "Contains migration statements that require review." | "Coordinates work using locks in the extension namespace." | "Creates a table in the extension database schema." | "Depends on a provider that handles a protected resource." | "Emits durable events of this type." | "Handles this named action for its extension UI." | "Handles this named query for its extension UI." | "Implements a kernel capability and sees the resource it serves." | "Implements this kernel capability." | "Makes network requests outside the kernel egress broker." | "Observes bounded metadata at this mount." | "Observes model or tool data at this mount." | "Orders startup after this extension point when present." | "Posts to the inbox of members of enabled orgs." | "Publishes and receives events in the extension namespace." | "Reads and writes keys in the extension namespace." | "Reads metadata for conversations about its own subjects." | "Reads or stores secrets in its approved namespace." | "Reads or writes objects in its scoped storage prefix." | "Reads the names and avatars of org members." | "Reads which agents a member can use." | "Receives requests and data for this route and audience." | "Receives this field from effective configuration." | "Renders this named component in the app." | "Renders this named view through the kernel." | "Requires this extension point at startup." | "Runs this named tool with its input and scoped call context." | "Runs this read-only setup check." | "Runs this service outside the device sandbox." | "Runs with the privileges of the approved execution realm." | "Runs without a host isolation supervisor." | "Schedules work in the extension namespace." | "Sends requests and data to this destination." | "Serves an embedded page for this view." | "Stages durable effects in the extension namespace." | "Supplies client code for the app." | "The deployment config schema is outside the isolated tier's declarative subset." | "This provider contract does not yet have an isolated execution form." | "Uses this confidential configuration field." | "Uses this service on a person's device.";
|
|
13
|
-
purpose:
|
|
18
|
+
purpose: PermissionPurpose | undefined;
|
|
14
19
|
}[];
|
|
15
20
|
errors: string[];
|
|
16
21
|
warnings: string[];
|
|
@@ -25,10 +30,10 @@ export declare function reviewPermissionRows(set: PermissionSet): {
|
|
|
25
30
|
export declare function reviewHash(set: PermissionSet, warnings?: readonly PackageWarning[]): string;
|
|
26
31
|
/** 权限清单展示用的一组:按类别分组,`sensitive` 标出需要管理员特别留意的类别。 */
|
|
27
32
|
export interface PermissionGroup {
|
|
28
|
-
category: "provides" | "requires" | "optional" | "config" | "tables" | "secrets" | "storage" | "http" | "publicRoutes" | "embedRoutes" | "tools" | "hooks" | "models" | "network" | "ui" | "components" | "client" | "dialIn" | "deviceAccess" | "triggers" | "inbox" | "agents" | "conversations" | "people";
|
|
33
|
+
category: "provides" | "requires" | "optional" | "config" | "tables" | "secrets" | "storage" | "http" | "publicRoutes" | "embedRoutes" | "tools" | "hooks" | "models" | "network" | "ui" | "components" | "client" | "dialIn" | "deviceAccess" | "triggers" | "inbox" | "agents" | "conversations" | "people" | "fullAccess";
|
|
29
34
|
/**
|
|
30
35
|
* Sensitive category: secrets, public routes, tools, hooks, client components, client code,
|
|
31
|
-
* device services; also
|
|
36
|
+
* device services, raw egress; also
|
|
32
37
|
* the "provides" group when it holds one of {@link SENSITIVE_EXTENSION_POINTS}, and the "UI" group
|
|
33
38
|
* (views and embeds) when it holds an embedded app (embed: the extension's own page in an iframe).
|
|
34
39
|
*/
|
|
@@ -46,13 +51,15 @@ export interface PermissionGroup {
|
|
|
46
51
|
* ({@link SENSITIVE_EXTENSION_POINTS}; the code is the extension point name without `@<major>`, with
|
|
47
52
|
* `-` replaced by `_`).
|
|
48
53
|
*/
|
|
49
|
-
export type SensitiveReason = "secrets" | "public_routes" | "embed_routes" | "tools" | "hooks" | "ui_embed" | "client_code" | "ui_component" | "channel" | "directory" | "identity_source" | "device_provider" | "object_store" | "context" | "push_provider" | "device_access" | "device_loopback_ports" | "device_site_access" | "device_host_service" | "migration_warnings";
|
|
54
|
+
export type SensitiveReason = "secrets" | "public_routes" | "embed_routes" | "tools" | "hooks" | "ui_embed" | "client_code" | "ui_component" | "channel" | "directory" | "identity_source" | "device_provider" | "object_store" | "context" | "push_provider" | "device_access" | "device_loopback_ports" | "device_site_access" | "device_host_service" | "raw_egress" | "migration_warnings";
|
|
50
55
|
/** 权限清单里的一项(分组里的一项,或 `added` 里的一个权限键)。 */
|
|
51
56
|
export interface PermissionItem {
|
|
52
57
|
value: string;
|
|
53
58
|
sensitive: boolean;
|
|
54
59
|
/** 敏感时的原因码。 */
|
|
55
60
|
reason?: SensitiveReason;
|
|
61
|
+
/** The declared purpose, on the raw egress item (the publisher's text, rendered as text). */
|
|
62
|
+
purpose?: PermissionPurpose;
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
65
|
* Sensitive capabilities (D10 + planned extensions, F-AI): `device-provider@1` runs arbitrary commands in
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { lintPermissionPurposes, permissionCatalogMatches, } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import { lintPermissionPurposes, permissionCatalogMatches, RAW_EGRESS_PERMISSION_KEY, } from "@capybara-hq/plugin-sdk";
|
|
3
3
|
import { pluginSchemaName } from "../ctx/create-ctx.js";
|
|
4
4
|
import { EXTENSION_RLS_PREDICATE } from "../db/extension-rls-predicate.js";
|
|
5
5
|
import { isDestructiveSql, splitSqlStatements } from "../db/sql-statements.js";
|
|
6
6
|
import { AGENTS_KEY, CLIENT_KEY, CONVERSATIONS_KEY, DEVICE_ACCESS_KEY_PREFIX, DEVICE_HOST_KEY_PREFIX, DEVICE_LOOPBACK_PORTS_KEY, DEVICE_SITE_ACCESS_KEY, DIAL_IN_KEY_PREFIX, INBOX_KEY, PEOPLE_KEY, permissionKeys, TRIGGERS_KEY_PREFIX, UI_COMPONENT_KEY_PREFIX, WARNINGS_KEY_PREFIX, } from "./permission-set.js";
|
|
7
|
+
/**
|
|
8
|
+
* The declared purpose of each permission key of a snapshot (inline purposes plus the raw egress
|
|
9
|
+
* purpose), for the legacy listings (`capybara extensions approve`, `review`). Plain text.
|
|
10
|
+
*/
|
|
11
|
+
export function permissionPurposes(set) {
|
|
12
|
+
return lintPermissionPurposes(set, new Map(Object.entries(set.purposes ?? {}))).purposes;
|
|
13
|
+
}
|
|
7
14
|
/** Review data contains plain purpose text. Renderers escape it as text on output. */
|
|
8
15
|
export function reviewPermissionRows(set) {
|
|
9
16
|
const { purposes, errors, warnings } = lintPermissionPurposes(set, new Map(Object.entries(set.purposes ?? {})));
|
|
@@ -69,6 +76,8 @@ const LOOPBACK_PORTS_ITEM = "local ports on the device (loopback)";
|
|
|
69
76
|
const SITE_ACCESS_ITEM = "profile-approved actions on websites";
|
|
70
77
|
/** Item prefix of a host service (`permissions.deviceAccess.hostServices`): `host:<service>`. */
|
|
71
78
|
const HOST_ITEM_PREFIX = "host:";
|
|
79
|
+
/** The one item of the "fullAccess" group (`permissions.fullAccess.rawEgress`). */
|
|
80
|
+
const RAW_EGRESS_ITEM = "raw network egress";
|
|
72
81
|
/** The one item of the "inbox" group (collaboration spec §4.9). */
|
|
73
82
|
const INBOX_ITEM = "personal inbox items";
|
|
74
83
|
/** The items of the read-only org fact groups. */
|
|
@@ -85,6 +94,7 @@ const ALWAYS_SENSITIVE = new Set([
|
|
|
85
94
|
"components",
|
|
86
95
|
"client",
|
|
87
96
|
"deviceAccess",
|
|
97
|
+
"fullAccess",
|
|
88
98
|
]);
|
|
89
99
|
const CATEGORY_REASON = {
|
|
90
100
|
secrets: "secrets",
|
|
@@ -95,6 +105,7 @@ const CATEGORY_REASON = {
|
|
|
95
105
|
components: "ui_component",
|
|
96
106
|
client: "client_code",
|
|
97
107
|
deviceAccess: "device_access",
|
|
108
|
+
fullAccess: "raw_egress",
|
|
98
109
|
};
|
|
99
110
|
/**
|
|
100
111
|
* Why an item in a category is sensitive (undefined when it is not; shared by the grouped list, the
|
|
@@ -138,6 +149,8 @@ function keyItem(key) {
|
|
|
138
149
|
return { category: "client", item: CLIENT_ITEM };
|
|
139
150
|
if (key === INBOX_KEY)
|
|
140
151
|
return { category: "inbox", item: INBOX_ITEM };
|
|
152
|
+
if (key === RAW_EGRESS_PERMISSION_KEY)
|
|
153
|
+
return { category: "fullAccess", item: RAW_EGRESS_ITEM };
|
|
141
154
|
if (key === DEVICE_LOOPBACK_PORTS_KEY)
|
|
142
155
|
return { category: "deviceAccess", item: LOOPBACK_PORTS_ITEM };
|
|
143
156
|
if (key === DEVICE_SITE_ACCESS_KEY)
|
|
@@ -263,11 +276,19 @@ export function permissionGroups(set) {
|
|
|
263
276
|
items: p.conversations?.subjects === true ? [CONVERSATIONS_ITEM] : [],
|
|
264
277
|
},
|
|
265
278
|
{ category: "people", items: p.people?.read === true ? [PEOPLE_ITEM] : [] },
|
|
279
|
+
// traffic outside ctx.net (sensitive: full access for the server realm)
|
|
280
|
+
{ category: "fullAccess", items: p.fullAccess?.rawEgress ? [RAW_EGRESS_ITEM] : [] },
|
|
266
281
|
];
|
|
282
|
+
const rawEgressPurpose = p.fullAccess?.rawEgress.purpose;
|
|
267
283
|
return groups
|
|
268
284
|
.filter((g) => g.items.length > 0)
|
|
269
285
|
.map((g) => {
|
|
270
|
-
const entries = g.items.map((i) =>
|
|
286
|
+
const entries = g.items.map((i) => {
|
|
287
|
+
const item = itemOf(g.category, i);
|
|
288
|
+
return g.category === "fullAccess" && rawEgressPurpose
|
|
289
|
+
? { ...item, purpose: rawEgressPurpose }
|
|
290
|
+
: item;
|
|
291
|
+
});
|
|
271
292
|
return { ...g, sensitive: entries.some((e) => e.sensitive), entries };
|
|
272
293
|
});
|
|
273
294
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type Principal } from "../identity/principal.js";
|
|
3
|
+
import { type IsolationStatus, PermissionApproveBody, type PermissionApproveResult, type PermissionInventory, type PermissionReviewView, PermissionRevokeBody, type PermissionRevokeResult } from "./permissions.schemas.js";
|
|
4
|
+
import { ExtensionPermissions } from "./permissions.service.js";
|
|
5
|
+
/**
|
|
6
|
+
* The extension permission routes (plan task 1.4a; `permissions.schemas.ts` has the contract)
|
|
7
|
+
* and the isolation status (1.4j). Super admins only.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ExtensionPermissionsController {
|
|
10
|
+
private readonly permissions;
|
|
11
|
+
constructor(permissions: ExtensionPermissions);
|
|
12
|
+
/** Every install record with its shadow decision, grants and shadow placements. */
|
|
13
|
+
inventory(): Promise<PermissionInventory>;
|
|
14
|
+
/**
|
|
15
|
+
* The permission review of the install's current revision. Not installed -> 404
|
|
16
|
+
* `extension.not_found`; digest not recorded yet or package unreadable -> 409
|
|
17
|
+
* `extension.permission_review_unavailable`.
|
|
18
|
+
*/
|
|
19
|
+
review(name: string): Promise<PermissionReviewView>;
|
|
20
|
+
/**
|
|
21
|
+
* A person approves that review (a human security consent: no Platform operation): the revision
|
|
22
|
+
* grant and the legacy approval in one transaction. Another revision or review -> 409
|
|
23
|
+
* `extension.permission_review_stale`; a wrong full-access acknowledgement -> 409
|
|
24
|
+
* `plugin.full_access_ack_invalid`; a missing one -> 200 with the grant skipped (until 1.5a).
|
|
25
|
+
*/
|
|
26
|
+
approve(principal: Principal, name: string, body: z.infer<typeof PermissionApproveBody>): Promise<PermissionApproveResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Revokes keys of a revision's live grant, or the whole grant. Unknown or unrevocable keys -> 409
|
|
29
|
+
* `extension.permission_keys_unknown`; no live grant -> 404
|
|
30
|
+
* `extension.permission_grant_not_found`.
|
|
31
|
+
*/
|
|
32
|
+
revoke(principal: Principal, name: string, body: z.infer<typeof PermissionRevokeBody>): Promise<PermissionRevokeResult>;
|
|
33
|
+
/** The isolation status: `not_configured`, or each live replica's supervisor checks. */
|
|
34
|
+
isolation(): Promise<IsolationStatus>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Controller, Get, HttpCode, Inject, Param, Post } from "@nestjs/common";
|
|
11
|
+
import { CurrentPrincipal, patTokenId, requireUser, SuperAdmin, } from "../identity/principal.js";
|
|
12
|
+
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
13
|
+
import { ZBody } from "../infra/validation/zod-params.js";
|
|
14
|
+
import { PermissionApproveBody, PermissionRevokeBody, } from "./permissions.schemas.js";
|
|
15
|
+
import { ExtensionPermissions } from "./permissions.service.js";
|
|
16
|
+
class PermissionApproveBodyDto extends createZodDto(PermissionApproveBody, "ExtensionPermissionApproveBody") {
|
|
17
|
+
}
|
|
18
|
+
class PermissionRevokeBodyDto extends createZodDto(PermissionRevokeBody, "ExtensionPermissionRevokeBody") {
|
|
19
|
+
}
|
|
20
|
+
const actorOpts = (actor) => {
|
|
21
|
+
const tokenId = patTokenId(actor);
|
|
22
|
+
return tokenId !== undefined ? { actorTokenId: tokenId } : {};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The extension permission routes (plan task 1.4a; `permissions.schemas.ts` has the contract)
|
|
26
|
+
* and the isolation status (1.4j). Super admins only.
|
|
27
|
+
*/
|
|
28
|
+
let ExtensionPermissionsController = class ExtensionPermissionsController {
|
|
29
|
+
permissions;
|
|
30
|
+
constructor(permissions) {
|
|
31
|
+
this.permissions = permissions;
|
|
32
|
+
}
|
|
33
|
+
/** Every install record with its shadow decision, grants and shadow placements. */
|
|
34
|
+
inventory() {
|
|
35
|
+
return this.permissions.inventory();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The permission review of the install's current revision. Not installed -> 404
|
|
39
|
+
* `extension.not_found`; digest not recorded yet or package unreadable -> 409
|
|
40
|
+
* `extension.permission_review_unavailable`.
|
|
41
|
+
*/
|
|
42
|
+
review(name) {
|
|
43
|
+
return this.permissions.review(name);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A person approves that review (a human security consent: no Platform operation): the revision
|
|
47
|
+
* grant and the legacy approval in one transaction. Another revision or review -> 409
|
|
48
|
+
* `extension.permission_review_stale`; a wrong full-access acknowledgement -> 409
|
|
49
|
+
* `plugin.full_access_ack_invalid`; a missing one -> 200 with the grant skipped (until 1.5a).
|
|
50
|
+
*/
|
|
51
|
+
approve(principal, name, body) {
|
|
52
|
+
const actor = requireUser(principal);
|
|
53
|
+
return this.permissions.approve(actor.account.id, name, body, actorOpts(actor));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Revokes keys of a revision's live grant, or the whole grant. Unknown or unrevocable keys -> 409
|
|
57
|
+
* `extension.permission_keys_unknown`; no live grant -> 404
|
|
58
|
+
* `extension.permission_grant_not_found`.
|
|
59
|
+
*/
|
|
60
|
+
revoke(principal, name, body) {
|
|
61
|
+
const actor = requireUser(principal);
|
|
62
|
+
return this.permissions.revoke(actor.account.id, name, body, actorOpts(actor));
|
|
63
|
+
}
|
|
64
|
+
/** The isolation status: `not_configured`, or each live replica's supervisor checks. */
|
|
65
|
+
isolation() {
|
|
66
|
+
return this.permissions.isolationStatus();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
__decorate([
|
|
70
|
+
Get("extension-permissions")
|
|
71
|
+
], ExtensionPermissionsController.prototype, "inventory", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
Get("extension-permissions/:name/review"),
|
|
74
|
+
__param(0, Param("name"))
|
|
75
|
+
], ExtensionPermissionsController.prototype, "review", null);
|
|
76
|
+
__decorate([
|
|
77
|
+
Post("extension-permissions/:name/approve"),
|
|
78
|
+
HttpCode(200),
|
|
79
|
+
__param(0, CurrentPrincipal()),
|
|
80
|
+
__param(1, Param("name")),
|
|
81
|
+
__param(2, ZBody(PermissionApproveBodyDto))
|
|
82
|
+
], ExtensionPermissionsController.prototype, "approve", null);
|
|
83
|
+
__decorate([
|
|
84
|
+
Post("extension-permissions/:name/revoke"),
|
|
85
|
+
HttpCode(200),
|
|
86
|
+
__param(0, CurrentPrincipal()),
|
|
87
|
+
__param(1, Param("name")),
|
|
88
|
+
__param(2, ZBody(PermissionRevokeBodyDto))
|
|
89
|
+
], ExtensionPermissionsController.prototype, "revoke", null);
|
|
90
|
+
__decorate([
|
|
91
|
+
Get("extension-isolation")
|
|
92
|
+
], ExtensionPermissionsController.prototype, "isolation", null);
|
|
93
|
+
ExtensionPermissionsController = __decorate([
|
|
94
|
+
Controller("api/v1/admin"),
|
|
95
|
+
SuperAdmin(),
|
|
96
|
+
__param(0, Inject(ExtensionPermissions))
|
|
97
|
+
], ExtensionPermissionsController);
|
|
98
|
+
export { ExtensionPermissionsController };
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { PrivateEndpointGap } from "../net/private-endpoint-preflight.js";
|
|
3
|
+
import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
4
|
+
import type { ExecutionDecision } from "./execution-realm.js";
|
|
5
|
+
import type { ShadowPlacement } from "./isolated/tier.js";
|
|
6
|
+
import type { ReviewDisplay } from "./review-hash.js";
|
|
7
|
+
import type { ShadowGrantStatus, ShadowRevisionDecision } from "./revision-approvals.js";
|
|
8
|
+
import type { ApprovalScope, ExecutionRealm, GrantAuthority, GrantSource, PublisherEvidence, RevisionGrantState } from "./revision-grants.js";
|
|
9
|
+
import type { RevisionReview } from "./revision-review.js";
|
|
10
|
+
/**
|
|
11
|
+
* The shared schemas of the extension permission routes (extension permission model spec,
|
|
12
|
+
* "Review, updates and provenance", "Revocation, audit and people"; plan tasks 1.4a and 1.4j).
|
|
13
|
+
* Requests are zod schemas, used by the controller and by the Platform operations (the parity
|
|
14
|
+
* test compares them); responses are the exported view types. The web (1.4d / 1.4e / 1.4k) and
|
|
15
|
+
* the CLI (1.4f) build against both.
|
|
16
|
+
*
|
|
17
|
+
* Routes (all super admin):
|
|
18
|
+
* - `GET /api/v1/admin/extension-permissions`: the inventory, one {@link PermissionInventoryEntry}
|
|
19
|
+
* per install record ({@link PermissionInventory}).
|
|
20
|
+
* - `GET /api/v1/admin/extension-permissions/:name/review`: the permission review of the
|
|
21
|
+
* install's current revision ({@link PermissionReviewView}). Its Platform operation returns a
|
|
22
|
+
* handoff link card to the web confirm page.
|
|
23
|
+
* - `POST /api/v1/admin/extension-permissions/:name/approve`: a person confirms that review
|
|
24
|
+
* ({@link PermissionApproveBody}), full access included with one acknowledgement per realm. It
|
|
25
|
+
* is a `human security consent` exclusion of the Platform tool and is refused unattended. Returns
|
|
26
|
+
* {@link PermissionApproveResult}.
|
|
27
|
+
* - `POST /api/v1/admin/extension-permissions/:name/revoke`: revokes keys of a revision's grant,
|
|
28
|
+
* or the whole grant ({@link PermissionRevokeBody}); revocation only narrows, so the Platform
|
|
29
|
+
* tool may do it. Returns {@link PermissionRevokeResult}.
|
|
30
|
+
* - `GET /api/v1/admin/extension-isolation`: the isolation status ({@link IsolationStatus}).
|
|
31
|
+
*
|
|
32
|
+
* The catalog import and import-and-update confirms take the same
|
|
33
|
+
* {@link FullAccessAcknowledgementBody} (`catalog/admin-catalog.schemas.ts`).
|
|
34
|
+
*/
|
|
35
|
+
/** An extension name as the routes take it (`@Param`). */
|
|
36
|
+
export declare const PermissionNamePathParams: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/** One exact revision of the named extension: its version and the archive's lowercase sha512. */
|
|
40
|
+
export declare const PermissionRevisionBody: z.ZodObject<{
|
|
41
|
+
version: z.ZodString;
|
|
42
|
+
sha512: z.ZodString;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
/**
|
|
45
|
+
* One explicit acknowledgement per realm whose full access a permission review confers, bound to
|
|
46
|
+
* that review's hash (plan task 1.3d): `reviewHash` is the review's `hash`, `realms` exactly its
|
|
47
|
+
* `acknowledge`. A wrong one is refused (409 `plugin.full_access_ack_invalid`).
|
|
48
|
+
*/
|
|
49
|
+
export declare const FullAccessAcknowledgementBody: z.ZodObject<{
|
|
50
|
+
reviewHash: z.ZodString;
|
|
51
|
+
realms: z.ZodArray<z.ZodEnum<{
|
|
52
|
+
browser: "browser";
|
|
53
|
+
device: "device";
|
|
54
|
+
server: "server";
|
|
55
|
+
}>>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
/**
|
|
58
|
+
* `POST …/:name/approve`: confirms the review `GET …/:name/review` returned for `revision`. The
|
|
59
|
+
* install must still run that revision and the review must still hash to `reviewHash` (else 409
|
|
60
|
+
* `extension.permission_review_stale`). A review that confers full access records its revision
|
|
61
|
+
* grant only with `fullAccessAcknowledgement` naming exactly its realms: a wrong one is refused
|
|
62
|
+
* (409 `plugin.full_access_ack_invalid`), a missing one returns 200 with the grant `skipped`
|
|
63
|
+
* (shadow mode; refused from plan task 1.5a). The legacy approval is written either way until 1.5a.
|
|
64
|
+
*/
|
|
65
|
+
export declare const PermissionApproveBody: z.ZodObject<{
|
|
66
|
+
revision: z.ZodObject<{
|
|
67
|
+
version: z.ZodString;
|
|
68
|
+
sha512: z.ZodString;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
reviewHash: z.ZodString;
|
|
71
|
+
fullAccessAcknowledgement: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
reviewHash: z.ZodString;
|
|
73
|
+
realms: z.ZodArray<z.ZodEnum<{
|
|
74
|
+
browser: "browser";
|
|
75
|
+
device: "device";
|
|
76
|
+
server: "server";
|
|
77
|
+
}>>;
|
|
78
|
+
}, z.core.$strict>>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
/**
|
|
81
|
+
* `POST …/:name/revoke`: revokes `keys` of the revision's live grant (a realm's full access is its
|
|
82
|
+
* `execution.full-access:<realm>` key), or the whole grant without `keys`. Unknown or unrevocable
|
|
83
|
+
* keys -> 409 `extension.permission_keys_unknown`; no live grant -> 404
|
|
84
|
+
* `extension.permission_grant_not_found`.
|
|
85
|
+
*/
|
|
86
|
+
export declare const PermissionRevokeBody: z.ZodObject<{
|
|
87
|
+
revision: z.ZodObject<{
|
|
88
|
+
version: z.ZodString;
|
|
89
|
+
sha512: z.ZodString;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export declare const PERMISSION_ROUTES: readonly RouteSchemas[];
|
|
95
|
+
/** One exact revision. */
|
|
96
|
+
export interface PermissionRevision {
|
|
97
|
+
version: string;
|
|
98
|
+
/** Lowercase hex sha512 of the archive; null while the package backfill has not recorded it. */
|
|
99
|
+
sha512: string | null;
|
|
100
|
+
}
|
|
101
|
+
/** A revision grant as the inventory shows it (no purposes: the review shows those). */
|
|
102
|
+
export interface PermissionGrantSummary {
|
|
103
|
+
generation: number;
|
|
104
|
+
state: RevisionGrantState;
|
|
105
|
+
source: GrantSource;
|
|
106
|
+
authority: GrantAuthority;
|
|
107
|
+
publisherEvidence: PublisherEvidence;
|
|
108
|
+
approvalScope: {
|
|
109
|
+
mode: ApprovalScope["mode"];
|
|
110
|
+
orgs: string[];
|
|
111
|
+
};
|
|
112
|
+
/** Full-access realms and their forcing keys, net of revocation and retirement. */
|
|
113
|
+
realms: Partial<Record<ExecutionRealm, string[]>>;
|
|
114
|
+
/** Keys still serving. */
|
|
115
|
+
serving: string[];
|
|
116
|
+
/** Keys revoked or retired (every key once the grant is revoked): the Partially revoked rows. */
|
|
117
|
+
withdrawn: string[];
|
|
118
|
+
reviewHash: string;
|
|
119
|
+
approvedBy: string | null;
|
|
120
|
+
approvedAt: string;
|
|
121
|
+
}
|
|
122
|
+
/** Where one replica would place the revision on its last convergence (1.3b, shadow). */
|
|
123
|
+
export interface PermissionShadowExecution {
|
|
124
|
+
replicaId: string;
|
|
125
|
+
/** The revision that replica placed (it may still be converging to the installed one). */
|
|
126
|
+
version: string;
|
|
127
|
+
host: "available" | "not_configured" | "failing";
|
|
128
|
+
decision: Pick<ExecutionDecision, "kind" | "fullAccess" | "unknownKeys" | "confirmable">;
|
|
129
|
+
uncovered: Partial<Record<ExecutionRealm, string[]>>;
|
|
130
|
+
would: ShadowPlacement;
|
|
131
|
+
diverges: boolean;
|
|
132
|
+
hostReasonRetired: boolean;
|
|
133
|
+
}
|
|
134
|
+
/** One install record in the inventory. */
|
|
135
|
+
export interface PermissionInventoryEntry {
|
|
136
|
+
plugin: string;
|
|
137
|
+
/** The installed revision. */
|
|
138
|
+
revision: PermissionRevision;
|
|
139
|
+
/**
|
|
140
|
+
* `catalog`, `npm`, `file` or `bootstrap` (install records only: a config-declared extension's
|
|
141
|
+
* revision is reviewed by the bootstrap review, plan task 1.3c).
|
|
142
|
+
*/
|
|
143
|
+
source: string;
|
|
144
|
+
catalogItemId: string | null;
|
|
145
|
+
required: boolean;
|
|
146
|
+
/** The shadow decision of the installed revision (status, keys, would serve). */
|
|
147
|
+
status: ShadowGrantStatus;
|
|
148
|
+
decision: ShadowRevisionDecision;
|
|
149
|
+
/** The installed revision's own grant (any state), if it ever had one. */
|
|
150
|
+
grant: PermissionGrantSummary | null;
|
|
151
|
+
/** The install's approved revision when it is another one (an upgrade waiting for review). */
|
|
152
|
+
approved: (PermissionRevision & {
|
|
153
|
+
generation: number;
|
|
154
|
+
}) | null;
|
|
155
|
+
/** The install's candidate revision, waiting for review. */
|
|
156
|
+
candidate: PermissionRevision | null;
|
|
157
|
+
/** Per live replica, the shadow placement of its last convergence (empty until it ran). */
|
|
158
|
+
executions: PermissionShadowExecution[];
|
|
159
|
+
}
|
|
160
|
+
export interface PermissionInventory {
|
|
161
|
+
entries: PermissionInventoryEntry[];
|
|
162
|
+
/** Required installs the enforcing start gate (1.5a) would refuse. */
|
|
163
|
+
missingRequired: string[];
|
|
164
|
+
}
|
|
165
|
+
/** `GET …/:name/review`. */
|
|
166
|
+
export interface PermissionReviewView {
|
|
167
|
+
plugin: string;
|
|
168
|
+
revision: {
|
|
169
|
+
version: string;
|
|
170
|
+
sha512: string;
|
|
171
|
+
};
|
|
172
|
+
/** The review of that revision: display, hash, consent, realms to acknowledge, block. */
|
|
173
|
+
review: Pick<RevisionReview, "hash" | "consent" | "acknowledge" | "blocked"> & {
|
|
174
|
+
display: ReviewDisplay;
|
|
175
|
+
};
|
|
176
|
+
/** The web confirm page for this review (what the Platform operation's handoff opens). */
|
|
177
|
+
confirmUrl: string;
|
|
178
|
+
/** Manifest paths and sizes of the client files in the exact revision being reviewed. */
|
|
179
|
+
clientFiles?: {
|
|
180
|
+
path: string;
|
|
181
|
+
size: number;
|
|
182
|
+
}[];
|
|
183
|
+
/**
|
|
184
|
+
* The deployment's isolation state now (`GET /api/v1/admin/extension-isolation`'s `state`): the
|
|
185
|
+
* review binds only whether the supervisor is configured, so show this beside it (a revision
|
|
186
|
+
* that runs isolated is unavailable while the supervisor fails).
|
|
187
|
+
*/
|
|
188
|
+
isolation: "not_configured" | "available" | "failing" | "unknown";
|
|
189
|
+
}
|
|
190
|
+
/** `POST …/:name/approve`. */
|
|
191
|
+
export interface PermissionApproveResult {
|
|
192
|
+
plugin: string;
|
|
193
|
+
revision: {
|
|
194
|
+
version: string;
|
|
195
|
+
sha512: string;
|
|
196
|
+
};
|
|
197
|
+
/** What happened to the revision grant (the legacy approval is written either way until 1.5a). */
|
|
198
|
+
grant: {
|
|
199
|
+
status: "granted" | "kept";
|
|
200
|
+
generation: number;
|
|
201
|
+
} | {
|
|
202
|
+
status: "continued";
|
|
203
|
+
generation: number;
|
|
204
|
+
fullAccess: ExecutionRealm[];
|
|
205
|
+
} | {
|
|
206
|
+
status: "skipped";
|
|
207
|
+
reason: string;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** `POST …/:name/revoke`. */
|
|
211
|
+
export interface PermissionRevokeResult {
|
|
212
|
+
plugin: string;
|
|
213
|
+
revision: {
|
|
214
|
+
version: string;
|
|
215
|
+
sha512: string;
|
|
216
|
+
};
|
|
217
|
+
grant: PermissionGrantSummary;
|
|
218
|
+
/** Keys this revocation withdrew. */
|
|
219
|
+
withdrawn: string[];
|
|
220
|
+
/** Per full-access realm revoked, where the revision goes next once revocation is enforced. */
|
|
221
|
+
fullAccess: {
|
|
222
|
+
realm: ExecutionRealm;
|
|
223
|
+
next: "isolated" | "pending_approval";
|
|
224
|
+
}[];
|
|
225
|
+
/**
|
|
226
|
+
* Whether revocation already changes what runs: false in shadow mode until the enforcing
|
|
227
|
+
* cutover (plan task 1.5a), when the legacy approval still governs admission and the extension
|
|
228
|
+
* keeps running as before; disable it to stop it now.
|
|
229
|
+
*/
|
|
230
|
+
enforced: boolean;
|
|
231
|
+
}
|
|
232
|
+
/** A supervisor check that can fail, in the order the kernel runs them. */
|
|
233
|
+
export type IsolationCheck = "guard_reachability" | "engine_runtime" | "image" | "postgres_socket";
|
|
234
|
+
/** One live replica's supervisor readiness, as its last probe saw it. */
|
|
235
|
+
export interface ReplicaIsolation {
|
|
236
|
+
replicaId: string;
|
|
237
|
+
/** `not_configured`: this replica runs without the supervisor (a mixed configuration). */
|
|
238
|
+
state: "available" | "failing" | "not_configured";
|
|
239
|
+
/** The first check that failed (`failing` only); `message` is the kernel's English text. */
|
|
240
|
+
failedCheck: IsolationCheck | null;
|
|
241
|
+
message: string | null;
|
|
242
|
+
/** When its last probe ran; null when not configured. */
|
|
243
|
+
probedAt: string | null;
|
|
244
|
+
}
|
|
245
|
+
/** A plugin a failing supervisor keeps from running (it would run isolated). */
|
|
246
|
+
export interface IsolationPausedPlugin {
|
|
247
|
+
plugin: string;
|
|
248
|
+
version: string;
|
|
249
|
+
/** The replicas where it is paused. */
|
|
250
|
+
replicas: string[];
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* `GET /api/v1/admin/extension-isolation`. Not configured: only the state, the kernel probes
|
|
254
|
+
* nothing. Configured: `available` when every live replica's supervisor passed its checks,
|
|
255
|
+
* `failing` when any did not (`replicas` says which check), `unknown` before any replica probed.
|
|
256
|
+
*/
|
|
257
|
+
export type IsolationStatus = {
|
|
258
|
+
state: "not_configured";
|
|
259
|
+
} | {
|
|
260
|
+
state: "available" | "failing" | "unknown";
|
|
261
|
+
replicas: ReplicaIsolation[];
|
|
262
|
+
paused: IsolationPausedPlugin[];
|
|
263
|
+
/** Platform endpoints `ctx.net` would not admit for isolated plugins (#1459). */
|
|
264
|
+
privateEndpointGaps: PrivateEndpointGap[];
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* The org-facing disclosure of an optional full-access plugin (spec "Review, updates and
|
|
268
|
+
* provenance" step 3; the 1.4f org page), on the org catalog item read: shown to the org's admins
|
|
269
|
+
* when the plugin's approved revision runs with full access, null otherwise (and always null for
|
|
270
|
+
* other members). No secrets, no other org's data, no deployment internals beyond the realms and
|
|
271
|
+
* why they need full access.
|
|
272
|
+
*/
|
|
273
|
+
export interface FullAccessDisclosure {
|
|
274
|
+
approvedRevision: {
|
|
275
|
+
version: string;
|
|
276
|
+
};
|
|
277
|
+
realms: ExecutionRealm[];
|
|
278
|
+
/**
|
|
279
|
+
* Why full access is needed, by class: `host_no_isolation` (the deployment runs without the
|
|
280
|
+
* isolation supervisor), `provider_contract` (an extension point without an isolated form yet),
|
|
281
|
+
* `client_code` (code in the app page), `device_host` (a service outside the device sandbox),
|
|
282
|
+
* `declared` (a declared capability that only runs with the kernel's privileges).
|
|
283
|
+
*/
|
|
284
|
+
reasons: FullAccessReason[];
|
|
285
|
+
approverAuthority: GrantAuthority;
|
|
286
|
+
approvedAt: string;
|
|
287
|
+
}
|
|
288
|
+
export type FullAccessReason = "host_no_isolation" | "provider_contract" | "client_code" | "device_host" | "declared";
|