Skip to main content

Linter detecting AI-generated code vulnerabilities, hallucinated packages, and truncated code.

Project description

??? guard-ai

Automated linter that catches AI-generated vulnerabilities, hallucinated dependencies, and code truncations before they hit production.

License: MIT Python 3.9+ CI Status


?? The Problem: AI Slopsquatting & Code Hallucinations

Large Language Models (LLMs) write great code, but they also introduce distinct security risks:

  1. Slopsquatting (Hallucinated Packages): LLMs frequently invent non-existent PyPI and NPM dependencies (e.g., fake_llm_helper_12345). Attackers register these hallucinated names to execute supply-chain attacks.
  2. Hardcoded Secret Placeholders: LLMs fill missing keys with patterns like openai_key = "your_openai_key_here", which developers often accidentally commit.
  3. Truncated Code Comments: AI models often output incomplete snippets containing # ... rest of code here or // ... existing code, breaking logic in production.

guard-ai runs directly in your CLI and CI/CD pipelines to block these issues instantly.


? Features

  • ?? Multi-Language Support: Scans Python (.py), JavaScript/TypeScript (.js, .ts, .jsx, .tsx), and package.json.
  • ?? High Performance Caching: SQLite-backed local registry lookup engine (24-hr TTL) to query PyPI & NPM without hitting rate limits.
  • ?? Zero False-Positives: Smart filtering for Python standard libraries, Node built-ins, and local module structures.
  • ?? CI/CD Ready: Custom exit thresholds (--fail-on HIGH) and structured --json output for automated pipelines.
  • ?? Ignore Rule Engine: Seamless support for default ignores (.venv, node_modules), .gitignore, and .guardignore.

? Quick Start

Installation

Install locally using pip:

pip install .

---

## ?? Pre-Commit Hook Integration

Want to catch AI risks *before* you even commit? Add `guard-ai` to your project's `.pre-commit-config.yaml`:

```yaml
repos:
  - repo: [https://github.com/Karthikvk1899/guard-ai](https://github.com/Karthikvk1899/guard-ai)
    rev: v1.0.0
    hooks:
      - id: guard-ai
        args: ["--fail-on", "HIGH"]


## ?? Pre-Commit Hook Integration

Want to catch AI risks *before* you even commit? Add guard-ai to your project's .pre-commit-config.yaml:

`yaml
repos:
  - repo: [https://github.com/Karthikvk1899/guard-ai](https://github.com/Karthikvk1899/guard-ai)
    rev: v1.0.0
    hooks:
      - id: guard-ai
        args: ["--fail-on", "HIGH"]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guard_ai_cli-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guard_ai_cli-0.1.1-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file guard_ai_cli-0.1.1.tar.gz.

File metadata

  • Download URL: guard_ai_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for guard_ai_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fedb1af5a94953441853d4c8c5b8d8ac4a094070f5a69e902d44bc49d058e1b2
MD5 e4cdafd59410e9c5efd2c1e50ced8cfd
BLAKE2b-256 88bd77dce58c234353e9a39d995c156c01c17a61d7ab6f76c3c6c1d79bf17a27

See more details on using hashes here.

File details

Details for the file guard_ai_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: guard_ai_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for guard_ai_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54d4fbaf0c0644b56a4990aaa40e41331eff4b3fbae68aa36a4cd4ad3f639e4b
MD5 1b352e3b1f754cca5aff603fff6b324d
BLAKE2b-256 2542483d7591609f4bb46b54cda0b8846fc77e2382612a35715d8c71bfd27b7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page