What is going on
User-provided content displayed in template without escaping. Attacker can inject malicious JavaScript that executes in other users' browsers. Form submissions, comments, or user profiles become attack vectors.
Template renders user input directly, trusting it's safe when it's not.
Error messages you might see
Common causes
- Raw HTML output without escaping: {{ userInput }} instead of properly escaped
- dangerouslySetInnerHTML or equivalent used without validation
- Server trust user input without sanitizing
- Missing Content Security Policy headers
- Frontend sanitization only, no backend validation
How to fix it
Escape all user input by default. Use framework features: React auto-escapes, use innerText not innerHTML. Sanitize HTML: DOMPurify library on frontend. Backend validation required too. Use Content Security Policy header to block inline scripts. Never use dangerouslySetInnerHTML unless absolutely necessary and content is verified safe.
Getting help takes about a minute
No hiring, no back and forth. A real person looks at your app.
-
1
Describe it
Tell us what you need in plain words. You don't have to be technical or have an account to start.
-
2
Free 15-minute call
A verified developer calls you. Many tasks are sorted right there, and it costs nothing.
-
3
Pay after you approve
If there is more to do, you get one fixed price up front. You pay only once you are happy.
Real people, reviewed by hand
Developers who do this every day
Every developer is approved by our team before they can take a task. Describe yours and the first one who is free picks it up.
Get helpQuestions
How to prevent XSS in React?
React auto-escapes by default. Avoid: dangerouslySetInnerHTML. For HTML content, use DOMPurify: purify.sanitize(html)
What should be escaped?
All user input, especially from forms, URLs, file uploads. Escape: <, >, &, ", ' to <, >, etc.
What's Content Security Policy?
HTTP header restricts script execution: Content-Security-Policy: script-src 'self'. Blocks inline scripts and external URLs.