Skip to content

fix: prevent mass assignment of userId in updateTask#1374

Open
vipul674 wants to merge 1 commit into
aryandas2911:mainfrom
vipul674:fix/1373-mass-assignment-vulnerability
Open

fix: prevent mass assignment of userId in updateTask#1374
vipul674 wants to merge 1 commit into
aryandas2911:mainfrom
vipul674:fix/1373-mass-assignment-vulnerability

Conversation

@vipul674
Copy link
Copy Markdown

@vipul674 vipul674 commented May 31, 2026

Description

Fixes a mass assignment vulnerability in backend/controllers/taskController.js where raw req.body was passed directly into MongoDB's $set operator, allowing an authenticated user to overwrite protected fields like userId and reassign tasks to other users.

The fix destructures userId and _id out of req.body before passing the remaining safe fields to the update operation.

Difficulty & Label Request

  • Assessed difficulty: level:beginner
  • Maintainer: please apply the level:beginner label if this assessment is appropriate, so this contribution is scored correctly under GSSoC 2026 guidelines.
  • Maintainer: please also apply the gssoc:approved label after review so this PR earns its base GSSoC points.
  • Maintainer: please also apply the quality:clean or quality:exceptional label after review. Thank you!

Type

  • Bug fix

Testing & Verification

  • Code logic verified — userId and _id are stripped from update payload
  • Legitimate update fields (title, description, status, tags, priority, dueDate) still pass through
  • Existing title length validation still works on safe updates

GSSoC 2026 Compliance & Transparency

@vipul674
Copy link
Copy Markdown
Author

vipul674 commented Jun 2, 2026

@aryandas2911 Please review and let me know for any changes.

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.

fix: mass assignment vulnerability in updateTask allows userId overwrite

1 participant