Super Simple React Form Validation with Built-in Security
A lightweight TypeScript library that makes form validation incredibly easy while providing enterprise-grade security protection. Just drop in a component and you're protected!
SecureSharkInputs protects your forms from:
- π« XSS Attacks - Cross-site scripting attempts
- π« SQL Injection - Malicious database queries
- π« Data Theft - Attempts to access sensitive client-side data
- π« Inappropriate Content - Profanity and harmful language
- π« Unicode Evasion - Characters used to bypass filters
- π« DOM Manipulation - Malicious script injection
npm install securesharkinputs⨠Templates will be automatically installed!
When you install the package, it will automatically:
- β Create a working React form template
- β Set up the correct file structure
- β Include a setup guide
- β Show you exactly how to use it
Just one component does everything:
import ValidationShark from 'securesharkinputs';
// β
SUPER SIMPLE - Everything included!
<ValidationShark
name="email"
type="email"
label="Email"
placeholder="Enter your email"
required={true}
/>That's it! The component automatically:
- β Creates the input with proper styling
- β Adds the label with required indicator
- β Integrates with react-hook-form
- β Validates security threats in real-time
- β Shows error messages
- β Blocks form submission if threats detected
"use client";
import React from 'react';
import { useForm } from 'react-hook-form';
import ValidationShark from 'securesharkinputs';
const MyForm = () => {
const { handleSubmit } = useForm();
const onSubmit = (data) => {
console.log('Form submitted:', data);
};
return (
<form onSubmit={handleSubmit(onSubmit)}>
<ValidationShark
name="name"
type="text"
label="Name"
placeholder="Enter your name"
required={true}
/>
<ValidationShark
name="email"
type="email"
label="Email"
placeholder="Enter your email"
required={true}
/>
<button type="submit">Submit</button>
</form>
);
};When you install the package, you get a complete working template:
npm install securesharkinputs
# Template automatically installed to: src/components/SecureSharkForm.tsxFeatures of the template:
- β Complete form with all field types
- β Console logging for validation events
- β Security testing examples
- β Ready to use immediately
| Prop | Type | Required | Description |
|---|---|---|---|
name |
string | β | Field name for react-hook-form |
type |
string | β | Input type (text, email, password, etc.) |
label |
string | β | Label text |
placeholder |
string | β | Placeholder text |
required |
boolean | β | Whether field is required |
className |
string | β | Additional CSS classes |
onValid |
function | β | Callback when input is valid |
onInvalid |
function | β | Callback when threat detected |
// β
Simple required field
<ValidationShark
name="name"
type="text"
label="Name"
required={true} // β This adds automatic validation
/>
// β
The component automatically:
// - Shows asterisk (*) in label
// - Prevents form submission if empty
// - Shows error message
// - Integrates with react-hook-form validation- Real-time validation - Checks every keystroke
- Form blocking - Prevents submission if threats detected
- Visual feedback - Shows warnings immediately
- Console logging - Track validation events
- XSS Protection:
<script>alert('xss')</script> - SQL Injection:
'; DROP TABLE users; -- - Data Theft:
document.cookie - Inappropriate Content: Profanity and harmful language
- Unicode Evasion: Special characters used to bypass filters
- π Complete Guide - Detailed usage examples
- π Connection Verification - Test your implementation
Test your implementation immediately:
# Test basic functionality
node node_modules/securesharkinputs/scripts/test-client.js
# Test integration
node node_modules/securesharkinputs/scripts/test-integration.js
# Test connection in your project
node node_modules/securesharkinputs/scripts/test-connection.jsAdd these scripts to your package.json for easy access:
{
"scripts": {
"test:shark": "node node_modules/securesharkinputs/scripts/test-client.js",
"test:shark-integration": "node node_modules/securesharkinputs/scripts/test-integration.js",
"test:shark-connection": "node node_modules/securesharkinputs/scripts/test-connection.js"
}
}Then run:
npm run test:shark
npm run test:shark-integration
npm run test:shark-connection| Test | Purpose | What It Checks |
|---|---|---|
| test-client | Basic functionality | β
Library installation β Component availability β Basic validation |
| test-integration | Complete integration | β
All features working β Template installation β Security validation |
| test-connection | Real protection | β
Input protection in your code β Threat detection β Form blocking |
# Running test-client.js
β
Library installed correctly
β
ValidationShark component available
β
Security validation working
β
Template files present
# Running test-connection.js
π Analyzing your project...
β
Found 3 protected inputs
β
Security validation active
π Protection coverage: 100%If tests fail:
- Check installation:
npm list securesharkinputs - Verify template: Look for
src/components/SecureSharkForm.tsx - Check console: Open browser console (F12) for validation logs
- One component does everything
- No complex configuration
- Automatic react-hook-form integration
- Multi-layer threat detection
- Real-time validation
- Form submission blocking
- TypeScript support
- Automatic template installation
- Comprehensive documentation
- Built-in testing tools
- Lightweight (131.11 KB library code)
- Includes all dependencies (react-hook-form, react, typescript, yup)
- Battle-tested security algorithms
- Library Size: 131.11 KB (compiled code only)
- Package Size: 61.5 KB (compressed for npm)
- Unpacked Size: 269.3 KB (includes dependencies)
- Dependencies: react-hook-form, react, typescript, yup (included)
- TypeScript: Full support
- React: 18+ compatible
- Files: 42 total files
- Testing Tools: 3 built-in test scripts
- useSchema.js: 40.02 KB (validation engine)
- secureSharkBackend.js: 11.02 KB (backend protection)
- enterpriseValidator.js: 9.41 KB (enterprise services)
- ValidationShark.js: 6.96 KB (React component)
- index.js: 2.01 KB (entry point)
- Complete Guide - Step-by-step tutorial for everything
- Connection Verification - Verify your inputs are protected
- Installation:
npm install securesharkinputs - Basic Usage:
<ValidationShark name="email" type="email" label="Email" /> - Testing:
node node_modules/securesharkinputs/scripts/test-client.js
We welcome contributions! Please see our GitHub repository for details.
MIT License - see LICENSE file for details.
Made with β€οΈ by Azariel Moreno