Metadata-Version: 2.1
Name: cybereiche-vibesec
Version: 0.2.0
Summary: Autonomous AI & Application Security Platform: SAST, Secrets, Polyglot SCA, Air-Gapped ONNX Noise Triage, and Verified Auto-Remediation
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,owasp,prompt-injection,remediation,devsecops,onnx,false-positive-reduction,gdpr,eu-ai-act,bsi-grundschutz,air-gapped
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
Provides-Extra: remediation
Requires-Dist: litellm>=1.40.0; extra == "remediation"
Requires-Dist: whatthepatch>=1.0.5; extra == "remediation"
Provides-Extra: mcp
Requires-Dist: mcp>=1.0.0; extra == "mcp"
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: 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"

# VibeSec 🛡️

> **Autonomous AI & Application Security Platform: SAST, Secrets, Polyglot SCA, Air-Gapped ONNX False-Positive Noise Triage, and Verified Auto-Remediation — engineered by [CyberEiche](https://cybereiche.de) under the CyberEiche security ecosystem alongside [cybereiche-mcp-sec](https://pypi.org/project/cybereiche-mcp-sec/).**

[![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)
[![Target Truth](https://img.shields.io/badge/Target%20Truth-Verified%20Active-success.svg)](#target-truth-validation)
[![DACH/EU Compliance](https://img.shields.io/badge/Compliance-GDPR%20%7C%20EU%20AI%20Act%20%7C%20BSI%20IT--Grundschutz-darkgreen.svg)](docs/DACH_EU_COMPLIANCE_AND_THREAT_MODEL.md)
[![CyberEiche](https://img.shields.io/badge/Built%20by-CyberEiche.de-darkgreen.svg)](https://cybereiche.de)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)

VibeSec is an enterprise-grade, privacy-first security scanner built for modern development teams. It detects vulnerabilities, hardcoded secrets, polyglot dependency CVEs, and AI/LLM safety risks (OWASP Top 10 for LLMs), automatically triaging false positives with a built-in, air-gapped INT8 ONNX transformer model.

---

## 🏛️ DACH & EU Enterprise Security & Compliance

VibeSec is designed specifically to comply with European Union and DACH regulatory frameworks (Germany, Austria, Switzerland), ensuring enterprise security teams can adopt it without data sovereignty risks or legal hurdles:

* **Strict Air-Gap & Zero Cloud Telemetry (GDPR & Data Sovereignty)**:
  * Scans and machine-learning noise triage execute **100% locally** in ephemeral process memory.
  * Zero source code, snippets, or metadata leave your local machine or internal GitHub Actions runner (0 outbound network bytes, 0 background telemetry).
  * Formal architectural compliance documented in [DACH_EU_COMPLIANCE_AND_THREAT_MODEL.md](docs/DACH_EU_COMPLIANCE_AND_THREAT_MODEL.md).
* **EU AI Act Ready (Regulation 2024/1689)**:
  * Complies with **Articles 9–15 (Chapter III High-Risk requirements)**: robust risk management, technical documentation, record-keeping, and human-in-the-loop oversight.
  * Every AI-driven triage decision includes full explainability, calibrated confidence scores ($P(\text{Exploitable})$), and structured property bags in OASIS SARIF v2.1.0 exports.
* **Asymmetric Zero-Drop Safety Policy**:
  * Critical vulnerabilities (CVSS $\ge 9.0$) and Remote Code Execution (RCE) patterns are **never auto-suppressed**, guaranteeing zero masking of catastrophic risks.
* **Automated European PII Redaction (GDPR Article 25 - Privacy by Design)**:
  * Context harvesting features built-in, linear-time ($< 2\text{ ms}$) redaction of European IBANs, German Tax IDs (*Steueridentifikationsnummer*), mobile numbers, emails, and credentials prior to model tokenization.
* **Supply-Chain Integrity & Tamper Protection (NIS2 Directive & BSI IT-Grundschutz)**:
  * Compliant with **BSI IT-Grundschutz** modules `APP.6`, `CON.2`, `OPS.1.1.4`, and `SEC.1`.
  * The compiled INT8 ONNX model is verified at load time using **Ed25519 digital signatures** against the CyberEiche Master Public Key and streaming SHA-256 chunked digest validation. Any altered or unverified weight is instantly rejected (fail-closed).

---

## 🚀 Key Features

* **Local INT8 AI Noise Triage**:
  * In-memory, compiled transformer model (22.08 MB) executing dynamic INT8 inference in ~15–20 ms on pure CPU.
  * Cuts static analysis alert fatigue by 40–60% by filtering benign idioms, dead-code branches, and test harness mocks.
* **Unified Scanning Quadriad**:
  * **SAST**: Multi-language static analysis with custom rulesets and Semgrep compatibility.
  * **Secrets**: High-entropy credential and API token detection (Gitleaks & Yelp `detect-secrets`).
  * **Polyglot SCA**: Zero-runtime lockfile scanning powered by Google OSV (`osv.dev`) across Python, JS/TS, Go, Rust, Java, PHP, Ruby, and .NET.
  * **AST & LLM Security**: Specialized AST patterns for Prompt Injection, agent shell execution, and unvalidated LLM outputs.
* **Target Truth Validation**:
  * Reachability-driven active verification layer (DNS → TCP → HTTP) ensuring zero-noise and confirmed endpoint reachability.
* **Zero-Setup GitHub Actions**:
  * Native PR annotations (`::error::`), `$GITHUB_STEP_SUMMARY` audit scorecards, and OASIS SARIF v2.1.0 output for the GitHub Security tab without third-party bot tokens.
* **Autonomous Verified Remediation**:
  * Synthesizes localized patch diffs and verifies them against syntax checks and automated test suites before suggesting changes.

---

## 📦 Installation

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

*Requirements: Python 3.10, 3.11, or 3.12 (macOS, Linux, Windows).*

---

## 🛠️ User Guide & CLI Usage

### 1. Basic Scan (Default with AI Noise Triage)
Scans the current repository, runs all scanners in parallel, and applies local ONNX noise reduction:
```bash
vibesec scan .
```

### 2. Inspect Filtered False Positives
View a dedicated breakdown of findings suppressed by AI noise reduction, including confidence scores and justification reasons:
```bash
vibesec scan . --show-suppressed
```

### 3. Strict Compliance Mode
For high-assurance or regulated environments, elevated sensitivity flags all borderline findings for human review:
```bash
vibesec scan . --strict
```

### 4. Raw Scanner Mode (Disable AI Triage)
Bypasses the ONNX triage engine and displays raw, unfiltered scanner output:
```bash
vibesec scan . --no-triage
```

### 5. Export OASIS SARIF Report (CI/CD Pipelines)
Generates schema-compliant SARIF v2.1.0 including triage suppression objects for the GitHub Security tab or GitLab Security Dashboard:
```bash
vibesec scan . --sarif vibesec-results.sarif --severity HIGH
```

### 6. Autonomous Verified Remediation
Preview or apply automated code patches:
```bash
# Preview fixes (dry-run)
vibesec fix . --dry-run

# Apply verified fixes in-place only if pytest / npm test passes
vibesec fix . --apply --run-tests
```

---

## 🤖 Remediation Configuration (Optional)

VibeSec synthesizes localized security patches verified against AST syntax checks and your local test suite. Powered by LiteLLM, it supports Anthropic, OpenAI, DeepSeek, and self-hosted local models (Ollama, vLLM).

Configure credentials via `.env`:
```bash
# 1. Anthropic (Claude - Default)
ANTHROPIC_API_KEY="sk-ant-..."

# 2. OpenAI (GPT-4o)
OPENAI_API_KEY="sk-proj-..."

# 3. Local Air-Gapped Gateway (Ollama, vLLM)
VIBESEC_LLM_MODEL="ollama/llama3"
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
```

---

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

Customize scanner and triage settings by creating `.vibesec.yaml` in your project root:

```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 Integration

Add VibeSec to `.github/workflows/security.yml`:

```yaml
name: VibeSec Security & AI Guardrails

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

jobs:
  security-audit:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: Install VibeSec
        run: pip install cybereiche-vibesec

      - name: Run VibeSec Security Audit
        run: vibesec scan . --severity HIGH --sarif vibesec-results.sarif

      - name: Upload SARIF to GitHub Security Tab
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: vibesec-results.sarif
```

---

## 📄 License

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

---

## 🌲 About CyberEiche

**CyberEiche** is an enterprise cybersecurity firm based in Germany, specializing in autonomous AI defense, application security, and protocol verification.
- **Website**: [cybereiche.de](https://cybereiche.de)
- **Contact**: [contact@cybereiche.de](mailto:contact@cybereiche.de)
- **Ecosystem**: [cybereiche-mcp-sec](https://pypi.org/project/cybereiche-mcp-sec/) • [cybereiche-vibesec](https://pypi.org/project/cybereiche-vibesec/)
