Skip to content

Bug: GET /tasks and GET /messages require no authentication, exposing all project data publicly #158

@anshul23102

Description

@anshul23102

Description

Both GET /api/tasks and GET /api/messages are registered without any authentication middleware in backend/routes/tasks.routes.js and backend/routes/chat.routes.js respectively. Any unauthenticated HTTP client can retrieve the full task list and full chat history of the workspace.

// tasks.routes.js
router.get("/", getTasks);          // no authenticateUser

// chat.routes.js
router.get("/", getMessages);       // no authenticateUser

Both controllers fetch all records from Supabase with no user or project scope filter, so the entire dataset is exposed.

Steps to Reproduce

  1. Start the FlowForge backend server.
  2. Send GET /api/tasks with no Authorization header.
  3. Observe that all task records are returned (id, title, description, status, position).
  4. Send GET /api/messages with no Authorization header.
  5. Observe that all chat messages are returned (text, username, image, audio, created_at).

Expected Behavior

Both endpoints should require a valid user session before returning any data. The pattern used for the mutation endpoints (router.post("/", authenticateUser, createTask)) should be applied to the GET endpoints too:

router.get("/", authenticateUser, getTasks);
router.get("/", authenticateUser, getMessages);

Actual Behavior

All tasks and all chat messages are publicly readable without authentication.

Root Cause

In both route files, the GET handler is registered without the authenticateUser middleware that protects every other verb. This is likely an omission when the middleware was first added.

A secondary issue exists in the same files: POST / is registered twice - once with authenticateUser and once with only validateMessage / validateTask. Express uses the first matching registration, making the second one silently dead code. This should be collapsed into a single registration that applies both middleware in order:

router.post("/", authenticateUser, validateMessage, sendMessage);

Environment

  • Backend: Node.js / Express
  • Files: backend/routes/tasks.routes.js, backend/routes/chat.routes.js

Additional Context

Expected NSOC points: level3 (security vulnerability exposing all workspace data publicly)

Suggested labels: bug, NSoC'26, level3

Checklist:

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions