input-sanitization

Validate and encode user inputs to prevent XSS and SQL injection.

19|5|Updated Nov 23, 2025
One-click install
npx skills add https://github.com/Nir-Bhay/markups --skill input-sanitization-nir-bhay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: input-sanitization
Source: https://github.com/Nir-Bhay/markups/tree/main/.agents/skills/input-sanitization
Command: npx skills add https://github.com/Nir-Bhay/markups --skill input-sanitization-nir-bhay

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides robust solutions for validating, sanitizing, and encoding user inputs to prevent security vulnerabilities like XSS and SQL injection, ensuring the integrity and safety of your applications.

Core Features & Use Cases

  • Input Validation: Uses allowlist patterns for emails, usernames, UUIDs, etc., in Python and TypeScript.
  • Context-Specific Encoding: Safely encodes data for HTML, JavaScript, and SQL contexts.
  • File Upload Sanitization: Validates file types, sizes, and sanitizes filenames.
  • Security Headers: Applies essential HTTP security headers like CSP and HSTS.
  • Use Case: Protect a web application by ensuring all user-submitted form data is validated against expected formats, encoded correctly before display, and that file uploads are free from malicious content.

Quick Start

Use the input-sanitization skill to validate the email address '[email protected]' using Python.

Frequently Asked Questions about input-sanitization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent SQL injection and XSS in Python and TypeScript web applications?

To prevent SQL injection and XSS, apply allowlist validation for inputs and context-aware encoding for HTML, JavaScript, and SQL contexts. Defense-in-depth strategies across APIs and databases ensure data integrity and system protection.

What is the best way to validate user input formats like emails and UUIDs?

The best way to validate user input formats like emails and UUIDs is using allowlist patterns. This approach strictly compares input data against expected, safe formats in Python and TypeScript to block unexpected characters.

How do I sanitize file uploads to ensure they are free from malicious content?

To sanitize file uploads, validate file types and enforce size limits while sanitizing filenames. This process ensures uploaded files match expected formats and prevents malicious content from entering your system.

How do I implement HTTP security headers like CSP and HSTS for my API?

Implementing HTTP security headers like CSP and HSTS involves configuring your server to apply essential security headers. This adds a defense-in-depth layer protecting web applications from various injection and execution attacks.

Does context-specific encoding work for both JavaScript and HTML output?

Context-specific encoding works for both JavaScript and HTML output by safely escaping data before display. It ensures injected data is treated as text rather than executable code, mitigating execution vulnerabilities.