ccsync icon indicating copy to clipboard operation
ccsync copied to clipboard

Task endpoints missing session validation - users can access any user's data

Open Hell1213 opened this issue 11 months ago • 3 comments

Describe the bug Task endpoints accept user credentials from query params without checking if the user is actually logged in. Anyone can access/modify tasks for any user if they know their email, UUID, and encryption secret.

To Reproduce Steps to reproduce the behavior:

  1. Login as any user and check network tab for task API calls
  2. Copy the email, UUID, and encryptionSecret from the request
  3. Logout or use incognito browser
  4. Make direct API call: GET /[email protected]&UUID=victim-uuid&encryptionSecret=victim-secret
  5. See that you can access the victim's tasks without being logged in

Expected behavior

  • Should check if user has valid session before allowing task operations
  • Should return 401 if not logged in
  • Should only allow users to access their own tasks

Screenshots Not applicable - this is a backend security issue

Current code issue In backend/controllers/get_tasks.go:

email := r.URL.Query().Get("email")  // No session check
UUID := r.URL.Query().Get("UUID")    // Direct parameter trust

Hell1213 avatar Dec 27 '25 19:12 Hell1213

Hey @its-me-abhishek, I found this critical security issue while working on the backend. Since I'm already familiar with the task controllers and session handling from my previous work, I'd like to tackle this one. Can you assign it to me?

Hell1213 avatar Dec 27 '25 19:12 Hell1213

@Hell1213 since we do not actually use any auth in mobile app, and since this API can be a wrapper for TW based applications, we need not have auth based check. We do have a session based check already which will expire after a while and allows us to have a multi user setup. Please migrate this Get Tasks to use Header based Parameters instead of URL based Queries, and that will fix this. I have tested the backend using that approach earlier and it works.

This can be used inside get_tasks.go

	email := r.Header.Get("X-User-Email")
	encryptionSecret := r.Header.Get("X-Encryption-Secret")
	UUID := r.Header.Get("X-User-UUID")
	origin := os.Getenv("CONTAINER_ORIGIN")

Also update the Swagger and Frontend accordingly

Will open an issue for the App once this is merged

EDIT: Added more context

its-me-abhishek avatar Dec 28 '25 07:12 its-me-abhishek

Fixed by this commit

its-me-abhishek avatar Dec 29 '25 19:12 its-me-abhishek