cd /news/ai-safety/guard-ai-a-security-linter-for-ai-ge… · home topics ai-safety article
[ARTICLE · art-67374] src=github.com ↗ pub= topic=ai-safety verified=true sentiment=↑ positive

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

Guard-AI, a new security linter from developer Karthik VK, automatically catches AI-generated code vulnerabilities such as hallucinated dependencies, hardcoded secret placeholders, and truncated code comments before production. The tool supports Python, JavaScript/TypeScript, and package.json, features SQLite-backed caching for zero rate-limit hits, and integrates with CI/CD pipelines and pre-commit hooks.

read1 min views1 publishedJul 21, 2026
Guard-AI – A security linter for AI-generated code
Image: source

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

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 likeopenai_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.

  • ?? 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--json

output for automated pipelines. - ?? Ignore Rule Engine: Seamless support for default ignores (.venv

,node_modules

),.gitignore

, and.guardignore

.

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"]
── more in #ai-safety 4 stories · sorted by recency
── more on @guard-ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/guard-ai-a-security-…] indexed:0 read:1min 2026-07-21 ·