@vellumai/assistant 0.11.9-dev.202609081317.37fcc19 → 0.11.9-dev.202609081418.cdf02f9
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/package.json
CHANGED
|
@@ -73,8 +73,7 @@ describe("route policy coverage", () => {
|
|
|
73
73
|
// returned allowed). Migration preserves behavior. Triage these
|
|
74
74
|
// and assign real policies in a follow-up PR:
|
|
75
75
|
// - PATCH/DELETE documents/:id/comments/:commentId
|
|
76
|
-
// - integrations/a2a/
|
|
77
|
-
// - integrations/vercel/config
|
|
76
|
+
// - integrations/a2a/invite/accept
|
|
78
77
|
const INTENTIONALLY_UNPROTECTED = new Set([
|
|
79
78
|
// A — design-intentional
|
|
80
79
|
"health",
|
|
@@ -91,9 +90,7 @@ describe("route policy coverage", () => {
|
|
|
91
90
|
"playground/seeded-conversations/:id",
|
|
92
91
|
// C — pre-existing latent unprotected (follow-up audit owed)
|
|
93
92
|
"documents/:id/comments/:commentId",
|
|
94
|
-
"integrations/a2a/config",
|
|
95
93
|
"integrations/a2a/invite/accept",
|
|
96
|
-
"integrations/vercel/config",
|
|
97
94
|
]);
|
|
98
95
|
|
|
99
96
|
const unprotectedFound: string[] = [];
|
|
@@ -297,4 +297,69 @@ describe("ROUTES policy declarations", () => {
|
|
|
297
297
|
expect(r.policy === null || typeof r.policy === "object").toBe(true);
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
|
+
|
|
301
|
+
test.each([
|
|
302
|
+
["integrations_vercel_config_get", "settings.read"],
|
|
303
|
+
["integrations_vercel_config_post", "settings.write"],
|
|
304
|
+
["integrations_vercel_config_delete", "settings.write"],
|
|
305
|
+
["integrations_a2a_config_get", "settings.read"],
|
|
306
|
+
["integrations_a2a_config_post", "settings.write"],
|
|
307
|
+
["integrations_a2a_config_delete", "settings.write"],
|
|
308
|
+
] as const)(
|
|
309
|
+
"%s requires %s and actor principals",
|
|
310
|
+
async (operationId, scope) => {
|
|
311
|
+
const { ROUTES } = await import("../../routes/index.js");
|
|
312
|
+
const route = ROUTES.find((r) => r.operationId === operationId);
|
|
313
|
+
expect(route).toBeDefined();
|
|
314
|
+
expect(route!.policy).not.toBeNull();
|
|
315
|
+
expect(route!.policy!.requiredScopes).toEqual([scope]);
|
|
316
|
+
expect(route!.policy!.allowedPrincipalTypes).toEqual([
|
|
317
|
+
"actor",
|
|
318
|
+
"svc_gateway",
|
|
319
|
+
"svc_daemon",
|
|
320
|
+
"local",
|
|
321
|
+
]);
|
|
322
|
+
},
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
test("vercel config GET denies a chat-only actor and POST denies without settings.write", async () => {
|
|
326
|
+
const { ROUTES } = await import("../../routes/index.js");
|
|
327
|
+
const getRoute = ROUTES.find(
|
|
328
|
+
(r) => r.operationId === "integrations_vercel_config_get",
|
|
329
|
+
);
|
|
330
|
+
const postRoute = ROUTES.find(
|
|
331
|
+
(r) => r.operationId === "integrations_vercel_config_post",
|
|
332
|
+
);
|
|
333
|
+
expect(getRoute?.policy).not.toBeNull();
|
|
334
|
+
expect(postRoute?.policy).not.toBeNull();
|
|
335
|
+
|
|
336
|
+
authDisabled = false;
|
|
337
|
+
const chatOnly = buildTestContext({
|
|
338
|
+
principalType: "actor",
|
|
339
|
+
scopes: ["chat.read", "chat.write"],
|
|
340
|
+
});
|
|
341
|
+
const getDenied = enforcePolicy(
|
|
342
|
+
getRoute!.endpoint,
|
|
343
|
+
getRoute!.policy!,
|
|
344
|
+
chatOnly,
|
|
345
|
+
);
|
|
346
|
+
expect(getDenied).not.toBeNull();
|
|
347
|
+
expect(getDenied!.status).toBe(403);
|
|
348
|
+
|
|
349
|
+
const postDenied = enforcePolicy(
|
|
350
|
+
postRoute!.endpoint,
|
|
351
|
+
postRoute!.policy!,
|
|
352
|
+
chatOnly,
|
|
353
|
+
);
|
|
354
|
+
expect(postDenied).not.toBeNull();
|
|
355
|
+
expect(postDenied!.status).toBe(403);
|
|
356
|
+
|
|
357
|
+
const settingsActor = buildTestContext({
|
|
358
|
+
principalType: "actor",
|
|
359
|
+
scopes: ["settings.write"],
|
|
360
|
+
});
|
|
361
|
+
expect(
|
|
362
|
+
enforcePolicy(postRoute!.endpoint, postRoute!.policy!, settingsActor),
|
|
363
|
+
).toBeNull();
|
|
364
|
+
});
|
|
300
365
|
});
|
|
@@ -230,7 +230,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
230
230
|
operationId: "integrations_a2a_config_get",
|
|
231
231
|
endpoint: "integrations/a2a/config",
|
|
232
232
|
method: "GET",
|
|
233
|
-
policy:
|
|
233
|
+
policy: {
|
|
234
|
+
requiredScopes: ["settings.read"],
|
|
235
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
236
|
+
},
|
|
234
237
|
summary: "Get A2A config",
|
|
235
238
|
description: "Check current A2A channel configuration status.",
|
|
236
239
|
tags: ["integrations"],
|
|
@@ -241,7 +244,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
241
244
|
operationId: "integrations_a2a_config_post",
|
|
242
245
|
endpoint: "integrations/a2a/config",
|
|
243
246
|
method: "POST",
|
|
244
|
-
policy:
|
|
247
|
+
policy: {
|
|
248
|
+
requiredScopes: ["settings.write"],
|
|
249
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
250
|
+
},
|
|
245
251
|
summary: "Enable A2A channel",
|
|
246
252
|
description: "Enable the A2A channel for inter-assistant communication.",
|
|
247
253
|
tags: ["integrations"],
|
|
@@ -252,7 +258,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
252
258
|
operationId: "integrations_a2a_config_delete",
|
|
253
259
|
endpoint: "integrations/a2a/config",
|
|
254
260
|
method: "DELETE",
|
|
255
|
-
policy:
|
|
261
|
+
policy: {
|
|
262
|
+
requiredScopes: ["settings.write"],
|
|
263
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
264
|
+
},
|
|
256
265
|
summary: "Disable A2A channel",
|
|
257
266
|
description: "Disable the A2A channel.",
|
|
258
267
|
tags: ["integrations"],
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getVercelConfig,
|
|
17
17
|
setVercelConfig,
|
|
18
18
|
} from "../../../daemon/handlers/config-vercel.js";
|
|
19
|
+
import { ACTOR_PRINCIPALS } from "../../auth/route-policy.js";
|
|
19
20
|
import { BadRequestError } from "../errors.js";
|
|
20
21
|
import type { RouteDefinition, RouteHandlerArgs } from "../types.js";
|
|
21
22
|
|
|
@@ -70,7 +71,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
70
71
|
operationId: "integrations_vercel_config_get",
|
|
71
72
|
endpoint: "integrations/vercel/config",
|
|
72
73
|
method: "GET",
|
|
73
|
-
policy:
|
|
74
|
+
policy: {
|
|
75
|
+
requiredScopes: ["settings.read"],
|
|
76
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
77
|
+
},
|
|
74
78
|
summary: "Get Vercel config",
|
|
75
79
|
description: "Check if a Vercel API token is stored.",
|
|
76
80
|
tags: ["integrations"],
|
|
@@ -81,7 +85,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
81
85
|
operationId: "integrations_vercel_config_post",
|
|
82
86
|
endpoint: "integrations/vercel/config",
|
|
83
87
|
method: "POST",
|
|
84
|
-
policy:
|
|
88
|
+
policy: {
|
|
89
|
+
requiredScopes: ["settings.write"],
|
|
90
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
91
|
+
},
|
|
85
92
|
summary: "Set or delete Vercel config",
|
|
86
93
|
description:
|
|
87
94
|
"Set or delete the Vercel API token. Action is determined by the body action field.",
|
|
@@ -97,7 +104,10 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
97
104
|
operationId: "integrations_vercel_config_delete",
|
|
98
105
|
endpoint: "integrations/vercel/config",
|
|
99
106
|
method: "DELETE",
|
|
100
|
-
policy:
|
|
107
|
+
policy: {
|
|
108
|
+
requiredScopes: ["settings.write"],
|
|
109
|
+
allowedPrincipalTypes: ACTOR_PRINCIPALS,
|
|
110
|
+
},
|
|
101
111
|
summary: "Delete Vercel config",
|
|
102
112
|
description: "Delete the stored Vercel API token.",
|
|
103
113
|
tags: ["integrations"],
|