Global Validation

Validate and sanitize user input against SQL, XSS, and command injections.

Updated Mar 13, 2023
One-click install
npx skills add https://github.com/pdovhomilja/dovhomilja-cz --skill global-validation-pdovhomilja
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Global Validation
Source: https://github.com/pdovhomilja/dovhomilja-cz/tree/main/.claude/skills/global-validation
Command: npx skills add https://github.com/pdovhomilja/dovhomilja-cz --skill global-validation-pdovhomilja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents security vulnerabilities and ensures data integrity by implementing comprehensive input validation on both client and server sides, with clear error messages, protecting your application from malicious input and ensuring data quality.

Core Features & Use Cases

  • Dual-Layer Validation: Implement both client-side validation for immediate user feedback and critical server-side validation for security.
  • Security & Integrity: Sanitize input to prevent injection attacks (SQL, XSS) and enforce business rules and data types.
  • Clear Error Messages: Provide field-specific, user-friendly error messages for invalid input.
  • Use Case: When creating a new user registration form, this skill guides the AI to implement client-side validation for immediate feedback (e.g., email format), and critical server-side validation to sanitize inputs, check for unique email addresses, and enforce password complexity.

Quick Start

Add server-side validation to the 'updateUserProfile' API endpoint, ensuring the 'email' field is a valid format, the 'age' field is a positive integer, and all inputs are sanitized.

Frequently Asked Questions about Global Validation

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

FAQPage Schema
How do I prevent SQL injection and XSS attacks in user input?

Prevent injection attacks by validating and sanitizing all user input on the server side, enforcing allowlists over blocklists, and escaping data before database queries or HTML rendering. This protects against SQL, XSS, and command injection vulnerabilities across forms, API endpoints, and background jobs.

What's the best way to validate forms on both client and server side?

Implement dual-layer validation: use client-side checks for immediate user feedback on format and required fields, then enforce critical server-side validation to sanitize inputs, check data types, ranges, and business rules. Server-side validation is essential for security since client-side checks can be bypassed.

How do I validate API endpoint input and ensure data integrity?

Validate API inputs by checking data types, enforcing format requirements, verifying ranges, and sanitizing against injection attacks. Apply consistent validation rules across all endpoints and return field-specific error messages to guide users toward correct input.

When should I use allowlists instead of blocklists for input validation?

Allowlists define exactly what input is acceptable and reject everything else, making them more secure than blocklists which try to block known bad patterns. Allowlists are the recommended approach for input validation because they prevent unknown or novel attack vectors.

Can I validate form input in background jobs and scheduled tasks?

Yes, apply the same validation logic to background jobs and scheduled tasks that process user data. Server-side validation with input sanitization ensures data integrity and security even when data enters your system through asynchronous or batch processing paths.

Why do clear error messages matter for input validation?

Field-specific, user-friendly error messages guide users to fix invalid input quickly, improving experience and reducing support burden. Consistent error messaging across forms, APIs, and all entry points also prevents attackers from inferring system structure through error responses.