← Back to Analysis

XSS (Cross-Site Scripting) Protection

High Severity

What This Check Measures

This check evaluates protection against Cross-Site Scripting (XSS) attacks — where attackers inject malicious scripts into web pages viewed by other users.

Why It Matters

How Data Is Obtained

Source File

src/checks/safety.check.js

Function

SafetyCheck.analyze(url)

Current Implementation

// References the Security section for CSP header analysis
checks.push({
  name: 'XSS (Cross-Site Scripting) Protection',
  status: 'info',
  description: 'CSP headers provide XSS protection (see Security section)',
  severity: 'high'
});

Related Check

For actual XSS protection analysis, see the Security Headers Agent (security.check.js) which examines:

  • Content-Security-Policy (CSP) header
  • X-XSS-Protection header (deprecated but still checked)
  • X-Content-Type-Options header

Status Values

Status Meaning
info This check is informational. XSS protection is primarily evaluated through CSP headers in the Security section.

Severity: High

This check has high severity because:

Types of XSS Attacks

Stored XSS

Malicious script is permanently stored on the target server (e.g., in a database). Affects all users who view the infected content.

Reflected XSS

Script is reflected off a web server in error messages, search results, or URL parameters. Requires user to click a malicious link.

DOM-based XSS

Vulnerability exists in client-side JavaScript that processes user input unsafely. Server never sees the malicious payload.

Protection Mechanisms

How to Protect Against XSS

  • Content Security Policy (CSP) — Restrict script sources via HTTP header
  • Output Encoding — Escape user input when rendering HTML
  • Input Validation — Sanitize and validate all user inputs
  • HTTPOnly Cookies — Prevent JavaScript access to session cookies
  • X-Content-Type-Options — Prevent MIME type sniffing
  • Modern Frameworks — Use frameworks with built-in XSS protection (React, Vue, Angular)

Impact on Category Score

Currently returns info status with neutral impact. For XSS protection scoring, the Security Headers Agent evaluates CSP and other protective headers.