A comprehensive security solution for web applications that can be integrated with a single line of JavaScript. Provides invisible backend protection against XSS, CSRF, injection attacks, and more.
- XSS Protection: Automatic sanitization of HTML content and dangerous JavaScript patterns
- CSRF Protection: Token-based validation for all form submissions and API requests
- Rate Limiting: Configurable request rate limiting per endpoint
- Header Security: Automatic security headers on all requests
- Threat Detection: Real-time analysis and blocking of suspicious activities
- Security Monitoring: Continuous monitoring and reporting of security events
- Zero-Visibility: Completely invisible to end users
Install the dependencies:
npm run install:allnpm run build:allnpm startThe backend server will start on port 3000 by default.
Add this single line to your website's HTML:
<script src="https://cdn.yourdomain.com/secureweb.js" data-api-key="your-api-key"></script>That's it! The plugin will automatically initialize and start protecting your website.
You can customize the behavior with additional attributes:
<script
src="https://cdn.yourdomain.com/secureweb.js"
data-api-key="your-api-key"
data-endpoint="https://your-api-endpoint.com"
data-debug="true">
</script>data-api-key(required): Your unique API key for authenticationdata-endpoint(optional): Custom backend endpoint URLdata-debug(optional): Enable debug logging (true/false)
The client-side SDK provides:
- Automatic XSS protection by sanitizing HTML content
- CSRF token generation and injection into forms
- Request interception for security validation
- Rate limiting per endpoint
- Security event reporting
The backend service provides:
- Real-time threat analysis
- Security metrics processing
- Threat database and reporting
- API key validation
- Webhook signature verification
- Sanitizes all
innerHTMLassignments - Blocks dangerous
eval()calls - Detects and prevents script injection attempts
- Monitors for suspicious JavaScript patterns
- Generates unique CSRF tokens for each session
- Automatically injects tokens into all forms
- Validates tokens on all API requests
- Configurable token expiration
- Per-endpoint request tracking
- Configurable rate limits (default: 100 requests/minute)
- Automatic blocking of excessive requests
- Sliding window implementation
- Automatic security headers on all requests
- Request timestamping
- Protected request identification
- Custom header support
Validate CSRF tokens
Submit security metrics for analysis
Report security events
Process security webhooks
Retrieve recent threats for an API key
Generate security report for a time period
secureweb-plugin/
├── sdk/ # Client-side SDK
│ ├── src/
│ │ └── index.ts # Main SDK implementation
│ ├── package.json
│ └── tsconfig.json
├── backend/ # Backend service
│ ├── src/
│ │ ├── server.ts # Express server
│ │ ├── security-analyzer.ts
│ │ └── threat-database.ts
│ ├── package.json
│ └── tsconfig.json
├── docs/ # Documentation
├── examples/ # Integration examples
└── package.json # Root package.json
# Build SDK only
cd sdk && npm run build
# Build backend only
cd backend && npm run build
# Build all
npm run build:all# Run both SDK and backend in watch mode
npm run devSee the /examples directory for complete integration examples:
- Basic HTML integration
- React integration
- Vue.js integration
- TypeScript integration
- Keep API Keys Secret: Never expose your API key in client-side code
- Use HTTPS: Always serve the plugin over HTTPS
- Monitor Reports: Regularly review security reports
- Update Regularly: Keep the plugin updated for latest security patches
- Configure Appropriately: Adjust security settings based on your needs
MIT
For issues and questions, please open an issue on the repository.