Skip to content

Fix/clientid follows livestore best practices#481

Merged
rgbkrk merged 2 commits intomainfrom
fix/clientid-follows-livestore-best-practices
Sep 3, 2025
Merged

Fix/clientid follows livestore best practices#481
rgbkrk merged 2 commits intomainfrom
fix/clientid-follows-livestore-best-practices

Conversation

@rgbkrk
Copy link
Member

@rgbkrk rgbkrk commented Sep 3, 2025

Anode side of nteract/desktop#209

- Update sync payload schema to include optional userId
- Generate unique clientId per device instance using userId-{uuid} pattern
- Add backward compatibility for existing clients without userId
- Update validation logic to check userId instead of clientId for user attribution
- Follow same pattern as runt runtime agent (PR #209)

Fixes the incorrect practice of setting clientId = userId, which violates
LiveStore's design where clientId should identify device/app instances.
The backend already validates the JWT and knows the user identity from validatedUser.id.
Trusting client-provided userId was a security vulnerability where malicious clients
could potentially impersonate other users by passing different userId values.

Now the backend only uses the JWT-validated user identity, which is secure.
@rgbkrk rgbkrk merged commit d94e090 into main Sep 3, 2025
2 checks passed
@rgbkrk rgbkrk deleted the fix/clientid-follows-livestore-best-practices branch September 3, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant