Review agent · Web & injection

Cross-site scripting (XSS)

Checks whether untrusted data is rendered into HTML or JavaScript without contextual encoding.

ui/Comment.tsx1const html = comment.body;2return <div3 dangerouslySetInnerHTML=4 {{ __html: html }} />XSSwhat this review answersIs this a raw HTML sink?Is the value authored by users?Encoded for its output context?$ verdict REAL ISSUE$ fix render as text, or sanitize▍

Illustrative example of how this agent reviews a finding.

Why this agent matters

XSS lets an attacker run script in your users' browsers — stealing sessions, acting as the user, or rewriting the page. CWE-79 has topped the CWE Top 25 in recent years.

Modern frameworks escape by default, so most XSS hits from scanners are on static or already-escaped values. The real bugs hide in the escape hatches. This agent separates the two so the dangerouslySetInnerHTML that matters doesn't get lost among the ones that don't.

What it checks

  • Raw HTML sinks: innerHTML, dangerouslySetInnerHTML, v-html
  • Templates with autoescaping disabled
  • Reflected or stored input echoed back into a page
  • Values placed into script, attribute or URL contexts

When it marks a finding as a likely false positive

  • The rendered value is static or authored by you, not by users
  • The value is encoded for its output context by the framework

The fix it suggests

  • Contextual escaping or the framework's safe rendering
  • A strict Content-Security-Policy
  • Removing the raw-HTML sink or sanitizing with a vetted library

Scope and limits

This agent judges findings the scanners report (Semgrep for code, secrets and IaC/config, OWASP ZAP for passive website scans, our rules for imported API collections); it doesn't hunt for new bugs on its own. A finding reaches it when its scanner, CWE or rule/path keywords match this vulnerability class. It sees only the minimal code or evidence around the finding, with secrets redacted, and Claude, via Amazon Bedrock, returns a verdict with a confidence score, a plain-English explanation and a suggested fix.

Common questions

Will it flag every use of dangerouslySetInnerHTML?

The scanner will; the agent then checks where the HTML comes from. Static, server-built markup is marked a likely false positive with the reason.

Does React's escaping stop all XSS?

It encodes values for their output context by default, so most rendered values are safe. The risk sits in escape hatches such as dangerouslySetInnerHTML, v-html, innerHTML or templates with autoescaping turned off, which is where the agent focuses.

What fix does the XSS agent suggest for a real finding?

Contextual escaping or the framework's safe rendering, removing the raw-HTML sink or sanitizing with a vetted library, and a strict Content-Security-Policy as a second layer. The fix is a suggestion for you to review; the agent never changes your code.

Related agents

See all 21 review agents → · Agent setup reviewer · How the pipeline works

Run the Cross-site scripting (XSS) agent on your repository

100 free credits, no credit card. Every finding comes with a verdict and a fix.

Get started free