Performance: Common Node.js security vulnerabilities
HIGH IMPACT
This affects server response time and overall application reliability by preventing security breaches that can cause downtime or slow responses.
const userInput = req.query.name;
const query = 'SELECT * FROM users WHERE name = ?';
db.query(query, [userInput]);const userInput = req.query.name;
const query = `SELECT * FROM users WHERE name = '${userInput}'`;
db.query(query);| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Unsafe user input handling | N/A (server-side) | N/A | N/A | [X] Bad |
| Using outdated vulnerable packages | N/A | N/A | N/A | [X] Bad |
| Exposing detailed error messages | N/A | N/A | N/A | [X] Bad |
| Parameterized queries and input validation | N/A | N/A | N/A | [OK] Good |
| Regular dependency audits and updates | N/A | N/A | N/A | [OK] Good |
| Generic error messages to clients | N/A | N/A | N/A | [OK] Good |