Claude Code ui

XSS Vulnerability in Template Output

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

XSS vulnerability detected in template Malicious script executed in user context Script injection through unsanitized output
XSS vulnerability detected in templateMalicious script executed in user contextScript injection through unsanitized output

Common Causes

  1. Raw HTML output without escaping: {{ userInput }} instead of properly escaped
  2. dangerouslySetInnerHTML or equivalent used without validation
  3. Server trust user input without sanitizing
  4. Missing Content Security Policy headers
  5. 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.

Real developers can help you.

BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Sage Fulcher Sage Fulcher Hey I'm Sage! Im a Boston area software engineer who grew up in South Florida. Ive worked at a ton of cool places like a telehealth kidney care startup that took part in a billion dollar merger (Cricket health/Interwell health), a boutique design agency where I got to work on a ton of exciting startups including a photography education app, a collegiate Esports league and more (Philosophie), a data analytics as a service startup in Cambridge (MA) as well as at Phillips and MIT Lincoln Lab where I designed and developed novel network security visualizations and analytics. I've been writing code and furiously devoted to using computers to make people’s lives easier for about 17 years. My degree is in making computers make pretty lights and sounds. Outside of work I love hip hop, the Celtics, professional wrestling, magic the gathering, photography, drumming, and guitars (both making and playing them) Victor Denisov Victor Denisov Developer Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Alvin Voo Alvin Voo I’ve watched the tech landscape evolve over the last decade—from the structured days of Java Server Pages to the current "wild west" of Agentic-driven development. While AI can "vibe" a frontend into existence, I specialize in the architecture that keeps it from collapsing. My expertise lies in the critical backend infrastructure: the parts that must be fast, secure, and scalable. I thrive on high-pressure environments, such as when I had only three weeks to architect and launch an Ethereum redemption system with minimal prior crypto knowledge, turning it into a major revenue stream. What I bring to your project: Forensic Debugging: I don't just "patch" bugs; I use tools like Datadog and Explain Analyzers to map out bottlenecks and resolve root causes—like significantly reducing memory usage by optimizing complex DB joins. Full-Stack Context: Deep experience in Node.js and React, ensuring backends play perfectly with mobile and web teams. Sanity in the Age of AI: I bridge the gap between "best practices" and modern speed, ensuring your project isn't just built fast, but built to last. legrab legrab I'll fill this later Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

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 &lt;, &gt;, etc.

What's Content Security Policy?

HTTP header restricts script execution: Content-Security-Policy: script-src 'self'. Blocks inline scripts and external URLs.

Related Claude Code Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help