UNPKG

vibesec

Version:

Security scanner for AI-generated code - detects vulnerabilities in vibe-coded projects

372 lines (273 loc) โ€ข 11.4 kB
# VibeSec **Security Scanner for AI-Generated Code** Catches vulnerabilities your AI assistant missed. Integrates directly with Claude Code, Cursor, and Cline via MCP (Model Context Protocol). [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) ```bash # 2-minute setup for Claude Code echo '{"mcpServers":{"vibesec":{"command":"bun","args":["run","/path/to/vibesec-bun-poc/bin/vibesec-mcp"]}}}' > ~/.claude/mcp.json # Restart Claude Code - that's it! ``` ## โœจ New: AI Assistant Integration VibeSec now works **inside** your AI coding assistant through MCP integration: - ๐Ÿ” **Real-time scanning** as Claude/Cursor generates code - ๐Ÿค– **AI-aware detection** for prompt injection, incomplete implementations, hallucinated APIs - โšก **Zero friction** - works directly in your existing workflow - ๐Ÿ”’ **100% local** - your code never leaves your machine **Demo:** ``` You: "Claude, can you scan this file for security issues using VibeSec?" Claude: *uses vibesec_scan tool* "Found 2 critical issues: 1. Hardcoded API key on line 23 2. SQL injection risk in query builder..." ``` [See it in action โ†’](./docs/demo.gif) --- ## ๐ŸŽฏ Why VibeSec? The rise of vibe coding has democratized software development, but **45% of AI-generated code fails security tests** (Veracode 2025). VibeSec bridges the gap between rapid AI-assisted development and production-ready security. ### Key Problems We Solve - **AI-Specific Vulnerabilities**: Detects patterns unique to AI-generated code (incomplete implementations, placeholder TODOs, over-permissive configs) - **Non-Technical Accessibility**: Plain-language reports that PMs and designers can understand - **Integration-First**: Works alongside Snyk, Socket.dev, and your existing security tools - **Always Up-to-Date**: Auto-updating vulnerability database with latest AI-specific threats --- ## ๐Ÿš€ Quick Start ### For Developers ```bash # Install via npm npm install -g vibesec # Or use with Bun (recommended for POC) bun install vibesec # Scan your project vibesec scan . # Get plain language help vibesec scan --explain # Generate stakeholder report vibesec scan -f stakeholder -o report.txt ``` ### For Non-Technical Users (PMs, Designers, Product Owners) VibeSec speaks your language! No security expertise needed. ```bash # Scan with plain language explanations vibesec scan . --explain # What you'll see: # โœ… Clear "What/Why/How" explanations (no jargon!) # โœ… Real-world analogies (e.g., "like leaving your door unlocked") # โœ… Time estimates for each fix (e.g., "15-30 minutes") # โœ… Who can fix it (e.g., "Any developer") # โœ… Security score out of 100 ``` **First time?** Check out the [Quick Start Guide](docs/QUICK_START.md) for a step-by-step walkthrough. --- ## ๐Ÿ“Š What VibeSec Detects ### AI-Generated Code Patterns - โœ… Hardcoded secrets and API keys - โœ… Missing input validation (SQL injection, XSS) - โœ… Insecure authentication patterns - โœ… TODO/placeholder security features - โœ… Generic error handlers exposing sensitive info - โœ… Over-permissive CORS and permissions - โœ… Prompt injection vulnerabilities - โœ… Data exfiltration risks ### Language Support - JavaScript/TypeScript โœ… - Python *(coming soon)* - Go *(coming soon)* - Java *(coming soon)* - Ruby *(coming soon)* - PHP *(coming soon)* **Note:** POC currently focuses on JavaScript/TypeScript. Built with TypeScript + Bun runtime. See [TECH_STACK.md](docs/TECH_STACK.md) for details. --- ## ๐Ÿ—๏ธ Architecture ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ VibeSec CLI โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ–ผ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Core Scanner โ”‚ โ”‚ Integrations โ”‚ โ”‚ Reporters โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ€ข AST Parser โ”‚ โ”‚ โ€ข Snyk API โ”‚ โ”‚ โ€ข Plain Text โ”‚ โ”‚ โ€ข Detectors โ”‚ โ”‚ โ€ข Socket.dev โ”‚ โ”‚ โ€ข JSON โ”‚ โ”‚ โ€ข Analyzers โ”‚ โ”‚ โ€ข GitHub โ”‚ โ”‚ โ€ข Plain Language โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ€ข Stakeholder โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Detection Rules Database โ”‚ โ”‚ โ€ข Built-in Rules โ€ข Community Rules โ€ข Custom Rules โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` See [ARCHITECTURE.md](docs/ARCHITECTURE.md) for detailed design documentation. --- ## ๐Ÿ”ง Configuration Create a `.vibesec.yaml` file in your project root: ```yaml # .vibesec.yaml version: 1 scan: paths: - src/ - lib/ exclude: - node_modules/ - vendor/ - "*.test.js" severity: fail_on: high # fail CI if high/critical issues found detectors: secrets: true injection: true auth: true ai-specific: true integrations: snyk: enabled: true token: ${SNYK_TOKEN} socket: enabled: true token: ${SOCKET_TOKEN} output: format: json file: vibesec-report.json ``` --- ## ๐Ÿ“– Documentation **[๐Ÿ“š Complete Documentation Index](docs/INDEX.md)** - Browse all documentation ### Getting Started - **[Quick Start Guide](docs/QUICK_START.md)** - โญ Step-by-step guide for first-time users - **[Tech Stack](docs/TECH_STACK.md)** - TypeScript/Bun implementation details - **[API Documentation](docs/API.md)** - CLI and programmatic usage ### Core Documentation - **[Architecture](docs/ARCHITECTURE.md)** - System design and components - **[POC Specification](docs/POC_SPEC.md)** - Proof of concept scope - **[MVP Roadmap](docs/MVP_ROADMAP.md)** - Feature roadmap and timeline - **[Detection Rules](docs/DETECTION_RULES.md)** - Security pattern library - **[Integrations](docs/INTEGRATIONS.md)** - Third-party tool integrations - **[Market Strategy](docs/MARKET_STRATEGY.md)** - Business strategy and positioning - **[Contributing](docs/CONTRIBUTING.md)** - How to contribute ### Additional Resources - **[Research](docs/RESEARCH.md)** - Market research and competitive analysis - **[User Testing Guide](docs/USER_TESTING_GUIDE.md)** - Beta testing instructions - **[SOP Documentation](docs/sop/)** - Standard operating procedures - **[Component READMEs](docs/INDEX.md#component-documentation)** - Detailed component docs --- ## ๐Ÿค Integrations ### Current - โœ… GitHub Actions - โœ… Snyk (dependency vulnerabilities) - โœ… Socket.dev (supply chain security) ### Roadmap - โณ GitLab CI/CD - โณ CircleCI - โณ Jenkins - โณ Slack notifications - โณ Discord webhooks - โณ JIRA integration --- ## ๐ŸŽฏ Roadmap **๐Ÿ“‹ Active Planning:** [GitHub Project Board](https://github.com/users/ferg-cod3s/projects/4) ### POC (Weeks 1-2) โœ… COMPLETE - [x] Core scanner engine with 19 security rules - [x] Multi-detector system (secrets, injection, auth, incomplete code, AI-specific) - [x] CLI tool with progress indicators - [x] Plain-language and stakeholder reporters - [x] Security scorecard (0-100 grading) - [x] Comprehensive test suite (67 tests, 82% coverage) - [x] User testing materials and feedback forms ### MVP (Weeks 3-8) ๐Ÿšง IN PROGRESS Track progress on our [GitHub Project](https://github.com/users/ferg-cod3s/projects/4): - [ ] Enhanced Scanner (Tree-sitter AST, incremental scanning) - [ ] AI-Specific Detection Engine (confidence scoring, heuristics) - [ ] Integration Layer (Snyk, Socket.dev, GitHub Actions) - [ ] Reporting & UX (HTML/Markdown reports, auto-fix suggestions) - [ ] Web Dashboard (optional, React + Express + SQLite) - [ ] Polish & Launch (docs, examples, beta testing) ### Post-MVP ๐Ÿ”ฎ - [ ] IDE Integrations (VS Code, JetBrains) - [ ] Language Expansion (Ruby, PHP, Java, C#, Swift) - [ ] AI Chatbot ("Ask VibeSec") - [ ] Machine Learning for detection - [ ] Community rule marketplace - [ ] Enterprise features (SSO, audit logs, white-label) **Planning docs migrated to GitHub Projects for better collaboration.** See [docs/archive/](docs/archive/) for historical planning documents. --- ## ๐Ÿงช Testing ```bash # Run all tests npm test # Run specific test suite npm test -- scanner/detectors/secrets # Run with coverage npm test -- --coverage ``` --- ## ๐Ÿ“ Examples ### Basic Scan ```bash # Scan current directory vibesec scan . # Scan with plain language (for PMs/designers) vibesec scan --explain # Only show critical issues vibesec scan --severity critical # Generate stakeholder report for board presentation vibesec scan -f stakeholder -o security-report.txt ``` ### Using Security Scorecard ```bash # Get security score (0-100) with benchmark comparison vibesec scan --explain # Output shows: # Security Score: # 85/100 (B) - Good # Your score is 5 points above the average for small projects ``` ### Accessibility Features ```bash # Disable colors (for screen readers or terminals without color support) vibesec scan --no-color # Or use environment variable NO_COLOR=1 vibesec scan . ``` ### CI/CD Integration ```yaml # .github/workflows/vibesec.yml name: VibeSec Security Scan on: [push, pull_request] jobs: security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install Bun uses: oven-sh/setup-bun@v1 - name: Install VibeSec run: bun install vibesec - name: Run Security Scan run: bun vibesec scan . --severity high -f json ``` See [examples/](examples/) for more use cases. --- ## ๐ŸŒ Community - **Discord**: [Join our community](https://discord.gg/vibesec) - **Twitter**: [@vibesec_dev](https://twitter.com/vibesec_dev) - **Blog**: [vibesec.dev/blog](https://vibesec.dev/blog) --- ## ๐Ÿ“œ License VibeSec is open-source software licensed under the [MIT License](LICENSE). --- ## ๐Ÿ™ Acknowledgments VibeSec is built on research from: - Veracode's 2025 GenAI Code Security Report - NYU/Stanford AI-assisted coding security research - OWASP AI Security & Privacy Guide - Community contributions from vibe coders worldwide --- ## ๐Ÿšจ Security Issues If you discover a security vulnerability within VibeSec itself, please email security@vibesec.dev. All security vulnerabilities will be promptly addressed. --- **Built with โค๏ธ for the vibe coding community**