I Built LogicGuard: A Diff-Aware Tree-sitter + LLM Scanner for Business-Logic Bugs A developer has open sourced LogicGuard v0.1.0 under the MIT license, a diff-scoped security scanner that combines Tree-sitter AST analysis with LLM review to catch semantic business-logic bugs in Python, JavaScript, and TypeScript. The tool runs a git-diff pre-filter to extract structural risk candidates before invoking a model, supporting OpenRouter, Anthropic, local Ollama, and a pure-AST offline mode, and ships with five built-in rules including auth bypass, IDOR, TOCTOU races, silent exception handlers, and AI-hallucinated guards. It includes a GitHub Marketplace Action that emits SARIF 2.1.0 into Code Scanning PR reviews and separates exit codes so provider errors don't masquerade as security findings. Traditional SAST tools and linters are great at catching syntax issues and known taint patterns eval , hardcoded secrets, basic SQLi . Where they struggle is semantic business-logic bugs a newly added /admin route missing an auth decorator, a TOCTOU check-then-act race condition on a balance transfer, a bare except Exception: pass swallowing a failed DB write, or an AI-generated security guard that doesn't actually enforce anything. On the other end, dumping an entire repository into an LLM on every pull request is slow, expensive, and noisy. I just open sourced LogicGuard v0.1.0 MIT to bridge the two with a diff-scoped, two-stage pipeline for Python, JavaScript, and TypeScript . Instead of sending every changed line to a model, LogicGuard splits scanning into two distinct phases: git diff and extracts structural risk candidates. If a PR touches clean code or non-matching logic, LogicGuard exits immediately with It supports OpenRouter works with openrouter/free for $0 CI runs , Anthropic , local Ollama models, and a pure-AST --offline-only mode for private or air-gapped repos. List the 5 built-in rules uvx logicguard rules Run pure Tree-sitter AST checks against your current git diff uvx logicguard diff --base main --offline-only Or install globally via pipx install logicguard . v0.1.0 auth bypass — Mutating API routes missing authentication/authorization guards idor ownership — Object access or mutation without verifying resource ownership race toctou — Check-then-act state updates e.g., balances, inventory without locking or atomic updates silent except — Broad exception handlers silently swallowing failures around state changes ai hallucinated guard — Placeholder or no-op validation checks commonly introduced by coding assistants LogicGuard ships with a GitHub Marketplace Action that emits SARIF 2.1.0 inline directly into GitHub Code Scanning PR reviews and separates exit codes 0 clean, 1 findings, 2 provider/config error so a flaky API doesn't masquerade as a security failure: name: LogicGuard Security Diff Scan on: pull request: branches: main permissions: contents: read security-events: write jobs: logicguard: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: Aviation3006/logicguard@v0.1.0 env: OPENROUTER API KEY: ${{ secrets.OPENROUTER API KEY }} Swap in provider: ollama or offline-only: true if your codebase cannot touch external APIs. Every rule follows a self-contained 2-file contract src/logicguard/rules/