@capybara-hq/kernel 0.1.0-rc.37 → 0.1.0-rc.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin.module.d.ts +2 -1
- package/dist/admin/admin.module.js +5 -1
- package/dist/admin/org-network.controller.d.ts +30 -0
- package/dist/admin/org-network.controller.js +77 -0
- package/dist/admin/org-network.schemas.d.ts +16 -0
- package/dist/admin/org-network.schemas.js +27 -0
- package/dist/admin/org-network.service.d.ts +41 -0
- package/dist/admin/org-network.service.js +101 -0
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +8 -2
- package/dist/conversations/event-log.js +4 -1
- package/dist/ctx/create-ctx.d.ts +8 -1
- package/dist/ctx/create-ctx.js +12 -1
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/db/kernel-schema.d.ts +10 -0
- package/dist/devices/devices.service.js +2 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +5 -0
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +7 -1
- package/dist/extensions/host.js +13 -3
- package/dist/http/api.module.js +2 -0
- package/dist/infra/database/transaction-host.d.ts +32 -1
- package/dist/infra/database/transaction-host.js +30 -4
- package/dist/infra/database/xact-lock.d.ts +16 -0
- package/dist/infra/database/xact-lock.js +28 -1
- package/dist/net/public-address.d.ts +21 -1
- package/dist/net/public-address.js +56 -10
- package/dist/net/safe-fetch.d.ts +4 -1
- package/dist/net/safe-fetch.js +15 -4
- package/dist/orgs/directory-sync.js +2 -0
- package/dist/orgs/members.service.js +5 -0
- package/dist/orgs/network-allowances.service.d.ts +79 -0
- package/dist/orgs/network-allowances.service.js +371 -0
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +9 -2
- package/dist/orgs/org-lock.d.ts +28 -2
- package/dist/orgs/org-lock.js +59 -4
- package/dist/orgs/orgs.controller.d.ts +11 -2
- package/dist/orgs/orgs.controller.js +19 -3
- package/dist/orgs/orgs.module.d.ts +2 -1
- package/dist/orgs/orgs.module.js +5 -1
- package/dist/orgs/orgs.schemas.d.ts +12 -0
- package/dist/orgs/orgs.schemas.js +5 -0
- package/dist/orgs/orgs.service.js +6 -1
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/ops/orgs.ops.d.ts +7 -1
- package/dist/platform/ops/orgs.ops.js +122 -3
- package/dist/platform/route-schemas.js +3 -0
- package/dist/runtime/checkpointer.d.ts +3 -0
- package/dist/runtime/checkpointer.js +7 -4
- package/dist/runtime/langgraph-loop.js +8 -3
- package/dist/runtime/run-execution.d.ts +56 -3
- package/dist/runtime/run-execution.js +77 -8
- package/dist/runtime/step-log.d.ts +5 -0
- package/dist/runtime/step-log.js +9 -4
- package/dist/runtime/waits.js +3 -1
- package/dist/tools/connector-content.js +1 -0
- package/dist/tools/connectors.service.js +9 -6
- package/dist/tools/drift.d.ts +5 -1
- package/dist/tools/drift.js +9 -4
- package/dist/tools/pipeline.js +1 -0
- package/package.json +3 -3
- package/src/migrations/0145_org_network_allowances.sql +12 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deployment administration: the setup wizard, the audit log reader (the platform's and each
|
|
3
3
|
* org's) and the admin overview with its health read, seven-day usage aggregate and dead outbox
|
|
4
|
-
* rows (its controllers are the api
|
|
4
|
+
* rows, and the super admin's side of the org network allowances (its controllers are the api
|
|
5
|
+
* role's, `ApiModule`).
|
|
5
6
|
*/
|
|
6
7
|
export declare class AdminModule {
|
|
7
8
|
}
|
|
@@ -20,6 +20,7 @@ import { RunJobsModule } from "../runtime/run-jobs.js";
|
|
|
20
20
|
import { UsageReportModule } from "../runtime/usage-report.js";
|
|
21
21
|
import { AuditLogService } from "./audit-log.service.js";
|
|
22
22
|
import { AdminHealthService } from "./health.service.js";
|
|
23
|
+
import { OrgNetworkAdmin } from "./org-network.service.js";
|
|
23
24
|
import { OutboxDeadService } from "./outbox-dead.service.js";
|
|
24
25
|
import { AdminOverviewService } from "./overview.service.js";
|
|
25
26
|
import { SetupService } from "./setup.service.js";
|
|
@@ -28,7 +29,8 @@ import { AdminUsageService } from "./usage.service.js";
|
|
|
28
29
|
/**
|
|
29
30
|
* Deployment administration: the setup wizard, the audit log reader (the platform's and each
|
|
30
31
|
* org's) and the admin overview with its health read, seven-day usage aggregate and dead outbox
|
|
31
|
-
* rows (its controllers are the api
|
|
32
|
+
* rows, and the super admin's side of the org network allowances (its controllers are the api
|
|
33
|
+
* role's, `ApiModule`).
|
|
32
34
|
*/
|
|
33
35
|
let AdminModule = class AdminModule {
|
|
34
36
|
};
|
|
@@ -60,6 +62,7 @@ AdminModule = __decorate([
|
|
|
60
62
|
AdminHealthService,
|
|
61
63
|
AdminUsageService,
|
|
62
64
|
OutboxDeadService,
|
|
65
|
+
OrgNetworkAdmin,
|
|
63
66
|
],
|
|
64
67
|
exports: [
|
|
65
68
|
SetupService,
|
|
@@ -68,6 +71,7 @@ AdminModule = __decorate([
|
|
|
68
71
|
AdminHealthService,
|
|
69
72
|
AdminUsageService,
|
|
70
73
|
OutboxDeadService,
|
|
74
|
+
OrgNetworkAdmin,
|
|
71
75
|
],
|
|
72
76
|
})
|
|
73
77
|
], AdminModule);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type Principal } from "../identity/principal.js";
|
|
3
|
+
import { type NetworkAllowanceView } from "../orgs/orgs.schemas.js";
|
|
4
|
+
import { AdminOrgParams } from "./admin.schemas.js";
|
|
5
|
+
import { NetworkAllowanceBody, NetworkAllowanceParams } from "./org-network.schemas.js";
|
|
6
|
+
import { OrgNetworkAdmin } from "./org-network.service.js";
|
|
7
|
+
/**
|
|
8
|
+
* An org's network allowances (`/api/v1/admin/orgs/:orgId/network-allowances`, plugin safe fetch
|
|
9
|
+
* spec): the internal endpoints the org's extension requests may reach although they resolve to
|
|
10
|
+
* private or loopback addresses. Super admins only (service tokens 403); adding and removing are
|
|
11
|
+
* audited `org.network_allowance_added` / `org.network_allowance_removed`. Org admins read their
|
|
12
|
+
* org's list at `GET /api/v1/orgs/:orgId/network-allowances`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AdminOrgNetworkController {
|
|
15
|
+
private readonly admin;
|
|
16
|
+
constructor(admin: OrgNetworkAdmin);
|
|
17
|
+
/** The org's entries, oldest first; a missing or deleted org → `org.not_found`. */
|
|
18
|
+
list({ orgId }: z.infer<typeof AdminOrgParams>): Promise<{
|
|
19
|
+
allowances: NetworkAllowanceView[];
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Adds an entry; an invalid one → 400 `org.network_allowance_invalid` with the reason. Only a
|
|
23
|
+
* person widens: a personal access token → 400 `org.network_allowance_widen_not_allowed`.
|
|
24
|
+
*/
|
|
25
|
+
add(principal: Principal, { orgId }: z.infer<typeof AdminOrgParams>, body: z.infer<typeof NetworkAllowanceBody>): Promise<{
|
|
26
|
+
allowance: NetworkAllowanceView;
|
|
27
|
+
}>;
|
|
28
|
+
/** Removes an entry; an id the org does not list → 404 `org.network_allowance_not_found`. */
|
|
29
|
+
remove(principal: Principal, { orgId, id }: z.infer<typeof AdminOrgParams> & z.infer<typeof NetworkAllowanceParams>): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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, Delete, Get, HttpCode, Inject, Post } from "@nestjs/common";
|
|
11
|
+
import { CurrentPrincipal, SuperAdmin } from "../identity/principal.js";
|
|
12
|
+
import { writeActorOf } from "../identity/write-actor.js";
|
|
13
|
+
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
14
|
+
import { ZBody, ZParam } from "../infra/validation/zod-params.js";
|
|
15
|
+
import { networkAllowanceView } from "../orgs/orgs.schemas.js";
|
|
16
|
+
import { AdminOrgParams } from "./admin.schemas.js";
|
|
17
|
+
import { NetworkAllowanceBody, NetworkAllowanceParams } from "./org-network.schemas.js";
|
|
18
|
+
import { OrgNetworkAdmin } from "./org-network.service.js";
|
|
19
|
+
class AdminOrgNetworkParamsDto extends createZodDto(AdminOrgParams, "AdminOrgNetworkParams") {
|
|
20
|
+
}
|
|
21
|
+
class NetworkAllowanceItemParamsDto extends createZodDto(AdminOrgParams.extend(NetworkAllowanceParams.shape), "NetworkAllowanceItemParams") {
|
|
22
|
+
}
|
|
23
|
+
class NetworkAllowanceBodyDto extends createZodDto(NetworkAllowanceBody, "NetworkAllowanceBody") {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An org's network allowances (`/api/v1/admin/orgs/:orgId/network-allowances`, plugin safe fetch
|
|
27
|
+
* spec): the internal endpoints the org's extension requests may reach although they resolve to
|
|
28
|
+
* private or loopback addresses. Super admins only (service tokens 403); adding and removing are
|
|
29
|
+
* audited `org.network_allowance_added` / `org.network_allowance_removed`. Org admins read their
|
|
30
|
+
* org's list at `GET /api/v1/orgs/:orgId/network-allowances`.
|
|
31
|
+
*/
|
|
32
|
+
let AdminOrgNetworkController = class AdminOrgNetworkController {
|
|
33
|
+
admin;
|
|
34
|
+
constructor(admin) {
|
|
35
|
+
this.admin = admin;
|
|
36
|
+
}
|
|
37
|
+
/** The org's entries, oldest first; a missing or deleted org → `org.not_found`. */
|
|
38
|
+
async list({ orgId }) {
|
|
39
|
+
return { allowances: (await this.admin.list(orgId)).map(networkAllowanceView) };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Adds an entry; an invalid one → 400 `org.network_allowance_invalid` with the reason. Only a
|
|
43
|
+
* person widens: a personal access token → 400 `org.network_allowance_widen_not_allowed`.
|
|
44
|
+
*/
|
|
45
|
+
async add(principal, { orgId }, body) {
|
|
46
|
+
const actor = writeActorOf(principal);
|
|
47
|
+
const allowance = await this.admin.add(orgId, body.entry, actor, actor.tokenId !== undefined);
|
|
48
|
+
return { allowance: networkAllowanceView(allowance) };
|
|
49
|
+
}
|
|
50
|
+
/** Removes an entry; an id the org does not list → 404 `org.network_allowance_not_found`. */
|
|
51
|
+
async remove(principal, { orgId, id }) {
|
|
52
|
+
await this.admin.remove(orgId, id, writeActorOf(principal));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
__decorate([
|
|
56
|
+
Get(),
|
|
57
|
+
__param(0, ZParam(AdminOrgNetworkParamsDto))
|
|
58
|
+
], AdminOrgNetworkController.prototype, "list", null);
|
|
59
|
+
__decorate([
|
|
60
|
+
Post(),
|
|
61
|
+
HttpCode(201),
|
|
62
|
+
__param(0, CurrentPrincipal()),
|
|
63
|
+
__param(1, ZParam(AdminOrgNetworkParamsDto)),
|
|
64
|
+
__param(2, ZBody(NetworkAllowanceBodyDto))
|
|
65
|
+
], AdminOrgNetworkController.prototype, "add", null);
|
|
66
|
+
__decorate([
|
|
67
|
+
Delete(":id"),
|
|
68
|
+
HttpCode(204),
|
|
69
|
+
__param(0, CurrentPrincipal()),
|
|
70
|
+
__param(1, ZParam(NetworkAllowanceItemParamsDto))
|
|
71
|
+
], AdminOrgNetworkController.prototype, "remove", null);
|
|
72
|
+
AdminOrgNetworkController = __decorate([
|
|
73
|
+
Controller("api/v1/admin/orgs/:orgId/network-allowances"),
|
|
74
|
+
SuperAdmin(),
|
|
75
|
+
__param(0, Inject(OrgNetworkAdmin))
|
|
76
|
+
], AdminOrgNetworkController);
|
|
77
|
+
export { AdminOrgNetworkController };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
3
|
+
/**
|
|
4
|
+
* `POST /api/v1/admin/orgs/:orgId/network-allowances`: one internal endpoint the org's extension
|
|
5
|
+
* requests may reach (plugin safe fetch spec). The service checks and normalizes the entry and
|
|
6
|
+
* refuses an invalid one with `org.network_allowance_invalid`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NetworkAllowanceBody: z.ZodObject<{
|
|
9
|
+
entry: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
/** `DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id`. */
|
|
12
|
+
export declare const NetworkAllowanceParams: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/** The super admin's org network allowance routes (the org admins' read is in `ORG_ROUTES`). */
|
|
16
|
+
export declare const ORG_NETWORK_ROUTES: readonly RouteSchemas[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `POST /api/v1/admin/orgs/:orgId/network-allowances`: one internal endpoint the org's extension
|
|
4
|
+
* requests may reach (plugin safe fetch spec). The service checks and normalizes the entry and
|
|
5
|
+
* refuses an invalid one with `org.network_allowance_invalid`.
|
|
6
|
+
*/
|
|
7
|
+
export const NetworkAllowanceBody = z.object({
|
|
8
|
+
entry: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(300)
|
|
12
|
+
.describe("A hostname or *.domain wildcard (https, any port), an IP address or CIDR (e.g. 10.1.0.0/16), or an origin such as http://mcp.internal:8080 (exactly that origin, plain http allowed)."),
|
|
13
|
+
});
|
|
14
|
+
/** `DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id`. */
|
|
15
|
+
export const NetworkAllowanceParams = z.object({
|
|
16
|
+
id: z.string().min(1).max(100).describe("The allowance id (from the list)."),
|
|
17
|
+
});
|
|
18
|
+
/** The super admin's org network allowance routes (the org admins' read is in `ORG_ROUTES`). */
|
|
19
|
+
export const ORG_NETWORK_ROUTES = [
|
|
20
|
+
// `:orgId` is never compared: the admin operations name the org with an `orgId` extra
|
|
21
|
+
{ route: "GET /api/v1/admin/orgs/:orgId/network-allowances" },
|
|
22
|
+
{ route: "POST /api/v1/admin/orgs/:orgId/network-allowances", body: NetworkAllowanceBody },
|
|
23
|
+
{
|
|
24
|
+
route: "DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id",
|
|
25
|
+
params: NetworkAllowanceParams,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
2
|
+
import type { WriteActor } from "../identity/write-actor.js";
|
|
3
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
|
+
import { type OrgNetworkAllowance, OrgNetworkAllowances } from "../orgs/network-allowances.service.js";
|
|
5
|
+
import { OrgsService } from "../orgs/orgs.service.js";
|
|
6
|
+
/**
|
|
7
|
+
* The super admin's side of the org network allowances (plugin safe fetch spec): the admin routes
|
|
8
|
+
* and their Platform operations call it. Writes take the super admin lock and re-check the actor
|
|
9
|
+
* in the same transaction as the store's write (`OrgNetworkAllowances` joins it).
|
|
10
|
+
*
|
|
11
|
+
* Only a person widens: an add is refused for an API token or the Platform tool (`onlyNarrows`)
|
|
12
|
+
* with `org.network_allowance_widen_not_allowed`; listing and removing stay open to both.
|
|
13
|
+
*/
|
|
14
|
+
export declare class OrgNetworkAdmin {
|
|
15
|
+
private readonly allowances;
|
|
16
|
+
private readonly orgs;
|
|
17
|
+
private readonly adminLock;
|
|
18
|
+
readonly txHost: TransactionHost;
|
|
19
|
+
constructor(allowances: OrgNetworkAllowances, orgs: OrgsService, adminLock: SuperAdminLock, txHost: TransactionHost);
|
|
20
|
+
/** The org's entries, oldest first; a missing or deleted org is `org.not_found`. */
|
|
21
|
+
list(orgId: string): Promise<OrgNetworkAllowance[]>;
|
|
22
|
+
/**
|
|
23
|
+
* The read-only preconditions of {@link add}, throwing its own refusals: `onlyNarrows` →
|
|
24
|
+
* `org.network_allowance_widen_not_allowed`, a missing org → `org.not_found`, an invalid entry →
|
|
25
|
+
* `org.network_allowance_invalid` (the cap is checked by the write only).
|
|
26
|
+
*/
|
|
27
|
+
checkAdd(orgId: string, entry: string, onlyNarrows: boolean): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Adds an entry (audited `org.network_allowance_added`); an entry already listed is returned.
|
|
30
|
+
* `onlyNarrows` (an API token, the Platform tool) refuses it: only a person widens. The actor's
|
|
31
|
+
* token id and `auditDetail` go into the audit event.
|
|
32
|
+
*/
|
|
33
|
+
add(orgId: string, entry: string, actor: WriteActor, onlyNarrows: boolean, auditDetail?: Record<string, unknown>): Promise<OrgNetworkAllowance>;
|
|
34
|
+
/**
|
|
35
|
+
* Removes the org's entry `id` (audited `org.network_allowance_removed`); a missing or deleted
|
|
36
|
+
* org is `org.not_found`, an id the org does not list `org.network_allowance_not_found`. The
|
|
37
|
+
* actor's token id and `auditDetail` go into the audit event.
|
|
38
|
+
*/
|
|
39
|
+
remove(orgId: string, id: string, actor: WriteActor, auditDetail?: Record<string, unknown>): Promise<void>;
|
|
40
|
+
private assertOrg;
|
|
41
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { ApiError } from "../errors.js";
|
|
12
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
13
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
14
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
15
|
+
import { allowanceEntryProblem, OrgNetworkAllowances, } from "../orgs/network-allowances.service.js";
|
|
16
|
+
import { OrgsService } from "../orgs/orgs.service.js";
|
|
17
|
+
/**
|
|
18
|
+
* The super admin's side of the org network allowances (plugin safe fetch spec): the admin routes
|
|
19
|
+
* and their Platform operations call it. Writes take the super admin lock and re-check the actor
|
|
20
|
+
* in the same transaction as the store's write (`OrgNetworkAllowances` joins it).
|
|
21
|
+
*
|
|
22
|
+
* Only a person widens: an add is refused for an API token or the Platform tool (`onlyNarrows`)
|
|
23
|
+
* with `org.network_allowance_widen_not_allowed`; listing and removing stay open to both.
|
|
24
|
+
*/
|
|
25
|
+
let OrgNetworkAdmin = class OrgNetworkAdmin {
|
|
26
|
+
allowances;
|
|
27
|
+
orgs;
|
|
28
|
+
adminLock;
|
|
29
|
+
txHost;
|
|
30
|
+
constructor(allowances, orgs, adminLock, txHost) {
|
|
31
|
+
this.allowances = allowances;
|
|
32
|
+
this.orgs = orgs;
|
|
33
|
+
this.adminLock = adminLock;
|
|
34
|
+
this.txHost = txHost;
|
|
35
|
+
}
|
|
36
|
+
/** The org's entries, oldest first; a missing or deleted org is `org.not_found`. */
|
|
37
|
+
async list(orgId) {
|
|
38
|
+
await this.assertOrg(orgId);
|
|
39
|
+
return this.allowances.list(orgId);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The read-only preconditions of {@link add}, throwing its own refusals: `onlyNarrows` →
|
|
43
|
+
* `org.network_allowance_widen_not_allowed`, a missing org → `org.not_found`, an invalid entry →
|
|
44
|
+
* `org.network_allowance_invalid` (the cap is checked by the write only).
|
|
45
|
+
*/
|
|
46
|
+
async checkAdd(orgId, entry, onlyNarrows) {
|
|
47
|
+
assertWidenAllowed(onlyNarrows);
|
|
48
|
+
await this.assertOrg(orgId);
|
|
49
|
+
const problem = allowanceEntryProblem(entry);
|
|
50
|
+
if (problem !== null) {
|
|
51
|
+
throw new ApiError("org.network_allowance_invalid", `${entry.trim()}: ${problem}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Adds an entry (audited `org.network_allowance_added`); an entry already listed is returned.
|
|
56
|
+
* `onlyNarrows` (an API token, the Platform tool) refuses it: only a person widens. The actor's
|
|
57
|
+
* token id and `auditDetail` go into the audit event.
|
|
58
|
+
*/
|
|
59
|
+
async add(orgId, entry, actor, onlyNarrows, auditDetail = {}) {
|
|
60
|
+
assertWidenAllowed(onlyNarrows);
|
|
61
|
+
await this.adminLock.lockAndAuthorize(actor.accountId);
|
|
62
|
+
return this.allowances.add(orgId, entry, actor, auditDetail);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Removes the org's entry `id` (audited `org.network_allowance_removed`); a missing or deleted
|
|
66
|
+
* org is `org.not_found`, an id the org does not list `org.network_allowance_not_found`. The
|
|
67
|
+
* actor's token id and `auditDetail` go into the audit event.
|
|
68
|
+
*/
|
|
69
|
+
async remove(orgId, id, actor, auditDetail = {}) {
|
|
70
|
+
await this.adminLock.lockAndAuthorize(actor.accountId);
|
|
71
|
+
await this.assertOrg(orgId);
|
|
72
|
+
if (!(await this.allowances.remove(orgId, id, actor, auditDetail))) {
|
|
73
|
+
throw new ApiError("org.network_allowance_not_found", "The organization has no such internal endpoint allowance");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async assertOrg(orgId) {
|
|
77
|
+
if ((await this.orgs.get(orgId)) === undefined) {
|
|
78
|
+
throw new ApiError("org.not_found", "Organization not found");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
__decorate([
|
|
83
|
+
Transactional()
|
|
84
|
+
], OrgNetworkAdmin.prototype, "add", null);
|
|
85
|
+
__decorate([
|
|
86
|
+
Transactional()
|
|
87
|
+
], OrgNetworkAdmin.prototype, "remove", null);
|
|
88
|
+
OrgNetworkAdmin = __decorate([
|
|
89
|
+
Injectable(),
|
|
90
|
+
__param(0, Inject(OrgNetworkAllowances)),
|
|
91
|
+
__param(1, Inject(OrgsService)),
|
|
92
|
+
__param(2, Inject(SuperAdminLock)),
|
|
93
|
+
__param(3, Inject(TransactionHost))
|
|
94
|
+
], OrgNetworkAdmin);
|
|
95
|
+
export { OrgNetworkAdmin };
|
|
96
|
+
/** Only a person in a web session widens what an org's extension requests may reach. */
|
|
97
|
+
function assertWidenAllowed(onlyNarrows) {
|
|
98
|
+
if (onlyNarrows) {
|
|
99
|
+
throw new ApiError("org.network_allowance_widen_not_allowed", "Allowing an internal endpoint needs a super admin in the admin console on the web, not an API token or the Platform tool.");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -188,7 +188,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
188
188
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
189
189
|
export declare const HOST_VERSIONS: {
|
|
190
190
|
readonly kernel: string;
|
|
191
|
-
readonly sdk: "0.1.0-rc.
|
|
191
|
+
readonly sdk: "0.1.0-rc.29";
|
|
192
192
|
};
|
|
193
193
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
194
194
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
107
107
|
allowedHosts: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
108
108
|
}, z.core.$strict>>;
|
|
109
109
|
net: z.ZodPrefault<z.ZodObject<{
|
|
110
|
+
allowInsecureLoopback: z.ZodDefault<z.ZodBoolean>;
|
|
110
111
|
httpsProxy: z.ZodOptional<z.ZodString>;
|
|
111
112
|
noProxy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
112
113
|
}, z.core.$strict>>;
|
package/dist/config/schema.js
CHANGED
|
@@ -534,6 +534,12 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
534
534
|
.prefault({}),
|
|
535
535
|
net: z
|
|
536
536
|
.strictObject({
|
|
537
|
+
allowInsecureLoopback: z
|
|
538
|
+
.boolean()
|
|
539
|
+
.default(false)
|
|
540
|
+
.meta(meta({
|
|
541
|
+
description: "Testing only: lift every loopback and unspecified-address refusal for extensions' ctx.net.fetch (127.0.0.0/8, ::1, 0.0.0.0/8, ::), including plain http to them (fake servers in test stacks). Link-local and cloud metadata addresses stay refused. Never set it in production",
|
|
542
|
+
})),
|
|
537
543
|
httpsProxy: z
|
|
538
544
|
.string()
|
|
539
545
|
.superRefine((value, ctx) => {
|
|
@@ -544,7 +550,7 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
544
550
|
.optional()
|
|
545
551
|
.meta(meta({
|
|
546
552
|
secret: true,
|
|
547
|
-
description: "HTTP(S) egress proxy for marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins)
|
|
553
|
+
description: "HTTP(S) egress proxy for marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins) OAuth requests (discovery, registration, token endpoints) and extensions' ctx.net.fetch requests (person-supplied URLs such as connector endpoints), e.g. http://user:password@proxy.internal:3128. https downloads tunnel through it with CONNECT and the kernel no longer resolves their hosts: the proxy does, so blocking private and internal addresses becomes the proxy's job, including for organizations' ctx.net requests (IP-literal URLs are still checked against marketplaces.allowPrivateHosts, or for ctx.net against the organization's allowed internal endpoints). Loopback hosts never use it, nor does an http:// npm registry; list an internal https registry in net.noProxy, and likewise every internal https host an organization's allowed internal endpoints name (with a proxy set the proxy resolves it, so the organization's allowances do not apply unless the host is in net.noProxy). HTTPS_PROXY / NODE_USE_ENV_PROXY are not read. Credentials in the URL are sent as Basic Proxy-Authorization and never logged",
|
|
548
554
|
})),
|
|
549
555
|
noProxy: z
|
|
550
556
|
.array(z
|
|
@@ -559,7 +565,7 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
559
565
|
.max(100)
|
|
560
566
|
.default([])
|
|
561
567
|
.meta(meta({
|
|
562
|
-
description: "Hostnames or IP addresses that bypass net.httpsProxy (an entry also matches its subdomains; a leading dot is allowed). These hosts are resolved locally and must resolve to public addresses unless listed in marketplaces.allowPrivateHosts",
|
|
568
|
+
description: "Hostnames or IP addresses that bypass net.httpsProxy (an entry also matches its subdomains; a leading dot is allowed). These hosts are resolved locally and must resolve to public addresses unless listed in marketplaces.allowPrivateHosts (marketplace downloads) or in an organization's allowed internal endpoints (ctx.net.fetch). List an organization's allowed internal https hosts here when net.httpsProxy is set, otherwise the proxy resolves them and the allowances do not apply",
|
|
563
569
|
})),
|
|
564
570
|
})
|
|
565
571
|
.prefault({}),
|
|
@@ -123,6 +123,9 @@ let EventLog = class EventLog {
|
|
|
123
123
|
const { events: out, fresh } = await this.write(conversationId, events, bodies);
|
|
124
124
|
return { events: out, fresh };
|
|
125
125
|
}
|
|
126
|
+
// shared admission under a run fence (`RunExecution`): an append locks only the conversation row
|
|
127
|
+
// and its own rows, so the runs of one org append in parallel (a tool step's are still admitted
|
|
128
|
+
// exclusively)
|
|
126
129
|
async appendOwn(conversationId, events, bodies) {
|
|
127
130
|
const { events: out, toSeq } = await this.write(conversationId, events, bodies);
|
|
128
131
|
return { events: out, toSeq };
|
|
@@ -419,7 +422,7 @@ __decorate([
|
|
|
419
422
|
Transactional({ propagation: "mandatory" })
|
|
420
423
|
], EventLog.prototype, "appendInReport", null);
|
|
421
424
|
__decorate([
|
|
422
|
-
Transactional({ propagation: "requires_new" })
|
|
425
|
+
Transactional({ propagation: "requires_new", admission: "shared" })
|
|
423
426
|
], EventLog.prototype, "appendOwn", null);
|
|
424
427
|
EventLog = __decorate([
|
|
425
428
|
Injectable(),
|
package/dist/ctx/create-ctx.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { HookRunner } from "../runtime/hook-calls.js";
|
|
|
10
10
|
import type { EmbedTokens } from "../ui/embed-token.js";
|
|
11
11
|
import { type UiActionHandler, type UiRender } from "../ui/registry.js";
|
|
12
12
|
import { type BusSubscriber } from "./bus.js";
|
|
13
|
+
import { type ExtensionNetServices } from "./net.js";
|
|
13
14
|
import { type Keyring } from "./secrets.js";
|
|
14
15
|
/** 内核提供给插件宿主的共享依赖。 */
|
|
15
16
|
export interface KernelDeps {
|
|
@@ -30,6 +31,11 @@ export interface KernelDeps {
|
|
|
30
31
|
* test): `ctx.models` calls reject.
|
|
31
32
|
*/
|
|
32
33
|
models?: Pick<ModelEmbeddings, "embed" | "describe">;
|
|
34
|
+
/**
|
|
35
|
+
* What `ctx.net` reads per call: the kernel config (`net.*`) and the org network allowances.
|
|
36
|
+
* Absent (a ctx built alone in a test): `ctx.net.fetch` rejects every request.
|
|
37
|
+
*/
|
|
38
|
+
net?: ExtensionNetServices;
|
|
33
39
|
/**
|
|
34
40
|
* The host's hook registry: `ctx.models.embed` fires `model.request` through it (spec B §5.4).
|
|
35
41
|
* A required key, so no builder leaves policy hooks out by omission (fail closed by
|
|
@@ -157,7 +163,8 @@ export declare class LiveConfig {
|
|
|
157
163
|
* registered routes, provided extension points and a close function.
|
|
158
164
|
* `deploymentConfig` may be a {@link LiveConfig} (shared by the instance, replaceable in place);
|
|
159
165
|
* otherwise a fixed value is wrapped.
|
|
160
|
-
* - Granted automatically: `kv`, `lock`, `bus`, `queue`, `log`, `db`, `config`, `provide
|
|
166
|
+
* - Granted automatically: `kv`, `lock`, `bus`, `queue`, `log`, `db`, `config`, `provide`, `net`
|
|
167
|
+
* (through `deps.net`, see `ctx/net.ts`);
|
|
161
168
|
* - `secrets` only with `permissions.secrets`, `storage` only with `permissions.storage`, `models`
|
|
162
169
|
* only with `permissions.models` (and only its `embedding` purposes, through `deps.models`); `http.route`
|
|
163
170
|
* only the method + path declared in `permissions.http` (the record carries the declared access and
|
package/dist/ctx/create-ctx.js
CHANGED
|
@@ -11,6 +11,7 @@ import { canUseSlot, orgUiTopic, PLATFORM_UI_TOPIC, PluginUiRegistration, } from
|
|
|
11
11
|
import { createBus } from "./bus.js";
|
|
12
12
|
import { createKv } from "./kv.js";
|
|
13
13
|
import { createLock } from "./lock.js";
|
|
14
|
+
import { createExtensionNet } from "./net.js";
|
|
14
15
|
import { createQueue } from "./queue.js";
|
|
15
16
|
import { createSecrets } from "./secrets.js";
|
|
16
17
|
/**
|
|
@@ -180,7 +181,8 @@ export class LiveConfig {
|
|
|
180
181
|
* registered routes, provided extension points and a close function.
|
|
181
182
|
* `deploymentConfig` may be a {@link LiveConfig} (shared by the instance, replaceable in place);
|
|
182
183
|
* otherwise a fixed value is wrapped.
|
|
183
|
-
* - Granted automatically: `kv`, `lock`, `bus`, `queue`, `log`, `db`, `config`, `provide
|
|
184
|
+
* - Granted automatically: `kv`, `lock`, `bus`, `queue`, `log`, `db`, `config`, `provide`, `net`
|
|
185
|
+
* (through `deps.net`, see `ctx/net.ts`);
|
|
184
186
|
* - `secrets` only with `permissions.secrets`, `storage` only with `permissions.storage`, `models`
|
|
185
187
|
* only with `permissions.models` (and only its `embedding` purposes, through `deps.models`); `http.route`
|
|
186
188
|
* only the method + path declared in `permissions.http` (the record carries the declared access and
|
|
@@ -399,6 +401,15 @@ export function createExtensionContext(deps, manifest, deploymentConfig, extensi
|
|
|
399
401
|
},
|
|
400
402
|
},
|
|
401
403
|
extensionPoints,
|
|
404
|
+
// the kernel's guarded client for person-supplied URLs, no permission needed; without the
|
|
405
|
+
// services (a ctx built alone in a test) it refuses rather than reaching the network unguarded
|
|
406
|
+
net: deps.net
|
|
407
|
+
? createExtensionNet({ ...deps.net, log: deps.log, plugin: name, signal: lifecycle.signal })
|
|
408
|
+
: {
|
|
409
|
+
async fetch() {
|
|
410
|
+
throw new Error(`plugin ${name}: ctx.net is not available`);
|
|
411
|
+
},
|
|
412
|
+
},
|
|
402
413
|
bus: {
|
|
403
414
|
publish: bus.publish,
|
|
404
415
|
async subscribe(topic, handler) {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ExtensionNet, type Logger } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import type { Agent } from "undici";
|
|
3
|
+
import type { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
4
|
+
import { type LookupFn } from "../net/public-address.js";
|
|
5
|
+
import type { OrgNetworkAllowances } from "../orgs/network-allowances.service.js";
|
|
6
|
+
/** Tests only: `safeFetch`'s DNS and dispatcher seams for `ctx.net`. */
|
|
7
|
+
export type ExtensionNetSeams = {
|
|
8
|
+
lookup?: LookupFn;
|
|
9
|
+
dispatcherFor?: (ips: string[]) => Agent;
|
|
10
|
+
proxyDispatcherFor?: (proxyUrl: string) => Agent;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Optional provider (a test seam, `KernelAppOptions.overrides`; the kernel never provides it):
|
|
14
|
+
* `ctx.net`'s DNS and dispatcher seams for every extension the host loads, so a kernel test can
|
|
15
|
+
* reach a fake server through a hostname that resolves to a private address.
|
|
16
|
+
*/
|
|
17
|
+
export declare const EXTENSION_NET_SEAMS: unique symbol;
|
|
18
|
+
/** The kernel services `ctx.net` reads per call (built once by the extension host). */
|
|
19
|
+
export type ExtensionNetServices = {
|
|
20
|
+
config: Pick<KernelConfigService, "get">;
|
|
21
|
+
allowances: Pick<OrgNetworkAllowances, "policyFor">;
|
|
22
|
+
/** Tests only: `safeFetch`'s DNS and dispatcher seams. */
|
|
23
|
+
seams?: ExtensionNetSeams;
|
|
24
|
+
};
|
|
25
|
+
/** What a refused private address tells the reader of an org-bound request. */
|
|
26
|
+
export declare const ORG_PRIVATE_HINT = "ask a super admin to allow this internal endpoint for the organization";
|
|
27
|
+
/** What a refused private address tells the reader of a request made outside an organization. */
|
|
28
|
+
export declare const NO_ORG_PRIVATE_HINT = "a request made outside an organization reaches public addresses only";
|
|
29
|
+
/**
|
|
30
|
+
* `ctx.net` (plugin safe fetch spec): the kernel's guarded client (`safeFetch`) for URLs a person
|
|
31
|
+
* supplied. Per call:
|
|
32
|
+
* - the policy is built fresh: `net.allowInsecureLoopback` (tests), the org's allowances read from
|
|
33
|
+
* PG when `opts.orgId` is given (no cache: a removal applies to the next request on every
|
|
34
|
+
* replica; another org's allowances never apply), public addresses only without an org, and the
|
|
35
|
+
* deployment's egress proxy (`net.httpsProxy` / `net.noProxy`: a proxied https request is
|
|
36
|
+
* resolved by the proxy, which then owns SSRF protection; IP-literal targets are still checked);
|
|
37
|
+
* - loopback, link-local and cloud metadata addresses are refused whatever the allowances
|
|
38
|
+
* (loopback allowed only under `net.allowInsecureLoopback`);
|
|
39
|
+
* - redirects are never followed: `redirect: "manual"` returns the 3xx response, otherwise a 3xx
|
|
40
|
+
* rejects with `net.redirect`;
|
|
41
|
+
* - no body size cap (bodies stream); `init.signal` is combined with `ctx.signal`;
|
|
42
|
+
* - a refusal rejects with the SDK's `NetDeniedError` and is logged at `warn` with the plugin, org,
|
|
43
|
+
* host and code (never the URL's path, query or headers).
|
|
44
|
+
*/
|
|
45
|
+
export declare function createExtensionNet(deps: ExtensionNetServices & {
|
|
46
|
+
log: Pick<Logger, "warn">;
|
|
47
|
+
plugin: string;
|
|
48
|
+
/** `ctx.signal`: aborts every request of the instance. */
|
|
49
|
+
signal: AbortSignal;
|
|
50
|
+
}): ExtensionNet;
|
package/dist/ctx/net.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { NetDeniedError as SdkNetDeniedError, } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import { NetDeniedError } from "../net/public-address.js";
|
|
3
|
+
import { safeFetch } from "../net/safe-fetch.js";
|
|
4
|
+
/**
|
|
5
|
+
* Optional provider (a test seam, `KernelAppOptions.overrides`; the kernel never provides it):
|
|
6
|
+
* `ctx.net`'s DNS and dispatcher seams for every extension the host loads, so a kernel test can
|
|
7
|
+
* reach a fake server through a hostname that resolves to a private address.
|
|
8
|
+
*/
|
|
9
|
+
export const EXTENSION_NET_SEAMS = Symbol("EXTENSION_NET_SEAMS");
|
|
10
|
+
/** What a refused private address tells the reader of an org-bound request. */
|
|
11
|
+
export const ORG_PRIVATE_HINT = "ask a super admin to allow this internal endpoint for the organization";
|
|
12
|
+
/** What a refused private address tells the reader of a request made outside an organization. */
|
|
13
|
+
export const NO_ORG_PRIVATE_HINT = "a request made outside an organization reaches public addresses only";
|
|
14
|
+
/**
|
|
15
|
+
* `ctx.net` (plugin safe fetch spec): the kernel's guarded client (`safeFetch`) for URLs a person
|
|
16
|
+
* supplied. Per call:
|
|
17
|
+
* - the policy is built fresh: `net.allowInsecureLoopback` (tests), the org's allowances read from
|
|
18
|
+
* PG when `opts.orgId` is given (no cache: a removal applies to the next request on every
|
|
19
|
+
* replica; another org's allowances never apply), public addresses only without an org, and the
|
|
20
|
+
* deployment's egress proxy (`net.httpsProxy` / `net.noProxy`: a proxied https request is
|
|
21
|
+
* resolved by the proxy, which then owns SSRF protection; IP-literal targets are still checked);
|
|
22
|
+
* - loopback, link-local and cloud metadata addresses are refused whatever the allowances
|
|
23
|
+
* (loopback allowed only under `net.allowInsecureLoopback`);
|
|
24
|
+
* - redirects are never followed: `redirect: "manual"` returns the 3xx response, otherwise a 3xx
|
|
25
|
+
* rejects with `net.redirect`;
|
|
26
|
+
* - no body size cap (bodies stream); `init.signal` is combined with `ctx.signal`;
|
|
27
|
+
* - a refusal rejects with the SDK's `NetDeniedError` and is logged at `warn` with the plugin, org,
|
|
28
|
+
* host and code (never the URL's path, query or headers).
|
|
29
|
+
*/
|
|
30
|
+
export function createExtensionNet(deps) {
|
|
31
|
+
return {
|
|
32
|
+
async fetch(url, init, opts) {
|
|
33
|
+
const orgId = opts?.orgId;
|
|
34
|
+
const net = deps.config.get().net;
|
|
35
|
+
const exemptions = orgId
|
|
36
|
+
? await deps.allowances.policyFor(orgId)
|
|
37
|
+
: { allowPrivateHosts: [], trustedOrigins: [] };
|
|
38
|
+
const policy = {
|
|
39
|
+
allowInsecureLoopback: net.allowInsecureLoopback,
|
|
40
|
+
allowPrivateHosts: exemptions.allowPrivateHosts,
|
|
41
|
+
trustedOrigins: exemptions.trustedOrigins,
|
|
42
|
+
...(net.httpsProxy !== undefined && {
|
|
43
|
+
proxy: { url: net.httpsProxy, noProxy: net.noProxy },
|
|
44
|
+
}),
|
|
45
|
+
extension: { privateHint: orgId ? ORG_PRIVATE_HINT : NO_ORG_PRIVATE_HINT },
|
|
46
|
+
};
|
|
47
|
+
const signal = init?.signal ? AbortSignal.any([deps.signal, init.signal]) : deps.signal;
|
|
48
|
+
try {
|
|
49
|
+
return await safeFetch(url, { ...init, signal }, policy, {
|
|
50
|
+
redirects: init?.redirect === "manual" ? "return" : "refuse",
|
|
51
|
+
...deps.seams,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
if (!(e instanceof NetDeniedError))
|
|
56
|
+
throw e;
|
|
57
|
+
deps.log.warn("ctx.net.fetch refused a request", {
|
|
58
|
+
plugin: deps.plugin,
|
|
59
|
+
orgId: orgId ?? null,
|
|
60
|
+
host: e.host,
|
|
61
|
+
code: e.code,
|
|
62
|
+
});
|
|
63
|
+
throw new SdkNetDeniedError(e.code, e.host, e.message, e.status);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -156,6 +156,15 @@ export interface OrgToolSwitchesTable {
|
|
|
156
156
|
updated_by: string | null;
|
|
157
157
|
updated_at: Ts;
|
|
158
158
|
}
|
|
159
|
+
/** 0145: an internal endpoint a super admin lets the org's extension requests reach. */
|
|
160
|
+
export interface OrgNetworkAllowancesTable {
|
|
161
|
+
id: string;
|
|
162
|
+
org_id: string;
|
|
163
|
+
/** A hostname, `*.domain`, IP, CIDR or origin `http(s)://host[:port]`, normalized. */
|
|
164
|
+
entry: string;
|
|
165
|
+
created_by: string | null;
|
|
166
|
+
created_at: Ts;
|
|
167
|
+
}
|
|
159
168
|
export interface AuditEventsTable {
|
|
160
169
|
id: Generated<string>;
|
|
161
170
|
at: Ts;
|
|
@@ -1316,6 +1325,7 @@ export interface KernelDatabase {
|
|
|
1316
1325
|
extension_org_configs: ExtensionOrgConfigsTable;
|
|
1317
1326
|
extension_org_overrides: ExtensionOrgOverridesTable;
|
|
1318
1327
|
org_tool_switches: OrgToolSwitchesTable;
|
|
1328
|
+
org_network_allowances: OrgNetworkAllowancesTable;
|
|
1319
1329
|
audit_events: AuditEventsTable;
|
|
1320
1330
|
secrets: SecretsTable;
|
|
1321
1331
|
agents: AgentsTable;
|
|
@@ -15,7 +15,7 @@ import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
|
15
15
|
import { audit } from "../identity/audit.js";
|
|
16
16
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
17
17
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
18
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
18
|
+
import { assertNotSharedAdmission, TransactionHost } from "../infra/database/transaction-host.js";
|
|
19
19
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
20
20
|
import { LockService } from "../infra/lock/lock.service.js";
|
|
21
21
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
@@ -896,6 +896,7 @@ let DevicesService = class DevicesService {
|
|
|
896
896
|
* member (any more) → `org.not_found`, as the org guard answers.
|
|
897
897
|
*/
|
|
898
898
|
async lockMember(orgId, accountId, mode = "update") {
|
|
899
|
+
assertNotSharedAdmission("locking a membership");
|
|
899
900
|
const org = await this.db
|
|
900
901
|
.selectFrom("orgs")
|
|
901
902
|
.select("id")
|