Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/control-plane/src/router.policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ describe("route policy table", () => {
],
["GET", "/integration-settings/slack/watched-channels", [{ service: "slack-bot" }]],
["GET", "/model-preferences", [{ service: "slack-bot" }]],
["GET", "/sessions/session-1/events", [{ service: "slack-bot" }, { service: "linear-bot" }]],
["GET", "/sessions/session-1/artifacts", [{ service: "slack-bot" }, { service: "linear-bot" }]],
])("declares the exact actorless grants for %s %s", (method, path, expected) => {
const authorization = routeFor(method, path)?.authorization;
expect(["active-user", "active-global"]).toContain(authorization?.kind);
Expand All @@ -99,6 +101,8 @@ describe("route policy table", () => {
routeFor("GET", "/integration-settings/github/resolved/acme/widgets"),
routeFor("GET", "/integration-settings/slack/watched-channels"),
routeFor("GET", "/model-preferences"),
routeFor("GET", "/sessions/session-1/events"),
routeFor("GET", "/sessions/session-1/artifacts"),
routeFor("POST", "/sessions/session-1/stop"),
routeFor("GET", "/sessions/session-1/media/artifact-1"),
]);
Expand Down
8 changes: 6 additions & 2 deletions packages/control-plane/src/routes/session-runtime-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,19 @@ export const sessionRuntimeProxyRoutes: Route[] = [
method: "GET",
routePath: "/sessions/:id/events",
internalPath: SessionInternalPaths.events,
authorization: requirePermission("sessions.read"),
authorization: requirePermission("sessions.read", {
actorlessGrants: [{ service: "slack-bot" }, { service: "linear-bot" }],
}),
forwardSearch: true,
}),
simpleProxyRoute({
policy: GITHUB_USER_OR_SERVICE_ROUTE,
method: "GET",
routePath: "/sessions/:id/artifacts",
internalPath: SessionInternalPaths.artifacts,
authorization: requirePermission("sessions.read"),
authorization: requirePermission("sessions.read", {
actorlessGrants: [{ service: "slack-bot" }, { service: "linear-bot" }],
}),
}),
simpleProxyRoute({
policy: GITHUB_USER_OR_SERVICE_ROUTE,
Expand Down
13 changes: 12 additions & 1 deletion packages/control-plane/test/integration/service-auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ describe("sig1 service-credential authentication", () => {
});
});

it("allows only narrow actorless session callbacks", async () => {
it("allows only narrow actorless session callbacks and completion reads", async () => {
const created = await signedFetch({
service: "linear-bot",
method: "POST",
Expand All @@ -348,6 +348,17 @@ describe("sig1 service-credential authentication", () => {
});
expect(linearStop.status).not.toBe(403);

for (const service of ["slack-bot", "linear-bot"] as const) {
for (const path of ["events", "artifacts"] as const) {
const completionRead = await signedFetch({
service,
method: "GET",
url: `https://test.local/sessions/${sessionId}/${path}`,
});
expect(completionRead.status, `${service} GET ${path}`).not.toBe(403);
}
}

const slackMedia = await signedFetch({
service: "slack-bot",
method: "GET",
Expand Down
Loading