Conversation
The client TokenStore read a plain, JavaScript-readable workos-access-token cookie and adopted its value as the session bearer access token, with no binding to the authenticated session. No server component in this SDK (or in @workos/authkit-session) ever writes this cookie, so it was a dead input channel: an attacker able to write a cookie on the app's registrable domain could plant their own valid token and cause the victim's client-side API calls to authenticate as the attacker. A Path mismatch in the consume-and-delete logic also let a Path=/ plant persist across page loads. Remove the cookie read/consume/delete paths entirely. Tokens are now sourced only from the session-bound server RPCs, which are the only legitimate source. Add a regression test asserting a planted cookie is ignored.
Original prompt from Linear User
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Recovered this branch onto current main. The original cookie-channel removal remains unchanged. Verification: 251 tests passed, including coverage. Lint, typecheck, formatting, library build, example build, and client-bundle leak check passed. A fresh independent code review found no blocker. Not merged or released. |
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
Summary
The client
TokenStore(src/client/tokenStore.ts) read a JavaScript-readableworkos-access-tokencookie and adopted it as the session bearer token. This change removes that client-readable cookie channel and sources the token from the server-side session.Please review before merging.