-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: add client-side user ID validation for task data isolation (partial fix for #7932) #7933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add userId to TaskChannel for ownership validation - Include userId in task JOIN requests for server-side validation - Pass userId from BridgeOrchestrator to TaskChannel - Add comment about server-side validation in CloudAPI - Add comprehensive tests for user isolation This fix ensures that users can only access their own tasks, preventing the security issue where one user could see another user's task data. Fixes #7932
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote this code 10 minutes ago and I'm already confused by my own logic.
While this PR adds important client-side validation for user ID isolation, there are several critical issues that need to be addressed:
Critical Issues:
- Security limitation: The client-side validation can be bypassed by malicious clients. Server-side validation is essential for actual security.
- Missing userId in reconnection logic: Lines 125 and 139 in TaskChannel.ts don't include userId when rejoining tasks after reconnection.
Suggestions:
- Input validation: Consider validating that userId is a non-empty string when provided.
- Test coverage: Add tests for edge cases like empty userId, reconnection scenarios, and concurrent access attempts.
The PR correctly documents that server-side validation is still required, but these client-side improvements would make the implementation more robust.
|
|
||
| await this.publish(TaskSocketEvents.JOIN, { taskId }, (response: JoinResponse) => { | ||
| // Include userId in the join request for server-side validation | ||
| const joinPayload = this.userId ? { taskId, userId: this.userId } : { taskId } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: This client-side validation is like putting a 'Please Don't Enter' sign on an unlocked door. Without server-side validation, this provides only a false sense of security. The PR description correctly notes this limitation.
|
|
||
| constructor(options: TaskChannelOptions) { | ||
| super(options) | ||
| this.userId = options.userId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we validate that userId is a non-empty string when provided? An empty string could cause issues downstream.
| async shareTask(taskId: string, visibility: ShareVisibility = "organization"): Promise<ShareResponse> { | ||
| this.log(`[CloudAPI] Sharing task ${taskId} with visibility: ${visibility}`) | ||
|
|
||
| // The server should validate that the authenticated user owns this task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this comment be more specific? For example: 'The server MUST validate that the authenticated user (from session token) matches the task's owner_id field'
|
Issue closed |
Description
This PR implements client-side validation to help address Issue #7932 where users could see other users' task data in Roo Code Cloud. This is a critical data privacy issue that requires both client and server-side fixes.
What's Been Done ✅
Client-Side Changes:
Code Changes:
packages/cloud/src/bridge/TaskChannel.ts: Added userId parameter and validation logicpackages/cloud/src/bridge/BridgeOrchestrator.ts: Pass userId to TaskChannelpackages/cloud/src/CloudAPI.ts: Added comment about server-side validation requirementspackages/cloud/src/bridge/__tests__/TaskChannel.test.ts: Added 4 new test cases for user isolationWhat Still Needs to Be Done⚠️
IMPORTANT: Server-side validation is still required for complete security.
The server must:
Security Considerations
While this PR adds an important layer of defense, it does not fully resolve the security issue. A malicious client could still bypass these checks by modifying the userId parameter. Server-side validation is essential for proper security.
Testing
Related Issue
Partially addresses #7932
Next Steps
Note to reviewers: This is a partial fix that improves the situation but does not completely resolve the security issue. Server-side changes are critical for full resolution.
Important
Adds client-side user ID validation in
TaskChannelfor task data isolation, updatingBridgeOrchestratorand adding tests inTaskChannel.test.ts.TaskChannelfor task data isolation.userIdfor server-side validation.BridgeOrchestratorto passuserIdtoTaskChannel.TaskChannel.test.ts.TaskChannel.ts: AddsuserIdparameter and validation logic.BridgeOrchestrator.ts: PassesuserIdtoTaskChannel.CloudAPI.ts: Adds comment about server-side validation requirements.TaskChannel.test.ts.This description was created by
for d6426a6. You can customize this summary. It will automatically update as commits are pushed.