openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Security: Client-side JWT decode without verification in socketService.ts

Open Liohtml opened this issue 6 months ago • 0 comments

Summary

app/src/services/socketService.ts — getSocketUserId() decodes the JWT payload with a raw atob() call and no signature verification. The decoded userId is used to scope Redux socket state (setStatusForUser, setSocketIdForUser, resetForUser).

Impact

Low — If the token in memory is tampered (e.g., via IPC compromise), the locally decoded userId could scope state to the wrong user, causing data leakage across user sessions.

Suggested Fix

Source the user ID from the already-authenticated CoreStateProvider snapshot (snapshot.auth.userId) instead of decoding the JWT client-side.

Liohtml avatar May 16 '26 14:05 Liohtml