Skip to content

Anomalyze is an advanced AI-powered web security scanner that detects vulnerabilities, misconfigurations, and anomalies in web applications. It integrates ML-based analysis, CVE intelligence, and automated audits to deliver comprehensive, real-time security insights through an intuitive, analytics-driven dashboard for developers and security teams.

License

Notifications You must be signed in to change notification settings

ShalevAtsis/Anomalyze

Repository files navigation

🔍 Anomalyze - Advanced Web Security Scanner

Anomalyze Logo

A comprehensive, AI-powered web security scanning platform that identifies vulnerabilities, security issues, and anomalies in web applications.

License: MIT Node.js React TypeScript MongoDB


✨ Key Features

🛡️ Advanced Security Scanning

  • Multi-Vector Analysis: Security headers, library vulnerabilities, XSS detection, and ML-powered anomaly detection
  • AI-Powered Detection: HuggingFace BART model for zero-shot vulnerability classification
  • CVE Integration: Real-time vulnerability database lookups with intelligent caching
  • Parallel Processing: 40% faster scans through concurrent module execution
  • Security Scoring: Comprehensive 0-100 security score alongside anomaly detection

🎯 Vulnerability Detection Modules

  • Security Headers Audit: CSP, HSTS, X-Frame-Options, and more
  • Library Scanner: Detects outdated JavaScript libraries (jQuery, Lodash, Bootstrap, Vue.js, etc.)
  • XSS Probe: Multi-payload reflected XSS detection with context analysis
  • ML Analysis: AI-powered vulnerability pattern recognition
  • CVE Lookup: Automated Common Vulnerabilities and Exposures database integration

👥 User Management & Access Control

  • Role-Based Access: Admin and User roles with granular permissions
  • Secure Authentication: JWT-based auth with issuer/audience validation
  • User Profiles: Comprehensive user management with email verification
  • Password Security: Bcrypt hashing with secure reset functionality

Scheduling & Automation

  • Scheduled Scans: Automated periodic security assessments
  • On-Demand Scanning: Instant vulnerability analysis
  • Background Processing: Non-blocking scan execution
  • Scan History: Complete audit trail with detailed reporting

📊 Reporting & Analytics

  • Interactive Dashboard: Real-time scan results with charts and metrics
  • PDF Reports: Professional vulnerability reports with jsPDF
  • Severity Classification: Critical, High, Medium, Low vulnerability categorization
  • Scan Statistics: Performance metrics and trend analysis
  • Export Capabilities: Multiple format support for compliance reporting

🎨 Modern User Interface

  • Responsive Design: Mobile-first, adaptive UI
  • Dark/Light Mode: User preference-based theming
  • Real-time Updates: Live scan progress and notifications
  • Interactive Charts: Chart.js powered vulnerability visualization
  • Toast Notifications: User-friendly feedback system

🏗️ Technical Architecture

Backend Stack

  • Runtime: Node.js 20+ with TypeScript 5.9+
  • Framework: Express.js with comprehensive middleware stack
  • Database: MongoDB 7.0+ with Mongoose ODM
  • Security: Helmet, CORS, Rate Limiting, Input Validation
  • Authentication: JWT with bcrypt password hashing
  • Logging: Structured logging with Pino
  • Validation: Zod schema validation and express-validator

Frontend Stack

  • Framework: React 19+ with TypeScript
  • Build Tool: Vite 7+ for fast development and builds
  • Routing: React Router DOM 7+
  • State Management: React Context API
  • UI Components: Custom components with React Icons
  • Charts: Chart.js with React Chart.js 2
  • Forms: React Hook Form with validation
  • HTTP Client: Axios with interceptors

Infrastructure & DevOps

  • Containerization: Docker with multi-stage builds
  • Orchestration: Docker Compose for local development
  • Cloud Platform: AWS EC2 with ECR container registry
  • Web Server: Nginx for static file serving and API proxying
  • CI/CD: GitHub Actions with automated deployments
  • Monitoring: Health checks and structured logging

🚀 Quick Start

Prerequisites

  • Docker & Docker Compose
  • Node.js 20+ (for local development)
  • Git

Local Development Setup

  1. Clone the repository

    git clone https://github.com/ShalevAtsis/Anomalyze.git
    cd Anomalyze
  2. Environment Configuration

    # Create backend environment file from template
    cp backend/.env.example backend/.env
    
    # Edit backend/.env with your actual credentials
    # IMPORTANT: Never commit .env files with real secrets!

    Required Environment Variables:

    • MONGO_URI: Your MongoDB connection string
    • JWT_SECRET: Strong secret for JWT tokens (use: openssl rand -base64 32)
    • HUGGINGFACE_TOKEN: HuggingFace API token (optional)
    • AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY: AWS credentials (optional)
    • GOOGLE_CLIENT_ID & GOOGLE_CLIENT_SECRET: Google OAuth (optional)
  3. Start the application

    docker-compose up --build
  4. Access the application

Development Commands

# Start in development mode with hot reload
docker-compose up --build

# View logs
docker-compose logs -f backend
docker-compose logs -f frontend

# Stop services
docker-compose down

# Clean rebuild
docker-compose down -v
docker-compose up --build

🌐 Production Deployment

Live Access

Production URL: http://YOUR_EC2_PUBLIC_IP

  • Frontend served on port 80 via Nginx
  • API endpoints available at /api/*
  • Automatic API request proxying
  • Health monitoring at /api/health

AWS Infrastructure

  • Compute: AWS EC2 instance with Docker runtime
  • Container Registry: AWS ECR for image storage
  • Database: MongoDB Atlas (production) / Local MongoDB (development)
  • Load Balancing: Nginx reverse proxy
  • SSL/TLS: Ready for certificate integration

� Advdanced Configuration

Environment Variables

Backend Configuration (backend/.env)

# Server Configuration
PORT=5000
HOST=0.0.0.0
NODE_ENV=production

# Database
MONGO_URI=mongodb+srv://user:pass@cluster.mongodb.net/anomalyze

# Security
JWT_SECRET=your-super-secure-jwt-secret-key
JWT_ISSUER=anomalyze-api
JWT_AUDIENCE=anomalyze-client

# External Services
HUGGINGFACE_TOKEN=your-huggingface-token  # Optional for ML features
AWS_ACCESS_KEY_ID=your-aws-key            # Optional for SES email
AWS_SECRET_ACCESS_KEY=your-aws-secret     # Optional for SES email
AWS_REGION=us-east-1                      # Optional for SES email

# Security Headers
CLIENT_ORIGIN=http://localhost            # CORS origin for frontend

Production Environment (/opt/anomalyze/.env.production)

PORT=5000
HOST=0.0.0.0
MONGO_URI=mongodb+srv://user:pass@cluster.mongodb.net/anomalyze
JWT_SECRET=production-super-secure-secret
NODE_ENV=production
CLIENT_ORIGIN=http://YOUR_EC2_PUBLIC_IP

Deployment Automation

Automatic Deployment (Recommended)

Push to main branch triggers automatic deployment:

git add .
git commit -m "feat: your feature description"
git push origin main

GitHub Actions Pipeline:

  1. Build Docker images for backend and frontend
  2. Push images to AWS ECR with :latest and :${GITHUB_SHA} tags
  3. Deploy to EC2 instance via AWS SSM
  4. Health check verification

Manual Production Updates

# SSH into EC2 instance
ssh -i your-key.pem ec2-user@YOUR_EC2_IP
cd /opt/anomalyze

# Pull latest images from ECR
sudo docker compose pull

# Restart with new images (zero-downtime)
sudo docker compose up -d --force-recreate

# Verify deployment
sudo docker compose ps
sudo docker compose logs -f

Production Management

Service Monitoring

# Check service status
sudo docker compose ps

# View real-time logs
sudo docker compose logs -f

# Check specific service logs
sudo docker compose logs backend
sudo docker compose logs frontend

# Monitor resource usage
sudo docker stats

Maintenance Commands

# Restart specific service
sudo docker compose restart backend
sudo docker compose restart frontend

# Full system restart
sudo docker compose restart

# Clean up old images (saves disk space)
sudo docker image prune -f
sudo docker system prune -f

# Check disk usage
df -h
sudo docker system df

Database Management

# Create admin user (run once)
sudo docker compose exec backend npm run seed:admin

# Test email configuration (if SES configured)
sudo docker compose exec backend npm run test:ses

# Check SES configuration
sudo docker compose exec backend npm run check:ses

Troubleshooting Guide

Common Issues

502 Bad Gateway

# Check backend status
sudo docker compose logs backend

# Verify backend is listening on correct host
sudo docker compose exec backend sh -c 'echo "HOST=$HOST"'

# Test internal connectivity
sudo docker compose exec frontend curl -v http://backend:5000/health

Database Connection Issues

# Check MongoDB connection
sudo docker compose logs backend | grep -i mongo

# Verify environment variables
sudo docker compose exec backend env | grep MONGO_URI

Image Update Problems

# Force pull latest images
sudo docker compose pull --ignore-pull-failures

# Complete rebuild
sudo docker compose down
sudo docker image prune -a -f
sudo docker compose up -d

Performance Issues

# Check resource usage
sudo docker stats

# Monitor system resources
htop
df -h

# Check application logs for errors
sudo docker compose logs backend | tail -100

� Project Structure

Anomalyze/
├── 📁 backend/                    # Node.js + TypeScript API Server
│   ├── 📁 src/
│   │   ├── 📁 controllers/        # Request handlers (auth, scan, user)
│   │   ├── 📁 services/           # Business logic & external integrations
│   │   │   ├── scan.service.ts    # Main scan orchestrator
│   │   │   ├── headerAudit.ts     # Security headers analysis
│   │   │   ├── xssProbe.ts        # XSS vulnerability detection
│   │   │   ├── libraryDetector.ts # Outdated library scanning
│   │   │   ├── huggingface.service.ts # AI-powered analysis
│   │   │   └── nvd.service.ts     # CVE database integration
│   │   ├── 📁 models/             # MongoDB schemas (User, Scan)
│   │   ├── 📁 middlewares/        # Auth, validation, error handling
│   │   ├── 📁 routes/             # API route definitions
│   │   ├── 📁 tasks/              # Background job processing
│   │   ├── 📁 utils/              # Helper functions & utilities
│   │   └── 📁 validators/         # Input validation schemas
│   ├── 📄 package.json            # Dependencies & scripts
│   ├── 📄 Dockerfile              # Production container build
│   └── 📄 tsconfig.json           # TypeScript configuration
├── 📁 frontend/                   # React + TypeScript UI
│   ├── 📁 src/
│   │   ├── 📁 components/         # React components
│   │   │   ├── 📁 auth/           # Authentication components
│   │   │   ├── 📁 scan/           # Scanning interface components
│   │   │   ├── 📁 report/         # Report generation & display
│   │   │   └── 📁 Profile/        # User profile management
│   │   ├── 📁 services/           # API client services
│   │   ├── 📁 contexts/           # React context providers
│   │   ├── 📁 utils/              # Frontend utilities & helpers
│   │   ├── 📁 charts/             # Chart.js configuration
│   │   └── 📁 assets/             # Images, logos, static files
│   ├── 📄 package.json            # Frontend dependencies
│   ├── 📄 Dockerfile              # Nginx + React build container
│   ├── 📄 nginx.conf              # Nginx configuration
│   └── 📄 vite.config.ts          # Vite build configuration
├── 📁 .github/workflows/          # CI/CD automation
│   └── 📄 deploy.yml              # GitHub Actions deployment
├── 📁 docs and guides/            # Documentation
│   ├── 📄 DEPLOYMENT.md           # Production deployment guide
│   ├── 📄 SCAN-MODULE-TECHNICAL-GUIDE.md # Technical architecture
│   ├── 📄 CHANGELOG.md            # Version history & updates
│   └── 📄 AWS_SES_SETUP.md        # Email service configuration
├── 📄 docker-compose.yml          # Local development setup
├── 📄 docker-compose.prod.yml     # Production deployment
├── 📄 README.md                   # This file
└── 📄 LICENSE                     # MIT License

🛠️ Development Workflow

Local Development

# Start development environment
docker-compose up --build

# Backend development (with hot reload)
cd backend
npm run dev

# Frontend development (with hot reload)
cd frontend
npm run dev

# Run tests
cd backend
npm test

Code Quality & Standards

  • TypeScript: Strict type checking enabled
  • ESLint: Code linting and formatting
  • Prettier: Consistent code formatting
  • Git Hooks: Pre-commit validation (planned)

API Development

# Create admin user for testing
cd backend
npm run seed:admin

# Test email functionality (if configured)
npm run test:ses

# Check AWS SES configuration
npm run check:ses

Database Operations

# Connect to local MongoDB
docker-compose exec mongo mongosh anomalyze

# View scan results
db.scans.find().limit(5)

# View users
db.users.find()

🔒 Security Features

Application Security

  • Input Sanitization: DOMPurify integration prevents XSS attacks
  • SQL Injection Protection: MongoDB with parameterized queries
  • CSRF Protection: SameSite cookies and origin validation
  • Rate Limiting: Express rate limiter prevents abuse
  • Security Headers: Helmet.js for comprehensive header security
  • JWT Security: Secure token handling with issuer/audience validation

Infrastructure Security

  • Container Security: Multi-stage Docker builds with minimal attack surface
  • Network Security: Nginx reverse proxy with security headers
  • Environment Isolation: Separate development and production configurations
  • Secret Management: Environment-based secret handling

Vulnerability Scanning

The application scans for:

  • Security Headers: CSP, HSTS, X-Frame-Options, X-Content-Type-Options
  • Library Vulnerabilities: Outdated JavaScript libraries with known CVEs
  • XSS Vulnerabilities: Reflected cross-site scripting detection
  • ML-Detected Patterns: AI-powered anomaly and vulnerability detection

📊 Performance Metrics

Scan Performance

  • Average Scan Time: 15-30 seconds per URL
  • Parallel Processing: 40% performance improvement
  • Cache Hit Rate: 80% reduction in external API calls
  • Concurrent Scans: Supports multiple simultaneous scans

System Performance

  • Response Time: < 200ms for API endpoints
  • Database Queries: Optimized with compound indexes
  • Memory Usage: < 512MB per container in production
  • CPU Usage: < 50% under normal load

🤝 Contributing

We welcome contributions to Anomalyze! Here's how you can help:

Getting Started

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test thoroughly
  4. Commit your changes: git commit -m 'feat: add amazing feature'
  5. Push to the branch: git push origin feature/amazing-feature
  6. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write comprehensive tests for new features
  • Update documentation for API changes
  • Follow conventional commit messages
  • Ensure all tests pass before submitting

Areas for Contribution

  • 🔍 New Scan Modules: Additional vulnerability detection methods
  • 🤖 ML Improvements: Enhanced AI models for better detection
  • 🎨 UI/UX Enhancements: Improved user interface and experience
  • 📊 Reporting Features: Advanced reporting and analytics
  • 🔒 Security Hardening: Additional security measures
  • 📚 Documentation: Improved guides and tutorials

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • HuggingFace: AI-powered vulnerability detection
  • National Vulnerability Database (NVD): CVE data integration
  • OWASP: Security best practices and guidelines
  • React Community: Frontend framework and ecosystem
  • Node.js Community: Backend runtime and packages

📞 Support & Contact


Built with ❤️ for the security community

⭐ Star this project | 🐛 Report Bug | 💡 Request Feature

About

Anomalyze is an advanced AI-powered web security scanner that detects vulnerabilities, misconfigurations, and anomalies in web applications. It integrates ML-based analysis, CVE intelligence, and automated audits to deliver comprehensive, real-time security insights through an intuitive, analytics-driven dashboard for developers and security teams.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •