sql-security

Screen host code for SQL injection risks and flag unsafe query builders.

416|6|Updated Apr 24, 2026
Ready to run
npx skills add https://github.com/mizchi/skills --skill sql-security-mizchi
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: sql-security
Source: https://github.com/mizchi/skills/tree/main/sql-security
Command: npx skills add https://github.com/mizchi/skills --skill sql-security-mizchi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Developers shipping SQL through application code (TypeScript, MoonBit, Rust, Go) face two recurring security gaps: SQL injection via unbound string interpolation, and credential leakage in query strings. Manual code review catches some cases but misses multi-line patterns and hidden concatenations. This Skill provides an automated first line of defense. ## Core Features & Use Cases - Template Literal Detection: Flags backtick strings starting with SQL keywords (SELECT, INSERT, WHERE) that contain ${...} placeholders, catching common injection patterns. - String Concatenation Scanning: Identifies quoted SQL fragments adjacent to + operators and identifiers, flagging ad-hoc query assembly. - Opt-Out Annotations: Safe patterns can be marked with // sql-security: ok comments to reduce noise in CI/CD pipelines. - Use Case: A backend team deploying a data access layer discovers that a developer accidentally built a WHERE clause by concatenating user input instead of binding it. The scanner catches this before code review. ## Quick Start Run the scanner against your project source directory to identify SQL injection candidates that require manual review.

Frequently Asked Questions about sql-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does the SQL injection scanner work?▼

The scanner walks source files line-by-line looking for backtick template literals starting with SQL keywords (SELECT, INSERT, WHERE, etc.) that contain `${...}` placeholders, and quoted strings concatenated with `+` operators. It exits with code 1 on findings, treating each match as a candidate requiring manual review.

What are the scanner's limitations?▼

The scanner reads one line at a time, so multi-line template literals are silently missed—a major blind spot. A clean scan does not prove safety; you must manually review any multi-line or programmatically-assembled SQL. Fold queries onto one line if you want the scanner to flag them.

How do I suppress false positives?▼

Add a `// sql-security: ok` or `# sql-security: ok` comment on the same line or the line above the flagged code. Use this for server-derived placeholders like `?` counts in IN clauses, inline migrations, and other known-safe patterns.

Does this scanner detect all SQL injection risks?▼

No. The scanner is intentionally noisy, catching obvious patterns but missing multi-line interpolation and indirect value sources. Treat findings as candidates for triage, not definitive proof of vulnerability. Combine with code review and parameterized query discipline for defense-in-depth.

What SQL engines does the scanner support?▼

The SQL keyword set works for SQLite, Postgres, and MySQL out of the box. Add engine-specific keywords like RETURNING or OVERLAPS to the regex for broader coverage on Postgres-heavy projects.

How do I handle credential leakage in SQL queries?▼

Use secretlint as a companion tool to scan for hardcoded tokens and connection strings. Configure it to run on pre-push or in CI to catch secrets before they enter git history.