Skip to content

[ADVANCED] Add Backend Input Sanitization & Validation for User Data #122

@ash1shkumar

Description

@ash1shkumar

🚀 Description

User-provided input is directly inserted into the database without proper backend validation or sanitization.

This can lead to stored XSS vulnerabilities, malformed data, and database pollution.


📍Affected Files

  • backend/controllers/chat.controller.js
  • backend/controllers/tasks.controller.js

❌ Current Problem

Data is directly inserted like:

.insert([{ text, username, image, audio }])

and:

.insert([{ title, description, status, position }])

without proper sanitization or validation.


✅ Expected Solution

Implement backend-side validation and sanitization using:

  • Joi/Zod validation
  • sanitize-html
  • input length checks
  • required field validation

🎯 Expected Outcome

  • Cleaner database entries
  • Prevention of malicious payloads
  • Better API reliability

🏷️ Expected Labels

level3 NSoC'26

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions