Skip to main content

🛡️ Kavach AI (कवच)

Autonomous High-Precision Code Armor & 1-Click Surgical Patcher

License: MIT Python: 3.11+ Security Policy: OWASP 2026 Engine: Zero--Noise GitHub Actions: Ready

Kavach AI (कवच) is an autonomous, high-speed static security inspector and surgical code repair engine. Operating like an impenetrable armor across your GitHub Pull Requests (CI/CD), local CLI, VS Code editor, and Web Console, it eliminates critical security hazards (CWE-89 SQLi, CWE-798 Secret Leaks, CWE-120 Buffer Overflows) and generates 1-click ready-to-merge patches with zero-regression self-healing verification.


⚡ Core Philosophy: Zero-Noise Precision

Most static code scanners overwhelm developers with hundreds of stylistic warnings (missing docstrings, trailing whitespace). Developers end up ignoring them.

AutoPatch operates on a strict zero-noise policy:

  1. Ignores Noise: Lockfiles (package-lock.json, poetry.lock), minified bundles, images, and formatting diffs are discarded automatically.
  2. Flags Real Hazards Only:
    • 🛡️ Hardcoded Credentials & Tokens (CWE-798): AWS keys, GitHub PATs, OpenAI/Stripe secret keys in Python and JavaScript.
    • 🛡️ Raw SQL Injections (CWE-89): Raw string interpolation inside queries.
    • 🛡️ Arbitrary OS Command Injection (CWE-78): Untrusted shell inputs via os.system / child_process.exec.
    • 🔴 Fatal Runtime Exceptions (CWE-369, CWE-95): ZeroDivisionError crashes, dynamic eval() execution.
    • ⚡ Resource Descriptors Leaks (CWE-775): Unmanaged open() handles missing with context managers.
  3. Generates Instant Patches: AutoPatch outputs native GitHub markdown ```suggestion blocks that team leads can merge in 1 click right inside the GitHub UI.

🤖 GitHub Action Setup (Automated PR Reviews)

Add AutoPatch to any GitHub repository in 30 seconds by creating .github/workflows/autopatch.yml:

name: AutoPatch Security Review

on:
  pull_request:
    branches: [ main, master, dev ]
  push:
    branches: [ main, master ]

permissions:
  contents: read
  pull-requests: write
  issues: write

jobs:
  autopatch-ci:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

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

      - name: AutoPatch PR Reviewer
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          python ci_bot.py --fail-on CRITICAL

What Happens When a PR is Opened:

  1. Inspects Changeset in < 0.05s without external network latency.
  2. Posts an Official PR Review Comment with exact line numbers and 1-click GitHub commit suggestions.
  3. Populates the GitHub Step Summary with executive metrics and CWE classifications.
  4. Fails the CI status check to block merging if Critical vulnerabilities are detected.

🏗️ System Architecture

                  ┌───────────────────────────────┐
                  │   Incoming Git Pull Request   │
                  │   (git diff main...feature)   │
                  └───────────────┬───────────────┘
                                  │
                                  ▼
                  ┌───────────────────────────────┐
                  │    DiffParser (Zero-Noise)    │
                  │   - Filters lockfiles/assets  │
                  │   - Extracts modified hunks   │
                  └───────────────┬───────────────┘
                                  │
                                  ▼
                  ┌───────────────────────────────┐
                  │       Surgical Analyzer       │
                  │   - Python & JS/TS Parsers    │
                  │   - CWE-798 Credential Leaks  │
                  │   - CWE-89 SQL Injections     │
                  │   - CWE-78 Command Injections │
                  │   - CWE-775 Descriptor Leaks  │
                  └───────────────┬───────────────┘
                                  │
                                  ▼
                  ┌───────────────────────────────┐
                  │     1-Click Patch Engine      │
                  │   - GitHub suggestion blocks  │
                  │   - PR Commenter Bot (CI/CD)  │
                  │   - Standalone .patch export  │
                  └───────────────────────────────┘

🚀 Quickstart & Usage

1. Installation

Clone the repository and install requirements:

git clone https://github.com/rajrajak99/autopatch-ai.git
cd autopatch-ai
pip install -r requirements.txt

2. Standalone Terminal CLI (Scan 10,000+ Files Locally)

# Scan a directory and generate unified .patch
python cli.py ./my-project --patch autopatch.patch

# Apply patch directly via git
git apply autopatch.patch

3. Launch Local Review Workstation (Raycast / Linear Dark UI)

streamlit run app.py

Open http://localhost:8502 in your browser.

4. Run Automated Unit Tests

pytest -o pythonpath=. tests/

📂 Project Structure

autopatch-ai/
├── action.yml                  # GitHub Action specification (Composite)
├── ci_bot.py                   # Automated CI/CD PR Reviewer & Commenter
├── cli.py                      # Standalone high-speed Terminal CLI scanner
├── app.py                      # Luxury Raycast/Linear Dark review workstation
├── core/
│   ├── __init__.py
│   ├── diff_parser.py          # Unified Git diff & hunk pre-filtering
│   ├── surgical_analyzer.py    # Zero-noise CWE & bug detection engine
│   └── patch_validator.py      # Syntax and indentation patch validator
├── samples/
│   ├── __init__.py
│   └── vulnerable_samples.py   # Multi-language test scenarios (Python + Node.js)
├── tests/
│   ├── __init__.py
│   └── test_autopatch.py       # Comprehensive pytest test suite (4/4 passing)
├── .github/
│   └── workflows/
│       └── autopatch.yml       # Production CI workflow configuration
├── .streamlit/
│   └── config.toml             # Raycast/Linear Obsidian theme configuration
├── requirements.txt            # Minimal production dependencies
├── LICENSE                     # PolyForm Noncommercial 1.0.0
└── README.md                   # Technical documentation

🛡️ Supported CWE Vulnerability Matrix

CWE ID Vulnerability Class Language Severity AutoPatch Remediation
CWE-798 Hardcoded Credentials & Tokens Python / JS Critical Moves secrets to environment variables
CWE-89 SQL Injection (Raw formatting) Python / JS Critical Converts to parameterized queries
CWE-78 OS Command Injection Python / JS High Converts string interpolation to discrete arrays
CWE-95 Arbitrary Code Execution (eval) JavaScript Critical Replaces with strict JSON parser
CWE-775 Unmanaged Resource Descriptor Python Medium Enforces with open(...) context manager
CWE-369 Unchecked Zero Division Python High Inserts defensive conditional guard

📄 License & Commercial Rights

Kavach AI is licensed under the PolyForm Noncommercial License 1.0.0.

  • Free for Community: Free forever for individuals, students, open-source projects, and noncommercial research.
  • Commercial Restrictions: Commercial deployment, SaaS hosting, or commercial redistribution is strictly prohibited without a commercial license.
  • Enterprise & Commercial Licensing: For commercial use or organization subscriptions, contact Raja Rajak (rajabhaiyarajak2008@gmail.com).

Copyright (c) 2026 Raja Rajak (@rajrajak99). All rights reserved.

Metadata

Release files for kavach-ai 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kavach-ai 1.2.1
File Size Uploaded Provenance Actions
kavach_ai-1.2.1.tar.gz 36.1 kB Without provenance Details for kavach_ai-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kavach-ai 1.2.1
File Interpreter ABI Platform Actions
kavach_ai-1.2.1-py3-none-any.whl Python 3 none any Details for kavach_ai-1.2.1-py3-none-any.whl

Total release size: 68.1 kB

Release files / kavach_ai-1.2.1.tar.gz

Download URL kavach_ai-1.2.1.tar.gz
Size 36.1 kB
Tags Source
SHA-256 checksum
How to use checksums
95e4ed15b8f7443d175a6d8a678ae850a0f217cbd3f43424a043e609389adf41
BLAKE2b-256 checksum
How to use checksums
e2f7df463b34f34653c0e19eadd4542fa59d56a7185babf151e0234a8ca4a2cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / kavach_ai-1.2.1-py3-none-any.whl

Download URL kavach_ai-1.2.1-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0840693666dbe587e743f954801c9ceabbbfbb4fe8c8994eb103d226c7f9969
BLAKE2b-256 checksum
How to use checksums
5e0d1940b2cf26c3be56d91cd81f9c1956a6aea400589575f3e44198e363b23a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for kavach-ai 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page