Back to Templates
4.2 (6)
Input Validation
Add comprehensive input validation and sanitization to prevent injection attacks and data corruption.
security
Official
Featured
by RepoBird
Updated 11/20/2025
59 executions
Template Instructions
These instructions will be passed to the AI agent when executing this template
Add input validation and sanitization throughout the codebase:
-
Identify all user input points:
- API endpoints
- Form submissions
- Query parameters
- File uploads
-
Add validation:
- Type checking
- Format validation (email, phone, etc.)
- Length constraints
- Whitelist validation where applicable
-
Add sanitization:
- HTML/Script tag removal for XSS prevention
- SQL parameter binding
- Command injection prevention
-
Use validation libraries appropriate for the language/framework
-
Add error handling for invalid input
Success Criteria
- All user input points identified and protected
- Validation schema created for each input type
- XSS protection implemented on all outputs
- SQL injection protection verified
- Proper error messages for invalid input
Completion Checklist
- Audit all API endpoints for input validation
- Create tests for validation rules
- Add documentation for validation patterns
- Test edge cases and boundary conditions
- Verify error handling doesn't leak sensitive info
Tags
security
validation
sanitization
XSS
Supported Languages
Any Language