SQL 注入扫描器:自动化漏洞检测 - Openclaw Skills

作者:互联网

2026-04-14

AI教程

什么是 SQL 注入扫描器?

SQL 注入扫描器是一款强大的安全工具,旨在增强后端应用程序防御 OWASP Top 10 中最持久的威胁之一。通过 Openclaw Skills 将此功能集成到您的工作流程中,开发人员可以在代码进入生产环境之前,自动识别不安全的查询构造、危险的字符串拼接以及不当的 ORM 使用。它专注于实际安全性,不仅提供检测,还提供实施正确参数化查询的可行建议,确保您的数据免受未经授权的访问。

该工具专为速度与安全必须并存的现代开发环境而设计。无论您是在处理遗留代码还是构建新功能,扫描器都会通过突出显示经常绕过标准 ORM 保护的缺失参数化和不安全的原始查询调用来提供安全保障。作为 Openclaw Skills 生态系统的一部分,它使开发人员能够以零配置开销维持高安全态势。

下载入口:https://github.com/openclaw/skills/tree/main/skills/lxgicstudios/sql-injection-scanner

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install sql-injection-scanner

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 sql-injection-scanner。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

SQL 注入扫描器 应用场景

  • 审计遗留代码库以发现隐藏的安全缺陷和未知的注入点。
  • 在开发阶段验证新的数据库交互,以确保符合最佳实践。
  • 通过识别显而易见的漏洞,为专业的安全审计或渗透测试做准备。
  • 在 CI/CD 流水线中自动进行安全检查,以防止每个版本中的安全倒退。
SQL 注入扫描器 工作原理
  1. 该工具扫描项目中各个源文件的 SQL 查询模式和数据库交互点。
  2. 它执行静态分析和 AI 驱动的模式匹配,以追踪用户输入如何流向数据库调用。
  3. 它识别高风险模式,如模板字面量、字符串拼接和不安全的 ORM 原始方法。
  4. 扫描器根据严重程度对发现结果进行分类,并生成详细报告,包括漏洞代码和安全的参数化修复方案。

SQL 注入扫描器 配置指南

确保您已安装 Node.js 18+。无需永久安装;您可以直接使用 npx 运行扫描器,以便在 Openclaw Skills 中获得无缝体验。

# 扫描整个源目录
npx ai-sql-check src/

# 扫描特定的文件模式
npx ai-sql-check "src/**/*.ts"

# 查看所有可用选项和帮助
npx ai-sql-check --help

SQL 注入扫描器 数据架构与分类体系

元素 描述
发现结果 按严重程度(高、中、低)分类的已检测漏洞列表。
漏洞代码 检测到不安全查询构造的具体行号和文件路径。
修复建议 AI 生成的代码片段,用安全的参数化查询替换不安全的拼接。
目标范围 可配置的路径定义,指定扫描中包含哪些文件扩展名(例如 .ts, .js)。
name: sql-injection-scanner
description: Detect SQL injection vulnerabilities in your codebase. Use when you need to find unsafe database queries before they get exploited.

SQL Injection Scanner

SQL injection has been around for decades and it's still in the OWASP Top 10. This tool scans your backend code for unsafe query construction, string concatenation in SQL, and missing parameterized queries. It finds the vulnerabilities and shows you how to fix them.

One command. Zero config. Just works.

Quick Start

npx ai-sql-check src/

What It Does

  • Scans your codebase for SQL injection vulnerability patterns
  • Detects string concatenation in SQL queries
  • Finds missing parameterized query usage
  • Identifies unsafe ORM patterns and raw query calls
  • Generates fix suggestions showing proper parameterized versions

Usage Examples

# Scan your entire backend
npx ai-sql-check src/

# Check a specific API route
npx ai-sql-check src/routes/users.ts

# Scan all database related files
npx ai-sql-check "src/**/*.{ts,js}"

Best Practices

  • Always use parameterized queries - String concatenation in SQL is never safe, even if you think the input is trusted
  • Check ORM raw query calls - ORMs are generally safe, but raw query methods bypass protections
  • Scan before every release - New code means new potential injection points
  • Don't trust input validation alone - Parameterization is the real defense. Validation is just a bonus.

When to Use This

  • Before a security audit or penetration test
  • After adding new database queries to your backend
  • When onboarding a legacy codebase with unknown security posture
  • As part of your CI security pipeline

Part of the LXGIC Dev Toolkit

This is one of 110+ free developer tools built by LXGIC Studios. No paywalls, no sign-ups, no API keys on free tiers. Just tools that work.

Find more:

  • GitHub: https://github.com/LXGIC-Studios
  • Twitter: https://x.com/lxgicstudios
  • Substack: https://lxgicstudios.substack.com
  • Website: https://lxgic.dev

Requirements

No install needed. Just run with npx. Node.js 18+ recommended.

npx ai-sql-check --help

How It Works

The tool scans your source files for SQL query patterns and analyzes how user input flows into database calls. It uses pattern matching and AI analysis to detect string concatenation, template literals in queries, and unsafe ORM usage. Each finding includes severity, the vulnerable code, and a parameterized query fix.

License

MIT. Free forever. Use it however you want.