@capybara-hq/kernel 0.1.0-rc.147 → 0.1.0-rc.149
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/bootstrap.json +29 -29
- package/dist/admin/extensions.controller.d.ts +26 -2
- package/dist/admin/extensions.controller.js +52 -3
- package/dist/admin/extensions.schemas.d.ts +4 -0
- package/dist/admin/extensions.schemas.js +6 -0
- package/dist/catalog/cli.d.ts +3 -2
- package/dist/catalog/cli.js +19 -3
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/channels.module.js +3 -0
- package/dist/channels/connection-summary.d.ts +32 -0
- package/dist/channels/connection-summary.js +67 -0
- package/dist/db/kernel-schema.d.ts +27 -0
- package/dist/erasure/org-catalog.js +4 -2
- package/dist/erasure/org-rules.js +1 -0
- package/dist/extensions/admin-ops.js +1 -0
- package/dist/extensions/admin-view.d.ts +5 -0
- package/dist/extensions/admin-view.js +19 -2
- package/dist/extensions/config-json-schema.d.ts +10 -6
- package/dist/extensions/config-json-schema.js +12 -8
- package/dist/extensions/deployment-config-store.d.ts +2 -0
- package/dist/extensions/deployment-config.d.ts +1 -1
- package/dist/extensions/deployment-config.js +5 -2
- package/dist/extensions/enabled.d.ts +1 -0
- package/dist/extensions/grant-epoch.d.ts +11 -2
- package/dist/extensions/grant-epoch.js +26 -3
- package/dist/extensions/host.d.ts +3 -0
- package/dist/extensions/host.js +5 -2
- package/dist/extensions/isolated/admission.js +3 -1
- package/dist/extensions/org-overrides.js +1 -1
- package/dist/extensions/package.js +1 -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 +17 -5
- package/dist/extensions/permission-view.js +23 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/net/private-endpoint-preflight.js +1 -1
- package/dist/orgs/directory-sync-state.d.ts +125 -0
- package/dist/orgs/directory-sync-state.js +259 -0
- package/dist/orgs/directory-sync.controller.d.ts +16 -3
- package/dist/orgs/directory-sync.controller.js +29 -5
- package/dist/orgs/directory-sync.d.ts +18 -7
- package/dist/orgs/directory-sync.js +238 -106
- package/dist/orgs/directory-sync.schemas.d.ts +26 -0
- package/dist/orgs/directory-sync.schemas.js +50 -0
- package/dist/orgs/orgs.module.js +3 -0
- package/dist/platform/ops/extensions-admin.ops.d.ts +5 -1
- package/dist/platform/ops/extensions-admin.ops.js +43 -3
- package/dist/platform/ops/extensions.ops.d.ts +3 -1
- package/dist/platform/ops/extensions.ops.js +19 -2
- package/dist/platform/route-schemas.js +3 -0
- package/package.json +2 -2
- package/src/migrations/0240_directory_sync_state.sql +34 -0
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { SDK_VERSION } from "@capybara-hq/plugin-sdk";
|
|
10
|
+
import { extensionPointRefs, SDK_VERSION } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
13
|
import { EXTENSION_ORG_COUNT_PAGE_SIZE } from "../admin/extensions.schemas.js";
|
|
@@ -145,6 +145,17 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
145
145
|
const [counts] = await this.orgCountsForSubjects([s]);
|
|
146
146
|
return { ...view, ...counts };
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Refuses a name this deployment does not know (`extension.not_found`) without reading its
|
|
150
|
+
* package: for reads keyed by the name that need nothing of the package.
|
|
151
|
+
*/
|
|
152
|
+
async assertKnown(name) {
|
|
153
|
+
if (this.host.declaredPlugins().some((p) => p.name === name))
|
|
154
|
+
return;
|
|
155
|
+
if ((await this.installs.list()).some((r) => r.name === name))
|
|
156
|
+
return;
|
|
157
|
+
throw new ApiError("extension.not_found", `Extension ${name} is not known to this deployment`);
|
|
158
|
+
}
|
|
148
159
|
/**
|
|
149
160
|
* The review digest of a stored package (the `reviewHash` its extension would show once
|
|
150
161
|
* installed); null when the package cannot be read.
|
|
@@ -296,6 +307,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
296
307
|
version: p.version,
|
|
297
308
|
set: p.permissions,
|
|
298
309
|
install: null,
|
|
310
|
+
provides: p.provides,
|
|
299
311
|
configurable: p.configurable,
|
|
300
312
|
configValid: p.configValid,
|
|
301
313
|
warnings: [],
|
|
@@ -324,6 +336,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
324
336
|
version: r.version,
|
|
325
337
|
set: EMPTY_SET,
|
|
326
338
|
install: r,
|
|
339
|
+
provides: [],
|
|
327
340
|
configurable: false,
|
|
328
341
|
configValid: null,
|
|
329
342
|
broken: detail,
|
|
@@ -331,13 +344,14 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
331
344
|
});
|
|
332
345
|
continue;
|
|
333
346
|
}
|
|
334
|
-
const { set, configurable, warnings } = info;
|
|
347
|
+
const { set, configurable, warnings, provides } = info;
|
|
335
348
|
out.push({
|
|
336
349
|
name: r.name,
|
|
337
350
|
source: "install",
|
|
338
351
|
version: r.version,
|
|
339
352
|
set,
|
|
340
353
|
install: r,
|
|
354
|
+
provides,
|
|
341
355
|
configurable,
|
|
342
356
|
configValid: null,
|
|
343
357
|
warnings,
|
|
@@ -358,6 +372,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
358
372
|
cached = {
|
|
359
373
|
set: permissionSetOfPackage(pkg),
|
|
360
374
|
warnings: migrationWarnings(pkg.migrationSql, pkg.section.manifest.name),
|
|
375
|
+
provides: extensionPointRefs(pkg.section.manifest.provides),
|
|
361
376
|
};
|
|
362
377
|
if (this.packageSets.size >= PACKAGE_SET_CACHE_MAX)
|
|
363
378
|
this.packageSets.clear();
|
|
@@ -498,6 +513,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
498
513
|
sensitive: false,
|
|
499
514
|
warnings: [],
|
|
500
515
|
snapshot: snapshotView(snap),
|
|
516
|
+
provides: s.provides,
|
|
501
517
|
configurable: false,
|
|
502
518
|
configValid,
|
|
503
519
|
removable: install?.required !== true,
|
|
@@ -552,6 +568,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
552
568
|
sensitive: permissions.some((g) => g.sensitive),
|
|
553
569
|
warnings: s.warnings,
|
|
554
570
|
snapshot: snapshotView(snap),
|
|
571
|
+
provides: s.provides,
|
|
555
572
|
configurable: s.configurable,
|
|
556
573
|
configValid,
|
|
557
574
|
removable: s.source === "install" && install?.required !== true,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (`configJsonSchema`, extension config forms spec §4.1) so the packer, the checks and the kernel
|
|
4
4
|
* share one implementation; the kernel keeps no copy.
|
|
5
5
|
*/
|
|
6
|
-
import { type ConfigUiProblem, type JsonSchema } from "@capybara-hq/plugin-sdk";
|
|
6
|
+
import { type ConfigUiProblem, type JsonSchema, type ValidateConfigUiOptions } from "@capybara-hq/plugin-sdk";
|
|
7
7
|
import type { z } from "zod";
|
|
8
8
|
export { configJsonSchema as configToJsonSchema, type JsonSchema } from "@capybara-hq/plugin-sdk";
|
|
9
9
|
/** The config level a schema belongs to (which hints `validateConfigUi` allows). */
|
|
@@ -21,11 +21,15 @@ export interface ConfigFormSchema {
|
|
|
21
21
|
export declare function stripConfigUi(node: unknown): void;
|
|
22
22
|
/**
|
|
23
23
|
* Validates the hints of a JSON Schema at a level and strips every `x-ui` when there is any
|
|
24
|
-
* problem (in place): invalid hints never reach a form, and never fail a load (spec §4.1).
|
|
24
|
+
* problem (in place): invalid hints never reach a form, and never fail a load (spec §4.1). With
|
|
25
|
+
* `provides` (the extension's points), a `capability` hint naming another point is a problem too.
|
|
25
26
|
*/
|
|
26
|
-
export declare function checkConfigUi(schema: JsonSchema, level: ConfigLevel): ConfigUiProblem[];
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
export declare function checkConfigUi(schema: JsonSchema, level: ConfigLevel, opts?: ValidateConfigUiOptions): ConfigUiProblem[];
|
|
28
|
+
/**
|
|
29
|
+
* A config schema's form JSON Schema ({@link checkConfigUi} applied), cached per schema object.
|
|
30
|
+
* A deployment schema belongs to one manifest, so every caller passes that manifest's `provides`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function configFormSchema(schema: z.ZodTypeAny, level: ConfigLevel, opts?: ValidateConfigUiOptions): ConfigFormSchema;
|
|
29
33
|
/**
|
|
30
34
|
* {@link configFormSchema} that never throws, for every caller that serves a form schema or reads
|
|
31
35
|
* its messages (deployment, connection, issues). A hint conversion that throws (a hand-made
|
|
@@ -33,7 +37,7 @@ export declare function configFormSchema(schema: z.ZodTypeAny, level: ConfigLeve
|
|
|
33
37
|
* `x-ui` stripped, else `null` when even the plain conversion fails. `onFallback` runs once per
|
|
34
38
|
* schema object and level on this replica (the caller's one warning); later calls reuse the result.
|
|
35
39
|
*/
|
|
36
|
-
export declare function safeConfigFormSchema(schema: z.ZodTypeAny, level: ConfigLevel, onFallback: (err: unknown, fallback: "plain" | "none") => void): ConfigFormSchema | null;
|
|
40
|
+
export declare function safeConfigFormSchema(schema: z.ZodTypeAny, level: ConfigLevel, onFallback: (err: unknown, fallback: "plain" | "none") => void, opts?: ValidateConfigUiOptions): ConfigFormSchema | null;
|
|
37
41
|
/**
|
|
38
42
|
* The secret record paths some `x-ui.secrets[].path` of a form schema names (spec §4.3), anywhere in
|
|
39
43
|
* the schema. Read from a checked schema: one whose hints were invalid was stripped and names none.
|
|
@@ -35,10 +35,11 @@ export function stripConfigUi(node) {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Validates the hints of a JSON Schema at a level and strips every `x-ui` when there is any
|
|
38
|
-
* problem (in place): invalid hints never reach a form, and never fail a load (spec §4.1).
|
|
38
|
+
* problem (in place): invalid hints never reach a form, and never fail a load (spec §4.1). With
|
|
39
|
+
* `provides` (the extension's points), a `capability` hint naming another point is a problem too.
|
|
39
40
|
*/
|
|
40
|
-
export function checkConfigUi(schema, level) {
|
|
41
|
-
const problems = validateConfigUi(schema, level);
|
|
41
|
+
export function checkConfigUi(schema, level, opts = {}) {
|
|
42
|
+
const problems = validateConfigUi(schema, level, opts);
|
|
42
43
|
if (problems.length > 0)
|
|
43
44
|
stripConfigUi(schema);
|
|
44
45
|
return problems;
|
|
@@ -48,13 +49,16 @@ const caches = {
|
|
|
48
49
|
deployment: new WeakMap(),
|
|
49
50
|
connection: new WeakMap(),
|
|
50
51
|
};
|
|
51
|
-
/**
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* A config schema's form JSON Schema ({@link checkConfigUi} applied), cached per schema object.
|
|
54
|
+
* A deployment schema belongs to one manifest, so every caller passes that manifest's `provides`.
|
|
55
|
+
*/
|
|
56
|
+
export function configFormSchema(schema, level, opts = {}) {
|
|
53
57
|
const cache = caches[level];
|
|
54
58
|
let r = cache.get(schema);
|
|
55
59
|
if (!r) {
|
|
56
60
|
const js = configJsonSchema(schema);
|
|
57
|
-
r = { schema: js, problems: checkConfigUi(js, level) };
|
|
61
|
+
r = { schema: js, problems: checkConfigUi(js, level, opts) };
|
|
58
62
|
cache.set(schema, r);
|
|
59
63
|
}
|
|
60
64
|
return r;
|
|
@@ -71,12 +75,12 @@ const fallbacks = {
|
|
|
71
75
|
* `x-ui` stripped, else `null` when even the plain conversion fails. `onFallback` runs once per
|
|
72
76
|
* schema object and level on this replica (the caller's one warning); later calls reuse the result.
|
|
73
77
|
*/
|
|
74
|
-
export function safeConfigFormSchema(schema, level, onFallback) {
|
|
78
|
+
export function safeConfigFormSchema(schema, level, onFallback, opts = {}) {
|
|
75
79
|
const failed = fallbacks[level].get(schema);
|
|
76
80
|
if (failed !== undefined)
|
|
77
81
|
return failed;
|
|
78
82
|
try {
|
|
79
|
-
return configFormSchema(schema, level);
|
|
83
|
+
return configFormSchema(schema, level, opts);
|
|
80
84
|
}
|
|
81
85
|
catch (err) {
|
|
82
86
|
let r = null;
|
|
@@ -22,6 +22,8 @@ export interface DeploymentSchemaInfo {
|
|
|
22
22
|
* (`extension.configSchemas.deployment`), shown but never used to validate.
|
|
23
23
|
*/
|
|
24
24
|
jsonSchema?: JsonSchema | undefined;
|
|
25
|
+
/** The extension points the extension provides (its `capability` hints must name one). */
|
|
26
|
+
provides?: readonly string[] | undefined;
|
|
25
27
|
fields: {
|
|
26
28
|
path: string;
|
|
27
29
|
secret: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LocalizedName } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { core } from "zod";
|
|
3
3
|
import type { KernelAppOptions } from "../app.js";
|
|
4
4
|
import { type ConfigSourceKind } from "../config/sources.js";
|
|
@@ -8,6 +8,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { isDeepStrictEqual } from "node:util";
|
|
11
|
+
import { extensionPointRefs, } from "@capybara-hq/plugin-sdk";
|
|
11
12
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
13
|
import { configFields, describeSchema, getPath, secretValues } from "../config/fields.js";
|
|
13
14
|
import { configSourceKind, extensionConfigSources, fieldSource, } from "../config/sources.js";
|
|
@@ -487,7 +488,7 @@ let ExtensionDeploymentConfigService = class ExtensionDeploymentConfigService {
|
|
|
487
488
|
formSchemaOf(plugin, info) {
|
|
488
489
|
if (!info.schema)
|
|
489
490
|
return info.jsonSchema;
|
|
490
|
-
const r = safeConfigFormSchema(info.schema, "deployment", (err, schema) => this.log.warn("the deployment config form schema could not be built with its UI hints; hints dropped", { plugin, version: info.version, schema, err }));
|
|
491
|
+
const r = safeConfigFormSchema(info.schema, "deployment", (err, schema) => this.log.warn("the deployment config form schema could not be built with its UI hints; hints dropped", { plugin, version: info.version, schema, err }), { provides: info.provides ?? [] });
|
|
491
492
|
return r?.schema;
|
|
492
493
|
}
|
|
493
494
|
messagesOf(plugin, info) {
|
|
@@ -596,7 +597,9 @@ export async function staticDeploymentSchema(db, plugin) {
|
|
|
596
597
|
let jsonSchema;
|
|
597
598
|
if (typeof stored === "object" && stored !== null && !Array.isArray(stored)) {
|
|
598
599
|
jsonSchema = structuredClone(stored);
|
|
599
|
-
checkConfigUi(jsonSchema, "deployment"
|
|
600
|
+
checkConfigUi(jsonSchema, "deployment", {
|
|
601
|
+
provides: extensionPointRefs(section.manifest.provides ?? []),
|
|
602
|
+
});
|
|
600
603
|
}
|
|
601
604
|
return {
|
|
602
605
|
version: row.version,
|
|
@@ -98,6 +98,7 @@ export declare function extensionOrgCountsQuery(db: KernelSchemaDb, names: reado
|
|
|
98
98
|
device_site_grants: import("../db/kernel-schema.js").DeviceSiteGrantsTable;
|
|
99
99
|
devices: import("../db/kernel-schema.js").DevicesTable;
|
|
100
100
|
directory_exclusions: import("../db/kernel-schema.js").DirectoryExclusionsTable;
|
|
101
|
+
directory_sync_state: import("../db/kernel-schema.js").DirectorySyncStateTable;
|
|
101
102
|
en: {
|
|
102
103
|
org_id: string;
|
|
103
104
|
plugin: string;
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* ({@link FENCE_SLACK_MS}, 1 s) never push a refusal past the bound. For a revocation that commits
|
|
13
13
|
* after the start `t` of the last read that saw the old epoch (that read's snapshot predates the
|
|
14
14
|
* commit):
|
|
15
|
-
* - admissions: a cached grant is trusted only until `t + maxAgeMs` (3 s by default)
|
|
15
|
+
* - admissions: a cached grant is trusted only until `t + maxAgeMs` (3 s by default), and a caller
|
|
16
|
+
* waiting for a fresh read is answered by `t + 4 s` at the latest ({@link GrantEpoch.ensureFresh}):
|
|
17
|
+
* a hung read never holds a refusal past the fence deadline;
|
|
16
18
|
* - in-flight work: when a later read sees the change, work not revalidated at the new epoch is
|
|
17
19
|
* fenced at `t + 4 s` ({@link GrantEpochOptions.onSettleDeadline}), at once if that time has
|
|
18
20
|
* passed, however slow the reads in between were;
|
|
@@ -99,7 +101,14 @@ export declare class GrantEpoch {
|
|
|
99
101
|
* first read or when stopped (the `grant_epoch_lag` gauge).
|
|
100
102
|
*/
|
|
101
103
|
lagSeconds(): number | undefined;
|
|
102
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* The fresh epoch, reading PostgreSQL first when needed; undefined when that read fails. After a
|
|
106
|
+
* successful read at `t`, a caller never waits past `t + FENCE_DEADLINE_MS`: the read may run
|
|
107
|
+
* until its own timeout, which can end at `t + 2 * maxAgeMs - pollMs` (the 5 s bound at the
|
|
108
|
+
* default age, past it with a larger one), so
|
|
109
|
+
* the wait is cut at the fence deadline, and past it the caller is refused at once. The read is
|
|
110
|
+
* still started (or joined) so the next caller sees the epoch as soon as PostgreSQL answers.
|
|
111
|
+
*/
|
|
103
112
|
ensureFresh(): Promise<string | undefined>;
|
|
104
113
|
/** One read at a time; concurrent callers share it. It settles within the read timeout. */
|
|
105
114
|
refresh(): Promise<string | undefined>;
|
|
@@ -15,7 +15,9 @@ import { KERNEL_APPLICATION_NAME } from "../db/pool.js";
|
|
|
15
15
|
* ({@link FENCE_SLACK_MS}, 1 s) never push a refusal past the bound. For a revocation that commits
|
|
16
16
|
* after the start `t` of the last read that saw the old epoch (that read's snapshot predates the
|
|
17
17
|
* commit):
|
|
18
|
-
* - admissions: a cached grant is trusted only until `t + maxAgeMs` (3 s by default)
|
|
18
|
+
* - admissions: a cached grant is trusted only until `t + maxAgeMs` (3 s by default), and a caller
|
|
19
|
+
* waiting for a fresh read is answered by `t + 4 s` at the latest ({@link GrantEpoch.ensureFresh}):
|
|
20
|
+
* a hung read never holds a refusal past the fence deadline;
|
|
19
21
|
* - in-flight work: when a later read sees the change, work not revalidated at the new epoch is
|
|
20
22
|
* fenced at `t + 4 s` ({@link GrantEpochOptions.onSettleDeadline}), at once if that time has
|
|
21
23
|
* passed, however slow the reads in between were;
|
|
@@ -147,9 +149,30 @@ export class GrantEpoch {
|
|
|
147
149
|
return undefined;
|
|
148
150
|
return Math.max(0, this.now() - this.readAt) / 1000;
|
|
149
151
|
}
|
|
150
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* The fresh epoch, reading PostgreSQL first when needed; undefined when that read fails. After a
|
|
154
|
+
* successful read at `t`, a caller never waits past `t + FENCE_DEADLINE_MS`: the read may run
|
|
155
|
+
* until its own timeout, which can end at `t + 2 * maxAgeMs - pollMs` (the 5 s bound at the
|
|
156
|
+
* default age, past it with a larger one), so
|
|
157
|
+
* the wait is cut at the fence deadline, and past it the caller is refused at once. The read is
|
|
158
|
+
* still started (or joined) so the next caller sees the epoch as soon as PostgreSQL answers.
|
|
159
|
+
*/
|
|
151
160
|
async ensureFresh() {
|
|
152
|
-
|
|
161
|
+
const fresh = this.fresh();
|
|
162
|
+
if (fresh !== undefined)
|
|
163
|
+
return fresh;
|
|
164
|
+
const reading = this.refresh();
|
|
165
|
+
// never read on this replica: nothing was trusted, so there is no deadline to keep
|
|
166
|
+
if (this.readAt === Number.NEGATIVE_INFINITY)
|
|
167
|
+
return reading;
|
|
168
|
+
const left = this.readAt + FENCE_DEADLINE_MS - this.now();
|
|
169
|
+
if (left <= 0)
|
|
170
|
+
return undefined;
|
|
171
|
+
let timer;
|
|
172
|
+
const deadline = new Promise((resolve) => {
|
|
173
|
+
timer = this.timer(() => resolve(undefined), left);
|
|
174
|
+
});
|
|
175
|
+
return Promise.race([reading, deadline]).finally(() => clearTimeout(timer));
|
|
153
176
|
}
|
|
154
177
|
/** One read at a time; concurrent callers share it. It settles within the read timeout. */
|
|
155
178
|
refresh() {
|
|
@@ -125,6 +125,8 @@ export interface DeclaredExtensionInfo {
|
|
|
125
125
|
configValid: boolean;
|
|
126
126
|
/** The plugin.json `displayName` of the module's plugin directory, if any. */
|
|
127
127
|
displayName: LocalizedName | null;
|
|
128
|
+
/** The extension points the manifest provides, in declared order. */
|
|
129
|
+
provides: string[];
|
|
128
130
|
}
|
|
129
131
|
/** The extension sources of {@link ExtensionHost.load}, loaded in this order (see {@link ExtensionSource}). */
|
|
130
132
|
export interface ExtensionLoadPlan {
|
|
@@ -730,6 +732,7 @@ export declare class ExtensionHost {
|
|
|
730
732
|
deploymentSchema(plugin: string): {
|
|
731
733
|
version: string;
|
|
732
734
|
schema: core.$ZodType | undefined;
|
|
735
|
+
provides: readonly string[];
|
|
733
736
|
} | undefined;
|
|
734
737
|
/** 在本副本生效、声明了部署级配置的插件。 */
|
|
735
738
|
configurablePlugins(): string[];
|
package/dist/extensions/host.js
CHANGED
|
@@ -1886,7 +1886,9 @@ let ExtensionHost = class ExtensionHost {
|
|
|
1886
1886
|
if (!schema)
|
|
1887
1887
|
continue;
|
|
1888
1888
|
try {
|
|
1889
|
-
const { problems } = configFormSchema(schema, level
|
|
1889
|
+
const { problems } = configFormSchema(schema, level, {
|
|
1890
|
+
provides: manifest.provides,
|
|
1891
|
+
});
|
|
1890
1892
|
if (problems.length > 0)
|
|
1891
1893
|
parts.push(describeConfigUiProblems(level, problems));
|
|
1892
1894
|
}
|
|
@@ -2240,6 +2242,7 @@ let ExtensionHost = class ExtensionHost {
|
|
|
2240
2242
|
configValid: this.configValidity.get(name) ??
|
|
2241
2243
|
(schema ? parseLoadGate(schema, this.extensionConfig[name] ?? {}).success : true),
|
|
2242
2244
|
displayName: this.declaredDisplayNames.get(name) ?? null,
|
|
2245
|
+
provides: extensionPointRefs(d.manifest.provides),
|
|
2243
2246
|
};
|
|
2244
2247
|
});
|
|
2245
2248
|
}
|
|
@@ -2722,7 +2725,7 @@ let ExtensionHost = class ExtensionHost {
|
|
|
2722
2725
|
const m = this.registry.current(plugin)?.manifest ??
|
|
2723
2726
|
this.declaredInfo.get(plugin)?.manifest ??
|
|
2724
2727
|
this.importedManifests.get(plugin)?.manifest;
|
|
2725
|
-
return m && { version: m.version, schema: m.config?.deployment };
|
|
2728
|
+
return m && { version: m.version, schema: m.config?.deployment, provides: m.provides };
|
|
2726
2729
|
}
|
|
2727
2730
|
/** 在本副本生效、声明了部署级配置的插件。 */
|
|
2728
2731
|
configurablePlugins() {
|
|
@@ -219,7 +219,9 @@ export function assertIsolatedSection(section, grant = {}) {
|
|
|
219
219
|
permissions?.http ||
|
|
220
220
|
permissions?.dialIn ||
|
|
221
221
|
permissions?.deviceAccess ||
|
|
222
|
-
permissions?.policyHooks?.length
|
|
222
|
+
permissions?.policyHooks?.length ||
|
|
223
|
+
// raw egress opens its own connections: only the server full-access realm carries it
|
|
224
|
+
permissions?.fullAccess?.rawEgress) {
|
|
223
225
|
throw new Error("This extension declares a capability that requires trusted execution");
|
|
224
226
|
}
|
|
225
227
|
if (section.configSchemas?.deployment !== undefined) {
|
|
@@ -355,7 +355,7 @@ let OrgOverrides = class OrgOverrides {
|
|
|
355
355
|
formSchemaOf(plugin, run) {
|
|
356
356
|
if (!run.schema)
|
|
357
357
|
return undefined;
|
|
358
|
-
const r = safeConfigFormSchema(run.schema, "deployment", (err, fallback) => this.log.warn("the deployment config form schema could not be built with its UI hints; hints dropped", { plugin, version: run.inst.manifest.version, schema: fallback, err }));
|
|
358
|
+
const r = safeConfigFormSchema(run.schema, "deployment", (err, fallback) => this.log.warn("the deployment config form schema could not be built with its UI hints; hints dropped", { plugin, version: run.inst.manifest.version, schema: fallback, err }), { provides: run.inst.manifest.provides });
|
|
359
359
|
return r?.schema;
|
|
360
360
|
}
|
|
361
361
|
async lockedRow(orgId, plugin) {
|
|
@@ -7,7 +7,7 @@ import { pluginSchemaName } from "../ctx/create-ctx.js";
|
|
|
7
7
|
import { MIGRATION_FILE_RE } from "../db/migrator.js";
|
|
8
8
|
import { ApiError } from "../errors.js";
|
|
9
9
|
import { HOST_ZOD_VERSION, PACKAGE_TGZ_LIMITS, PackageTgzError, packagePath, unpackPackageTgz, } from "../packages/tgz.js";
|
|
10
|
-
import { buildPermissionSet,
|
|
10
|
+
import { buildPermissionSet, parseCreatedTables } from "./permission-set.js";
|
|
11
11
|
import { migrationWarnings, warningsDigest } from "./permission-view.js";
|
|
12
12
|
/**
|
|
13
13
|
* Reading and validating an extension package: a plugin tgz (`readPluginPackage`,
|
|
@@ -160,8 +160,6 @@ export async function readExtensionPackage(bytes, opts) {
|
|
|
160
160
|
`plugin ${manifest.name} has no extension (no "extension" in ${PLUGIN_MANIFEST_FILE}); import it into the catalog instead`,
|
|
161
161
|
], "extension.no_extension");
|
|
162
162
|
}
|
|
163
|
-
if (ext.manifest.permissions.fullAccess !== undefined)
|
|
164
|
-
throw new ExtensionPackageError([FULL_ACCESS_UNSUPPORTED]);
|
|
165
163
|
await lexerInit;
|
|
166
164
|
const issues = checkModuleGraph(packagePath(ext.entry), files);
|
|
167
165
|
const migrationSql = [];
|
|
@@ -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
|
|
@@ -143,6 +150,11 @@ export interface AdminExtensionView {
|
|
|
143
150
|
approvedBy: string | null;
|
|
144
151
|
source: "cli" | "auto" | "web" | "bootstrap";
|
|
145
152
|
} | null;
|
|
153
|
+
/**
|
|
154
|
+
* The extension points the manifest provides, in declared order (the Extension tab draws one
|
|
155
|
+
* section per point in this order); empty when the package cannot be read.
|
|
156
|
+
*/
|
|
157
|
+
provides: string[];
|
|
146
158
|
/** 有部署级配置字段。 */
|
|
147
159
|
configurable: boolean;
|
|
148
160
|
configValid: boolean;
|
|
@@ -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
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -51,8 +51,8 @@ export { deploymentConfigIsolatable, isolatedDeploymentSchema, } from "./extensi
|
|
|
51
51
|
export { ExtensionLifecycle, PLUGINS_RECONCILE_JOB, PLUGINS_RECONCILE_TOPIC, } from "./extensions/lifecycle.js";
|
|
52
52
|
export { ensureMigrated, MIGRATE_LOCK_PREFIX, type MigrateLockDeps, PLUGINS_MIGRATED_TOPIC, unrunMigrations, } from "./extensions/migrate-lock.js";
|
|
53
53
|
export { EXTENSION_PACKAGE_LIMITS, type ExtensionPackage, ExtensionPackageError, type ExtensionPackageLimits, type ExtensionPackageSection, extractExtensionPackage, HOST_ZOD_VERSION, permissionSetOfPackage, type ReadExtensionPackageOptions, readExtensionPackage, } from "./extensions/package.js";
|
|
54
|
-
export { blockingKeys, buildPermissionSet, computePermissionSet, diffPermissions, type PermissionSet, permissionKeys, WARNINGS_KEY_PREFIX, } from "./extensions/permission-set.js";
|
|
55
|
-
export { type AdminExtensionView, type DeploymentExtensionStatus, isSensitivePermissionKey, type PermissionGroup, type PermissionItem, permissionGroups, permissionKeyItems, reviewHash, SENSITIVE_EXTENSION_POINTS, type SensitiveReason, } from "./extensions/permission-view.js";
|
|
54
|
+
export { blockingKeys, buildPermissionSet, computePermissionSet, diffPermissions, type PermissionSet, permissionKeys, RAW_EGRESS_PERMISSION_KEY, WARNINGS_KEY_PREFIX, } from "./extensions/permission-set.js";
|
|
55
|
+
export { type AdminExtensionView, type DeploymentExtensionStatus, isSensitivePermissionKey, type PermissionGroup, type PermissionItem, permissionGroups, permissionKeyItems, permissionPurposes, reviewHash, SENSITIVE_EXTENSION_POINTS, type SensitiveReason, } from "./extensions/permission-view.js";
|
|
56
56
|
export { ExtensionRegistry } from "./extensions/registry.js";
|
|
57
57
|
export { ExtensionResolveError, resolveExtensions } from "./extensions/resolve.js";
|
|
58
58
|
export { fullAccessPurpose, grantPurposeRows, REVIEW_CONTRACT_VERSION, type ReviewDisplay, type ReviewInput, reviewDisplay, revisionReviewHash, } from "./extensions/review-hash.js";
|
package/dist/index.js
CHANGED
|
@@ -50,8 +50,8 @@ export { deploymentConfigIsolatable, isolatedDeploymentSchema, } from "./extensi
|
|
|
50
50
|
export { ExtensionLifecycle, PLUGINS_RECONCILE_JOB, PLUGINS_RECONCILE_TOPIC, } from "./extensions/lifecycle.js";
|
|
51
51
|
export { ensureMigrated, MIGRATE_LOCK_PREFIX, PLUGINS_MIGRATED_TOPIC, unrunMigrations, } from "./extensions/migrate-lock.js";
|
|
52
52
|
export { EXTENSION_PACKAGE_LIMITS, ExtensionPackageError, extractExtensionPackage, HOST_ZOD_VERSION, permissionSetOfPackage, readExtensionPackage, } from "./extensions/package.js";
|
|
53
|
-
export { blockingKeys, buildPermissionSet, computePermissionSet, diffPermissions, permissionKeys, WARNINGS_KEY_PREFIX, } from "./extensions/permission-set.js";
|
|
54
|
-
export { isSensitivePermissionKey, permissionGroups, permissionKeyItems, reviewHash, SENSITIVE_EXTENSION_POINTS, } from "./extensions/permission-view.js";
|
|
53
|
+
export { blockingKeys, buildPermissionSet, computePermissionSet, diffPermissions, permissionKeys, RAW_EGRESS_PERMISSION_KEY, WARNINGS_KEY_PREFIX, } from "./extensions/permission-set.js";
|
|
54
|
+
export { isSensitivePermissionKey, permissionGroups, permissionKeyItems, permissionPurposes, reviewHash, SENSITIVE_EXTENSION_POINTS, } from "./extensions/permission-view.js";
|
|
55
55
|
export { ExtensionRegistry } from "./extensions/registry.js";
|
|
56
56
|
export { ExtensionResolveError, resolveExtensions } from "./extensions/resolve.js";
|
|
57
57
|
export { fullAccessPurpose, grantPurposeRows, REVIEW_CONTRACT_VERSION, reviewDisplay, revisionReviewHash, } from "./extensions/review-hash.js";
|