Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VibeSec βš‘πŸ”’

A VS Code extension that scans your code for security issues β€” powered by Semgrep and designed for developers who move fast.

Built as a capstone project. MVP-first, local-first, no cloud required.


What It Does

  1. Open a file in VS Code
  2. Pick it in the Scan panel or just run "VibeSec: Scan Current File"
  3. The extension runs Semgrep in the background
  4. Security issues appear as inline highlights directly in your code
  5. Results show up in the Findings panel grouped by folder and file
  6. Click any finding to jump to the exact line β€” or copy its description to clipboard

No accounts. No cloud. No telemetry. Everything runs on your machine.


Screenshots

(Coming soon)


Features

Feature Status
Scan current file βœ… v0.1.0
Inline diagnostics (squiggly lines) βœ… v0.1.0
YAML policy file to control rules βœ… v0.2.0
Findings side panel βœ… v0.2.0
Bundled default ruleset (no internet) βœ… v0.2.0
Activity bar icon + dedicated panels βœ… v0.3.0
Scan panel (file browser with multi-select) βœ… v0.3.0
Folder-grouped findings tree βœ… v0.3.0
Copy Description button βœ… v0.3.0
Configurable settings βœ… v0.3.0
First-install walkthrough βœ… v0.3.0
Scan whole project / multi-file scan βœ… v0.4.0
AI fix prompts (OpenAI / Anthropic / Gemini) βœ… v0.4.0
Secure API key storage βœ… v0.4.0
Copy-paste prompts per finding, file, or project βœ… v0.4.0
Analysis panel (React webview, sidebar) βœ… v0.5.0
Control Center (Dashboard / Settings / Logs / Rules) βœ… v0.6.4
Persistent scan history + sparkline βœ… v0.6.4
Structured logs with disk persistence + Output channel βœ… v0.6.4
Rule index browser with Open YAML βœ… v0.6.4
Taint analysis (source β†’ sink data flow tracking) βœ… v0.7.0
Data flow visualisation in finding cards (click-to-jump) βœ… v0.7.0
TAINT chip on the Rules page βœ… v0.7.0

Requirements

  • VS Code 1.85 or later
  • Semgrep CLI installed and on your PATH
  • Node.js 18+ (for extension development only)

Install Semgrep

# macOS / Linux
pip install semgrep

# or via Homebrew
brew install semgrep

# Windows
pip install semgrep

Verify it works:

semgrep --version

Install the extension (.vsix)

If you just want to use VibeSec (not build it from source), install the packaged .vsix:

  1. Download vibesec-<version>.vsix from the Releases page.
  2. Install it, either way works:
    • Command line: code --install-extension vibesec-<version>.vsix
    • From VS Code: open the Extensions panel β†’ … menu (top-right) β†’ Install from VSIX… β†’ pick the file.
  3. Reload VS Code if prompted. VibeSec appears in the activity bar on the left.

Make sure Semgrep is installed and on your PATH first β€” VibeSec uses it under the hood.


Getting Started (Development)

1. Clone the repo

git clone https://github.com/Moawiah188/vibesec.git
cd vibesec

2. Install dependencies

npm install

3. Compile

npm run compile

4. Run in VS Code

  1. Open the vibesec folder in VS Code
  2. Press F5
  3. A second VS Code window opens β€” this is your test environment
  4. Open any file and run Ctrl+Shift+P β†’ VibeSec: Scan Current File

Try It With the Sample File

The repo includes an intentionally insecure Python file for testing:

test-samples/insecure.py

Open it in the Extension Development Host and run a scan. You should see findings for:

  • Command injection via subprocess and os.system
  • Weak hashing with MD5 and SHA-1
  • Hardcoded credentials and API keys
  • SQL injection via string formatting
  • Insecure deserialization with pickle
  • Unsafe yaml.load()
  • Insecure randomness with random.random()
  • Code injection via eval and exec

Policy File (.vibesec.yaml)

Drop a .vibesec.yaml in your project root to control how VibeSec scans your code.

# Which rule packs to use
presets:
  - vibesec:default        # Bundled OWASP rules β€” works offline

# Minimum severity to report
severity:
  minSeverity: warning     # error | warning | info

# Exclude paths from scanning
files:
  exclude:
    - "**/node_modules/**"
    - "**/*.test.ts"

# Add your own inline rules
rules:
  - id: my-custom-rule
    message: "Don't use eval()"
    severity: ERROR
    languages: [javascript]
    pattern: eval(...)

Use Ctrl+Shift+P β†’ VibeSec: Open Policy File to create one with a starter template. Use VibeSec: Reload Policy to pick up changes without restarting VS Code.


Commands

Command Description
VibeSec: Scan Current File Scan the active file and show findings
VibeSec: Scan Selected Scan files/folders selected in the Scan panel
VibeSec: Scan Whole Project Scan every scannable file in the workspace
VibeSec: Open Policy File Create or open .vibesec.yaml in the workspace root
VibeSec: Reload Policy Force-reload the policy file from disk
VibeSec: Refresh File Tree Manually rebuild the Scan panel file list
VibeSec: Set API Key Store an OpenAI, Anthropic, or Gemini API key securely
VibeSec: Clear API Key Remove a stored API key
VibeSec: Test API Key Verify a stored key is valid and accepted
VibeSec: Generate Prompts Pre-generate AI fix prompts for all current findings

Project Structure

vibesec/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ extension.ts            # Entry point β€” registers commands, wires up UI
β”‚   β”œβ”€β”€ scanner.ts              # Runs Semgrep, parses JSON output
β”‚   β”œβ”€β”€ policy.ts               # Loads and validates .vibesec.yaml
β”‚   β”œβ”€β”€ findingsProvider.ts     # Findings panel (TreeView)
β”‚   β”œβ”€β”€ scanProvider.ts         # Scan panel file browser (TreeView)
β”‚   β”œβ”€β”€ scannableExtensions.ts  # Shared list of scannable file extensions
β”‚   β”œβ”€β”€ secrets.ts              # Secure API key storage (VS Code SecretStorage)
β”‚   β”œβ”€β”€ llmClient.ts            # HTTP clients for OpenAI, Anthropic, Gemini
β”‚   β”œβ”€β”€ promptGenerator.ts      # Builds AI fix prompts from findings
β”‚   └── types.ts                # Internal data models
β”œβ”€β”€ media/
β”‚   β”œβ”€β”€ vibesec-icon.svg      # Activity bar icon
β”‚   └── walkthrough/          # First-install walkthrough content
β”œβ”€β”€ rules/
β”‚   └── default.yaml          # Bundled OWASP-aligned rules
β”œβ”€β”€ test-samples/
β”‚   β”œβ”€β”€ insecure.py           # Sample vulnerable Python file
β”‚   β”œβ”€β”€ .vibesec.yaml         # Example policy (preset-based)
β”‚   β”œβ”€β”€ .vibesec-custom.yaml  # Example policy (custom rules only)
β”‚   └── custom-rules.yaml     # Example external rule file
β”œβ”€β”€ design-mockups/           # UI design system and component mockups
β”œβ”€β”€ package.json              # Extension manifest
β”œβ”€β”€ tsconfig.json             # TypeScript config
└── CHANGELOG.md              # Version history

Bundled Rules

The vibesec:default preset includes ~30 rules covering the OWASP Top 10 β€” no internet required.

Category Examples
Injection Command injection, SQL injection, eval/exec
Cryptographic Failures MD5, SHA-1 weak hashing
Auth Failures Hardcoded passwords, API keys, tokens
Integrity Failures pickle deserialization, unsafe YAML load
XSS innerHTML, document.write
Misconfiguration Flask debug=True, CORS allow-all
Insecure Randomness random.random(), Math.random()
Path Traversal Unsanitized open(), readFile()

Languages covered: Python, JavaScript, TypeScript


Roadmap

  • v0.1.0 β€” Sprint 1 "Scan": scan a file, show inline highlights βœ…
  • v0.2.0 β€” Sprint 2 "Policy": policy file, findings panel, bundled ruleset βœ…
  • v0.3.0 β€” Sprint 3 "Interface": activity bar, scan panel, redesigned findings tree βœ…
  • v0.4.0 β€” Sprint 4 "Prompts": multi-file scan, AI fix prompts, API key management βœ…
  • v0.5.0 β€” Sprint 5 "Panel": React analysis sidebar, Full Fix tab, severity callouts βœ…
  • v0.6.4 β€” Sprint 6 "Control Center": editor-area Dashboard / Settings / Logs / Rules, persistent scan history, structured logging βœ…
  • v0.7.0 β€” Sprint 7 "Taint": bundled taint ruleset, dataflow extraction, data flow UI block, taint-aware AI prompts βœ…
  • Next β€” Sprint 8 "Rule Sources": external rule pack syncing, live per-rule toggles

Taint Analysis

VibeSec ships a bundled taint ruleset that tracks how untrusted data flows from a source (HTTP request body, command-line argument, environment variable, file read) through variable assignments and helper calls to a sink (shell exec, SQL query, deserializer, outbound HTTP). This catches bugs that line-by-line pattern matching misses β€” e.g. when user input is read on line 12, stored in a variable, and only reaches subprocess.run on line 47.

Enable it by adding vibesec:taint to your .vibesec.yaml:

presets:
  - vibesec:default
  - vibesec:taint

Bundled rules cover command injection, SQL injection, path traversal, unsafe deserialization (pickle / yaml), XSS, and SSRF for Python and JavaScript/TypeScript.

When a taint rule fires, the finding card shows a dedicated Data flow block:

  • β‘  SOURCE β€” where the untrusted data enters
  • β‘‘ STEP N β€” any intermediate variable assignments along the path
  • β‘’ SINK β€” the dangerous call

Click any row to jump straight to that line. The AI fix prompt automatically includes the full data-flow path, so the assistant knows exactly where to add validation or sanitisation.


AI Fix Prompts

After a scan, VibeSec can generate a copy-paste prompt you paste into Cursor, Claude Code, ChatGPT, or any AI assistant to get a fix back.

Setup (one time):

  1. Ctrl+Shift+P β†’ VibeSec: Set API Key β€” pick your provider (OpenAI, Anthropic, or Gemini) and paste your key. It's stored securely using VS Code's built-in secret storage and never written to disk.
  2. Open Settings β†’ VibeSec and choose your preferred Prompt Mode:
    • Per File (default) β€” one prompt per file, batching all findings in it
    • Per Vulnerability β€” one prompt per individual finding
    • Per Project β€” one prompt covering every finding across the whole scan

Generating prompts:

  • Click the $(sparkle) Generate Prompts button in the Findings panel title bar to pre-generate all prompts at once
  • Or hover any finding/file row and click the $(comment-discussion) Copy Prompt button to generate and copy on demand β€” no upfront cost

Prompts include the offending code with context lines, rule details, and instructions for the AI to explain the issue, show a corrected snippet, and list follow-up checks.


Tech Stack

  • TypeScript
  • VS Code Extension API
  • Semgrep CLI
  • js-yaml β€” policy file parsing
  • minimatch β€” glob-based file exclusions
  • Node 18+ built-in fetch β€” LLM API calls (no extra HTTP library)

No backend. No database. No cloud infrastructure. Your API key stays on your machine.


License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages