Skip to content

Commit ee4f190

Browse files
authored
fix(webapp): require private auth to initialize the session out stream (#67)
1 parent 5a5833e commit ee4f190

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Require secret-key authentication to initialize the session out (agent→client) stream, matching the append route.

apps/webapp/app/routes/realtime.v1.sessions.$session.$io.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ const { action } = createActionApiRoute(
3434
},
3535
},
3636
async ({ params, authentication }) => {
37+
// `.out` is the agent→client channel. Only PRIVATE (secret key) auth —
38+
// i.e. the agent run itself — may initialize it. Session-scoped JWTs carry
39+
// `write:sessions:<key>` for `.in`; without this gate they could obtain
40+
// credentials to forge assistant chunks on their own session's `.out`.
41+
if (params.io === "out" && authentication.type !== "PRIVATE") {
42+
return new Response("Initializing the out channel requires secret key authentication", {
43+
status: 403,
44+
});
45+
}
46+
3747
// Row-optional addressing. The agent calls PUT initialize as part
3848
// of `session.out.writer()`, by which time it has already created
3949
// the row at bind, so a missing row here is an unusual case

0 commit comments

Comments
 (0)