Skip to content

Fix/back#1355

Open
HarshaNaidu11 wants to merge 9 commits into
aryandas2911:mainfrom
HarshaNaidu11:fix/back
Open

Fix/back#1355
HarshaNaidu11 wants to merge 9 commits into
aryandas2911:mainfrom
HarshaNaidu11:fix/back

Conversation

@HarshaNaidu11
Copy link
Copy Markdown
Contributor

📌 Description

The creation route validator (taskValidationRules) is missing body checks for priority and status, meaning invalid formats bypass express-validator and are only caught late by Mongoose schemas.

🔗 Related Issue

Closes #1065

🛠 Changes Made

-Modified taskRoutes.js to append validation rules for priority and status under taskValidationRules:
Ensures that priority is sanitised via trim(), and only permits "Low", "Medium", or "High".
Ensures that status is sanitised via trim(), and only permits "Due" or "Completed".

  • These invalid inputs will now be caught immediately by express-validator and return a clean HTTP 400 Bad Request instead of triggering a database/Mongoose validation exception (HTTP 500 Server Error).

@HarshaNaidu11
Copy link
Copy Markdown
Contributor Author

@aryandas2911 review this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug : [Backend Validation] Missing Request Body Validation for Priority and Status

2 participants