AI News HubLIVE
In-site rewrite2 min read

Guard-AI – A security linter for AI-generated code

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

SourceHacker News AIAuthor: karthikvk1899

Notifications You must be signed in to change notification settings

Fork 0

Star 1

BranchesTags

Open more actions menu

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

3 Commits

3 Commits

.github/workflows

.github/workflows

dist

dist

src/guard_ai

src/guard_ai

README.md

README.md

pre-commit-hooks.yaml

pre-commit-hooks.yaml

pyproject.toml

pyproject.toml

Repository files navigation

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 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:

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"]

About

No description, website, or topics provided.

Resources

Readme

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

1
star

Watchers

0
watching

Forks

0
forks

Report repository

Releases

No releases published

Packages
0

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Python
100.0%