Skip to content

Commit eebbb23

Browse files
committed
fix: clear bootstrap token after first IPC read to prevent stale token reuse
The backendBootstrapToken has remainingUses: 1 on the server side, so it is deleted after the first successful consume. Clear the module-level variable after the first IPC read so subsequent calls do not return a stale, already-consumed token that would silently fail to authenticate.
1 parent 4caff6f commit eebbb23

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/desktop/src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,10 +1239,14 @@ function registerIpcHandlers(): void {
12391239

12401240
ipcMain.removeAllListeners(GET_LOCAL_ENVIRONMENT_BOOTSTRAP_CHANNEL);
12411241
ipcMain.on(GET_LOCAL_ENVIRONMENT_BOOTSTRAP_CHANNEL, (event) => {
1242+
const token = backendBootstrapToken || undefined;
1243+
if (token) {
1244+
backendBootstrapToken = "";
1245+
}
12421246
event.returnValue = {
12431247
label: "Local environment",
12441248
wsUrl: backendWsUrl || null,
1245-
bootstrapToken: backendBootstrapToken || undefined,
1249+
bootstrapToken: token,
12461250
} as const;
12471251
});
12481252

0 commit comments

Comments
 (0)