Metadata-Version: 2.1
Name: cybereiche-vibesec
Version: 0.2.2
Summary: Fast, private application security scanner with on-device AI noise reduction and verified code fixes.
Author-email: CyberEiche <contact@cybereiche.de>
License: Apache-2.0
Project-URL: Homepage, https://cybereiche.de
Project-URL: Documentation, https://github.com/cybereiche/vibesec#readme
Project-URL: Repository, https://github.com/cybereiche/vibesec
Project-URL: Issues, https://github.com/cybereiche/vibesec/issues
Keywords: security,sast,sca,secrets,ai-guardrails,onnx,false-positive-reduction,code-scanner,vulnerability-scanner,remediation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Topic :: Security
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pydantic>=2.5.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: detect-secrets>=1.4.0
Requires-Dist: onnxruntime>=1.17.0
Requires-Dist: cryptography>=42.0.0
Requires-Dist: tokenizers>=0.15.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: torch>=2.0.0; extra == "dev"
Provides-Extra: full
Requires-Dist: litellm>=1.40.0; extra == "full"
Requires-Dist: whatthepatch>=1.0.5; extra == "full"
Requires-Dist: mcp>=1.0.0; extra == "full"
Requires-Dist: weasyprint>=60.0; extra == "full"
Provides-Extra: mcp
Requires-Dist: mcp>=1.0.0; extra == "mcp"
Provides-Extra: remediation
Requires-Dist: litellm>=1.40.0; extra == "remediation"
Requires-Dist: whatthepatch>=1.0.5; extra == "remediation"

# VibeSec 🛡️

**Stop drowning in false positives. Catch real vulnerabilities, silence security noise with local on-device AI, and auto-fix your code.**

[![PyPI version](https://img.shields.io/pypi/v/cybereiche-vibesec.svg)](https://pypi.org/project/cybereiche-vibesec/)
[![Tests](https://img.shields.io/badge/tests-309%20passed-brightgreen.svg)](tests/)
[![Python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue.svg)](pyproject.toml)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)

Most static analysis tools flood developers with hundreds of alerts for test mocks, dead branches, and benign string templates.

**VibeSec** combines static analysis, secret detection, and dependency audits with a tiny on-device AI model that runs in ~15ms on pure CPU. It automatically filters out false positives—**100% locally with zero cloud telemetry**.

---

## ⚡ Quickstart

Install via pip:

```bash
pip install cybereiche-vibesec
```

Run a scan in your project folder:

```bash
vibesec scan .
```

### What You See in the Terminal

```text
Scanning project at /my-app...
  ✓ Secrets:  0 leaks detected
  ✓ SAST:     1 confirmed risk (2 false positives suppressed by local AI)
  ✓ SCA:      1 CVE detected in requirements.txt

[CRITICAL] SQL Injection in app/db.py:42
   Code: cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
   AI Confidence: 98% (Confirmed Injection Vector)
   Fix: vibesec fix . --apply

[SUPPRESSED] 2 False Positives Filtered
   • tests/mock_auth.py:12 — Hardcoded test credential (mock harness)
   • utils/logging.py:88  — Benign string formatting (sanitized input)

Run 'vibesec scan . --show-suppressed' to inspect filtered alerts.
```

---

## 💡 Why VibeSec?

* **Local AI Noise Reduction**: A compiled 22 MB on-device transformer model filters out 40–60% of bogus SAST alerts in ~15ms on standard CPU. Zero code ever leaves your laptop or CI runner.
* **All-in-One Scanning**:
  * **Secrets**: API keys, tokens, and credentials (Gitleaks & detect-secrets).
  * **SAST**: Vulnerabilities like SQL injection, command execution, and path traversal.
  * **Polyglot SCA**: Dependency CVE audits via Google OSV across Python, JS/TS, Go, Rust, Java, and Ruby.
  * **AI & LLM Risks**: AST checks for prompt injection and unsafe agent shell execution.
* **Verified Code Fixes**: Don't just find vulnerabilities—fix them. VibeSec proposes syntax-checked diffs and verifies them against your local test suite (`pytest`, `npm test`) before applying changes.
* **Zero-Config CI/CD**: Native PR annotations (`::error::`), step summaries, and OASIS SARIF v2.1.0 output for GitHub Security and GitLab Security Dashboards without third-party bot tokens.

---

## 🛠️ CLI Usage Guide

### 1. Basic Scan (Default with AI Noise Reduction)
Scans your repository, runs all engines in parallel, and applies on-device noise reduction:
```bash
vibesec scan .
```

### 2. Inspect Filtered Alerts
Want to see what the AI suppressed and why?
```bash
vibesec scan . --show-suppressed
```

### 3. Strict Review Mode
Flags all borderline alerts for human review:
```bash
vibesec scan . --strict
```

### 4. Raw Scanner Mode (Disable AI Filtering)
Bypasses the triage model to inspect unfiltered scanner output:
```bash
vibesec scan . --no-triage
```

### 5. Export SARIF Report for CI/CD
Generates schema-compliant SARIF v2.1.0 for the GitHub Security tab:
```bash
vibesec scan . --sarif vibesec-results.sarif --severity HIGH
```

### 6. Auto-Fix Vulnerabilities
Preview or apply automated code patches:
```bash
# Preview proposed fixes (dry-run)
vibesec fix . --dry-run

# Apply verified fixes only if your test suite passes
vibesec fix . --apply --run-tests
```

---

## 🤖 Auto-Remediation Setup (Optional)

VibeSec can synthesize localized security patches using your preferred LLM provider via LiteLLM (Claude, GPT-4o, DeepSeek, or local Ollama/vLLM):

```bash
# Configure API keys via environment or .env:
export ANTHROPIC_API_KEY="sk-ant-..."
# or for local private models:
export VIBESEC_LLM_MODEL="ollama/llama3"
export VIBESEC_LLM_API_BASE="http://localhost:11434/v1"
```

Or configure via `.vibesec.yaml`:
```yaml
remediation:
  enabled: true
  model: "claude-3-5-sonnet-20241022" # or gpt-4o, ollama/llama3
```

---

## ⚙️ Configuration (`.vibesec.yaml`)

Customize rules and thresholds with an optional `.vibesec.yaml` file:

```yaml
version: 1

settings:
  severity_threshold: "HIGH" # LOW | MEDIUM | HIGH | CRITICAL
  fail_on_findings: true

triage:
  enabled: true
  threshold_confirm: 0.65
  threshold_suppress: 0.15
  zero_drop_critical: true

scanners:
  sast:
    enabled: true
  secrets:
    enabled: true
  sca:
    enabled: true

ignore:
  paths:
    - "tests/**"
    - "docs/**"
    - "node_modules/**"
```

---

## 🛡️ GitHub Actions Workflow

Add VibeSec to `.github/workflows/security.yml` for automated PR checks:

```yaml
name: Security Audit

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - run: pip install cybereiche-vibesec
      - run: vibesec scan . --severity HIGH --sarif vibesec-results.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: vibesec-results.sarif
```

---

## 🔒 Privacy, Air-Gap & Enterprise Compliance

For teams with strict data sovereignty and regulatory requirements:

* **Strict Air-Gap & Zero Telemetry**: Scans and machine-learning triage execute 100% locally in ephemeral process memory. Zero source code, snippets, or metadata ever leave your machine.
* **Zero-Drop Critical Policy**: High-severity risks (CVSS 9.0+) and Remote Code Execution patterns are hardcoded to never be auto-suppressed.
* **EU & DACH Compliance**: Built to adhere to GDPR Article 25 (Privacy by Design), EU AI Act transparency rules, and BSI IT-Grundschutz standards.
* For formal architecture specifications, threat modeling, and regulatory mappings, see [DACH_EU_COMPLIANCE_AND_THREAT_MODEL.md](docs/DACH_EU_COMPLIANCE_AND_THREAT_MODEL.md).

---

## 📄 License

VibeSec is distributed under the [Apache 2.0 License](LICENSE).  
Developed and maintained by [CyberEiche](https://cybereiche.de).
