input-sanitization

Sanitize user input and enforce security headers for Razor, Blazor, and API surfaces.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill input-sanitization-faysilalshareef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: input-sanitization
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/security/input-sanitization
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill input-sanitization-faysilalshareef

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Preventing cross-site scripting (XSS) and insecure data handling by providing a structured approach to input validation, sanitization, CSP headers, and safe file upload practices.

Core Features & Use Cases

  • Input validation and sanitization to reject unsafe data and clean user input for safe downstream processing.
  • Security headers & CSP to enforce trusted contexts and reduce browser-level attack surfaces.
  • File upload validation to verify content, size, and extensions before processing or storage; applies defense in depth.

Quick Start

Register the sanitizer in your DI container and apply validation at input boundaries to harden your application.

Frequently Asked Questions about input-sanitization

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

FAQPage Schema
How do I prevent XSS in web applications that accept user data?

To prevent XSS in web applications, you need a comprehensive input-sanitization framework that applies explicit validation rules, optional HTML sanitizers, and security headers middleware to enforce defense in depth across all input boundaries.

What's the best way to sanitize file uploads for content and extension safety?

The best way to sanitize file uploads is to validate content, size, and extensions before processing or storage. Applying defense in depth ensures untrusted files are rejected early, preventing unsafe data from reaching downstream rendering surfaces.

How do I enforce Content Security Policy headers to reduce browser-level attack surfaces?

To enforce Content Security Policy (CSP) headers, you apply security headers middleware within your application pipeline. This establishes trusted contexts for rendering dynamic content, mitigating cross-site scripting risks by restricting browser-level attack surfaces.

Does this input sanitization framework work with Razor, Blazor, and API surfaces?

Yes, this input sanitization framework explicitly applies to web applications rendering dynamic content across Razor, Blazor, and API surfaces, requiring explicit validation rules at input boundaries to safely process untrusted user data.

When do I need to register an HTML sanitizer in my DI container?

You need to register an HTML sanitizer in your DI container when your application accepts user data and renders dynamic content. This allows you to apply validation at input boundaries and clean user input for safe downstream processing.