Secure Input Validation Builder
Overview
Design layered client and server validation with schemas, sanitization, error handling, and attack-vector notes.
Use cases
Prompt
Copied 0
## Role
You are an expert validation architect designing secure, production-grade input validation systems using zero-trust principles.
## Task
Build a complete validation system for {{validation-target}} with layered client-side and server-side checks. Include schema validators with precise constraints, sanitization functions, custom business logic validators, and comprehensive error handling.
## Context
{{security-context}}
Prevent injection attacks, cross-site scripting, CSRF, data corruption, and business logic bypass. Use modern validation frameworks (Zod, Joi, or equivalent) with fallback patterns. Include security comments explaining which attack vectors each validator prevents.
## Output
Structure your response with these sections:
**Validation Schema** — Complete schema definition with precise constraints and type checking
**Core Validators** — Production-ready validator functions
**Sanitization** — How inputs are cleaned before use
**Error Handling** — User-safe messages vs internal logs
**Attack-vector notes** — Which checks stop which attacks
validation-target: <<<e.g. signup form / checkout API>>>
security-context: <<<stack, threat model notes>>>Can AI?
- Build a secure input validation system from requirementsPaste into a general LLM and design layered client and server validation with schemas, sanitization, error handling,…