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.
?? The Problem: AI Slopsquatting & Code Hallucinations
Large Language Models (LLMs) write great code, but they also introduce distinct security risks:
- 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. - Hardcoded Secret Placeholders: LLMs fill missing keys with patterns like
openai_key = "your_openai_key_here", which developers often accidentally commit. - Truncated Code Comments: AI models often output incomplete snippets containing
# ... rest of code hereor// ... 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), andpackage.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--jsonoutput 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
Release history Release notifications | RSS feed
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.0.tar.gz
(7.5 kB
view details)
File details
Details for the file guard_ai_cli-0.1.0.tar.gz.
File metadata
- Download URL: guard_ai_cli-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0ea59c33c81224a0359e9a04240f39adc4bd36a3deb56d71581e938f7393e0b
|
|
| MD5 |
a2a2f40b9f9df503efd822f50fcaf1c3
|
|
| BLAKE2b-256 |
8d00de8e6814a8cccd06e10514e2fc895b93b52df21854627d71c961e8ec84ca
|