Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): revoking a session closes its live connection #13844

ClosedBearHuddleston(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/13844/headopened View on GitHub

Showing 2 changed files with 77 additions and 2 deletions.

x
0 of 2 viewed, 2 left
60 additions and 0 deletionsapps/server/src/server.test.tsModified
View file
@@ -5286,6 +5286,66 @@
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
+ it.effect("closes a paired client's live websocket when its session is revoked", () =>
+ Effect.gen(function* () {
+ yield* buildAppUnderTest({
+ config: {
+ host: "0.0.0.0",
+ },
+ });
+​
+ const ownerCookie = yield* getAuthenticatedSessionCookieHeader();
+ const pairingResponse = yield* HttpClient.post("/api/auth/pairing-token", {
+ headers: {
+ cookie: ownerCookie,
+ },
+ body: yield* HttpBody.json({}),
+ });
+ const pairingBody = (yield* pairingResponse.json) as {
+ readonly credential: string;
+ };
+ const pairedSessionCookie = yield* getAuthenticatedSessionCookieHeader(
+ pairingBody.credential,
+ );
+ const clientsResponse = yield* HttpClient.get("/api/auth/clients", {
+ headers: {
+ cookie: ownerCookie,
+ },
+ });