-
Notifications
You must be signed in to change notification settings - Fork 330
Description
Enhancement Request: Add sanitize-html
📌 Description
Currently, user inputs (bio, username, query) are stored without sanitization. This can lead to XSS attacks if malicious HTML/JS is submitted. We will use sanitize-html to clean inputs before saving to the database.
🛠 Middleware
- sanitize-html
🚀 Implementation
- Install:
npm install sanitize-html
- Apply sanitization on text fields:
import sanitizeHtml from "sanitize-html"; const cleanBio = sanitizeHtml(req.body.bio, { allowedTags: [], allowedAttributes: {} });
- Use cleaned values before saving in DB.
✅ Expected Outcome
- Prevent XSS attacks.
- Only safe and clean text stored in DB.
Avdhesh-Varshney
Metadata
Metadata
Assignees
Type
Projects
Status
done