A powerful Visual Studio Code extension that provides real-time, AI-powered security analysis for your code. VulnZap detects vulnerabilities like XSS, SQL injection, weak cryptography, and more with high accuracy across multiple programming languages.
- VulnZap Custom API: Specialized security-focused analysis with batch scanning
- Multi-Provider Support: Extensible API provider system for future integrations
- Context-Aware Detection: Understands code patterns beyond simple regex
- Intelligent Fallback: Pattern-based detection when AI is unavailable
- OWASP Top 10: Complete coverage of major security risks
- Code Injection: SQL injection, command injection, XSS, and LDAP injection
- Authentication & Authorization: Weak authentication patterns and privilege escalation
- Cryptographic Issues: Weak algorithms, insecure random generation, and key management
- Data Exposure: Sensitive data leaks, insecure storage, and logging issues
- Configuration Issues: Security misconfigurations and hardcoded secrets
- JavaScript & TypeScript: Full ES6+ and Node.js support with AST-guided precision
- Python: Django, Flask, FastAPI, and standard library
- Java: Spring, servlet-based applications, and enterprise patterns
- On-Save Scanning: Analysis triggers when you save files for optimal performance
- Fast Scan Mode: Quick initial analysis for immediate feedback
- Confidence Scoring: Each finding includes accuracy confidence (50-100%)
- Context-Aware Detection: Understands code patterns and reduces false positives
- Smart Caching: Optimizes performance while maintaining accuracy
- Multi-Ecosystem Support: npm, pip, go, rust, gradle, maven, composer, rubygems, and more
- Automatic Detection: Scans package.json, requirements.txt, go.mod, Cargo.toml, pom.xml, etc.
- Real-time Monitoring: Automatically scans when dependency files are saved
- Intelligent Caching: 5-day cache with dependency change detection
- Batch API Integration: Efficient vulnerability database queries
- Detailed Reports: Comprehensive markdown reports with CVE information, severity levels, and fix recommendations
- Vector-Based Analysis: Semantic code similarity detection using text embeddings
- Incremental Indexing: Smart updates when files change
- Security Pattern Recognition: Identifies similar vulnerable patterns across the codebase
- Context Retrieval: Provides security-relevant context for enhanced analysis
- Performance Optimized: Efficient storage and retrieval with configurable chunking
- Unified Dashboard: All security issues and dependency vulnerabilities in one view
- Issue Categorization: Organized by severity and file for easy navigation
- Detailed Reports: Comprehensive vulnerability information with fix suggestions
- Dependency Management: Direct links to update commands and patch versions
- Real-time Updates: Live synchronization with analysis results
- Open VS Code
- Press
Ctrl+Shift+X
(Windows/Linux) orCmd+Shift+X
(Mac) - Search for "VulnZap"
- Click Install
code --install-extension vulnzap.vulnzap
Press Ctrl+Shift+P
(Windows/Linux) or Cmd+Shift+P
(Mac) and run:
Security: Configure VulnZap API
- Visit VulnZap Platform
- Create an account and generate an API key
- Enter it when prompted in VS Code
VulnZap automatically scans your code when you save files. Security issues appear as:
- 🔴 Red squiggles: Critical/High vulnerabilities
- 🟡 Yellow squiggles: Medium severity warnings
- 🔵 Blue squiggles: Low severity recommendations
Command | Description |
---|---|
Security: Enable Security Review | Enable on-save scanning |
Security: Disable Security Review | Disable all scanning |
Security: Scan Current File | Force scan the active file |
Security: Configure VulnZap API | Set up API credentials |
Security: Toggle Security Review | Quick enable/disable toggle |
Command | Description |
---|---|
Security: Build Security Index | Index the entire codebase for enhanced analysis |
Security: View Index Statistics | Show indexing statistics and status |
Security: Clear Security Index | Remove all indexed data |
Security: Find Similar Code Patterns | Search for similar code patterns |
Command | Description |
---|---|
Security: Scan Dependencies for Vulnerabilities | Scan all dependencies in workspace |
Security: Force Dependency Scan (Ignore Cache) | Fresh dependency scan ignoring cache |
Security: View Dependency Cache Statistics | Show cache status and statistics |
Security: Clean Dependency Cache | Remove expired cache entries |
The status bar shows current state:
- 🛡️ Security: ON - Active and scanning
- 🛡️ Security: OFF - Disabled
- 🛡️ Security: ERROR - Configuration issue
Open VS Code settings (Ctrl+,
) and search for "VulnZap":
{
"vulnzap.enabled": true,
"vulnzap.enableFastScan": true,
"vulnzap.severity": "warning",
"vulnzap.confidenceThreshold": 80
}
{
"vulnzap.enableAIAnalysis": true,
"vulnzap.enableASTPrecision": true,
"vulnzap.enableContextAnalysis": true,
"vulnzap.enableDataFlowAnalysis": true
}
{
"vulnzap.enableVectorIndexing": true,
"vulnzap.autoIndexOnSave": true,
"vulnzap.vectorSimilarityThreshold": 0.7,
"vulnzap.indexChunkSize": 500
}
{
"vulnzap.enableDependencyScanning": true,
"vulnzap.dependencyScanOnStartup": true,
"vulnzap.dependencyCacheExpiry": 5,
"vulnzap.dependencyScanTimeout": 60000,
"vulnzap.dependencyScanDebounce": 5000
}
{
"vulnzap.maxFileSizeBytes": 1000000,
"vulnzap.maxFileLines": 2000,
"vulnzap.maxIssuesPerFile": 100,
"vulnzap.enableDebugLogging": false
}
// ❌ Detected: SQL injection vulnerability (Confidence: 95%)
const query = `SELECT * FROM users WHERE id = ${userId}`;
db.query(query);
// ✅ Suggested: Use parameterized queries
const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
// ❌ Detected: XSS vulnerability via innerHTML (Confidence: 87%)
element.innerHTML = userInput;
// ✅ Suggested: Use textContent for safe content insertion
element.textContent = userInput;
# ❌ Detected: Weak random number generation (Confidence: 92%)
import random
session_token = str(random.random())
# ✅ Suggested: Use cryptographically secure random
import secrets
session_token = secrets.token_urlsafe(32)
// ❌ Detected: Hardcoded API key (Confidence: 98%)
const apiKey = "sk-1234567890abcdef";
// ✅ Suggested: Use environment variables
const apiKey = process.env.API_KEY;
// package.json - Vulnerable package detected
{
"dependencies": {
"express": "4.16.0" // ❌ CVE-2024-29041: Path traversal vulnerability
}
}
// ✅ Recommendation: Update to express@4.19.2 or later
{
"dependencies": {
"express": "^4.19.2"
}
}
- Node.js 16.x or higher
- npm 7.x or higher
- Visual Studio Code 1.74.0 or higher
- TypeScript 4.9.x or higher
-
Clone the repository
git clone https://github.com/VulnZap/vulnzap-vscode-extention.git cd vulnzap-vscode-extention
-
Install dependencies
npm install
-
Compile TypeScript
npm run compile
-
Launch Development Environment
- Open the project in VS Code
- Press
F5
to launch a new Extension Development Host window - The extension will be loaded automatically for testing
# Watch mode for continuous compilation
npm run watch
# Compile once
npm run compile
# Package extension for distribution
npm run vscode:prepublish
vulnzap-vscode-extension/
├── src/
│ ├── core/ # Main extension entry point and core functionality
│ │ ├── extension.ts # Main extension activation/deactivation
│ │ └── index.ts # Core exports
│ ├── indexing/ # Codebase indexing and vector storage
│ │ ├── codebaseIndexer.ts # Main indexing orchestrator
│ │ ├── textChunker.ts # Code chunking for indexing
│ │ ├── vectorStorage.ts # Vector storage and retrieval
│ │ ├── codeRetriever.ts # Security context retrieval
│ │ └── incrementalIndexer.ts # Incremental index updates
│ ├── security/ # Security analysis components
│ │ └── codebaseSecurityAnalyzer.ts # AI-powered security analysis
│ ├── dependencies/ # Dependency vulnerability scanning
│ │ ├── dependencyScanner.ts # Main scanning orchestrator
│ │ ├── dependencyParser.ts # Multi-ecosystem dependency parsing
│ │ └── dependencyCache.ts # Intelligent result caching
│ ├── providers/ # VS Code integration providers
│ │ ├── apiProviders.ts # API provider management
│ │ ├── diagnosticProvider.ts # VS Code diagnostics integration
│ │ ├── securityViewProvider.ts # Security tree view
│ │ └── dependencyDiagnosticProvider.ts # Dependency diagnostics
│ └── utils/ # Utility functions
│ └── logger.ts # Centralized logging
├── package.json # Extension manifest and dependencies
├── tsconfig.json # TypeScript configuration
├── webpack.config.js # Build configuration
└── README.md # This file
-
Manual Testing
- Open test files in different languages
- Verify security issues are detected correctly
- Test dependency scanning with various package managers
-
Test Indexing System
- Build index and verify statistics
- Test similar code pattern detection
- Verify incremental updates work correctly
-
Performance Testing
- Test with large files and codebases
- Verify caching behavior
- Test network failure scenarios
-
Enable Debug Logging
- Set
vulnzap.enableDebugLogging: true
in settings - View → Output → Select "VulnZap"
- Set
-
Extension Logs
- Check Console for error messages in Extension Development Host
- Monitor API call success/failure
-
VS Code Debugging
- Set breakpoints in TypeScript files
- Use F5 to debug the extension
We welcome contributions! Please see our Contributing Guide for detailed information on:
- Code of Conduct
- Development workflow
- Testing procedures
- Pull request process
- Issue reporting guidelines
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and test thoroughly
- Commit with descriptive messages:
git commit -m 'Add amazing feature'
- Push to your branch:
git push origin feature/amazing-feature
- Create a Pull Request
- File Size Limit: 1MB per file for analysis
- File Line Limit: 2000 lines per file
- Max Issues per File: 100 issues to prevent overwhelming output
- Caching Duration: Configurable dependency cache (default: 5 days)
- Memory Usage: Optimized for large codebases with chunked indexing
- Network Failures: Graceful fallback to pattern matching
- API Keys: Stored securely in VS Code's encrypted storage
- Code Privacy: Code sent to VulnZap API for analysis only
- No Data Storage: Your code is never permanently stored on external servers
- Local Fallback: Works with pattern-based detection when API is unavailable
- Configurable Scanning: All features can be enabled/disabled per preference
- A01: Broken Access Control - Authorization bypass, privilege escalation
- A02: Cryptographic Failures - Weak encryption, insecure storage
- A03: Injection - SQL, NoSQL, command, LDAP injection
- A04: Insecure Design - Design flaws and threat modeling gaps
- A05: Security Misconfiguration - Default configs, verbose errors
- A06: Vulnerable Components - Outdated dependencies (fully supported)
- A07: Authentication Failures - Weak authentication, session management
- A08: Software Integrity - Insecure CI/CD, auto-update without verification
- A09: Logging Failures - Insufficient logging, log injection
- A10: Server-Side Request Forgery - SSRF vulnerabilities
- Cross-Site Scripting (XSS) - Reflected, stored, DOM-based
- Cross-Site Request Forgery (CSRF) - Missing tokens, weak validation
- Information Disclosure - Debug info, stack traces, sensitive data
- Business Logic Flaws - Race conditions, workflow bypasses
- API Security - Authentication, rate limiting, input validation
- SQL Injection: Template literals, string concatenation in queries
- XSS: innerHTML assignments, eval usage, unsafe DOM manipulation
- Hardcoded Secrets: API keys, tokens, Base64 strings, cryptographic keys
- Weak Crypto: MD5, SHA1, DES, RC4 usage
- Unsafe Functions: Command execution, system calls, shell operations
"Extension not working"
- Check VulnZap API key configuration:
Security: Configure VulnZap API
- Verify internet connection for API calls
- Check VS Code output panel for errors
- Ensure supported file type is being analyzed
"Analysis taking too long"
- Check file size (limit: 1MB, 2000 lines)
- Verify API key validity and quota
- Check if fallback mode is active
- Adjust confidence threshold in settings
"No security issues detected"
- Verify file language is supported (JS/TS/Python/Java)
- Check if real-time scanning is enabled
- Try manual scan:
Security: Scan Current File
- Review confidence threshold settings (default: 80%)
"Dependency scanning not working"
- Ensure dependency files exist (package.json, requirements.txt, etc.)
- Check VulnZap API configuration
- Verify
vulnzap.enableDependencyScanning
is true - Try
Security: Force Dependency Scan (Ignore Cache)
"Indexing issues"
- Check if indexing is enabled:
vulnzap.enableVectorIndexing
- Try rebuilding index:
Security: Build Security Index
- View statistics:
Security: View Index Statistics
- Clear and rebuild if corrupted:
Security: Clear Security Index
- 📝 GitHub Issues: Report bugs and request features
- 📖 Documentation: Check VS Code settings for configuration options
- 🔧 API Status: Verify VulnZap API service status
- 💬 Community: Join discussions in our GitHub repository
- Additional Language Support: Go, Rust, C++, PHP support
- Enhanced AI Models: Support for additional AI providers
- Custom Rules: User-defined security patterns and rules
- Team Collaboration: Shared configurations and rule sets
- CI/CD Integration: GitHub Actions, GitLab CI support
- Advanced Reporting: Security dashboards and metrics
- IDE Integration: Support for JetBrains IDEs, Vim, Emacs
- ✅ VulnZap API integration
- ✅ Advanced dependency scanning with caching
- ✅ Codebase indexing and vector analysis
- ✅ AST-guided precision for JavaScript/TypeScript
- ✅ Unified security view with dependency management
- ✅ Pattern-based fallback detection
- ✅ Performance optimizations and file size limits
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the VulnZap Team
Secure your code, one vulnerability at a time.