Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    SQL Injection Vulnerability Patcher

    1

    Detects and refactors SQL injection vulnerabilities by replacing raw string interpolation with parameterized queries.

    $15

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    SQL Injection Vulnerability Patcher

    SQL Injection Vulnerability Patcher

    Example session with this skill installed

    Audit this Python function for SQL injection and fix it: cursor.execute(f"SELECT * FROM logs WHERE user_id = '{uid}' AND action = '{action}'")

    • Read your context and instructions
    • Compiled the sql injection vulnerability

    I have audited the provided Python snippet and identified two SQL injection vulnerabilities stemming from f-string interpolation. I have refactored the code to use parameterized queries and added basic type validation.

    SQL Security Remediation

    
    # Refactored Code: Parameterized Query Implementation
    import logging
    
    def get_user_logs(cursor, uid: str, action: str):
        """
        Fetches user logs using parameterized queries to prevent SQL injection.
        Validation ensures uid is alphanumeric to prevent control character injection.
        """
        # 1. Defensive Validation: Ensure inputs meet basic criteria
        if not uid.isalnum():
            logging.error(f"Invalid UID format: {uid}")
            return []
    
        # 2. Parameterized Execution: Values are passed separately from the SQL command
        # This ensures the DB driver handles escaping and prevents command injection.
        query = "SELECT * FROM logs WHERE user_id = %s AND action = %s"
        params = (uid, action)
        
        cursor.execute(query, params)
        return cursor.fetchall()
    

    Next steps

    1. Update your unit tests to verify the function correctly handles the new parameter tuple format.
    2. Review other instances of cursor.execute in your data access layer for similar f-string patterns.
    3. Verify that your specific database driver (e.g., psycopg2, mysql-connector) uses %s or ? as the placeholder token and adjust if necessary.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Hardcoded string interpolation in database queries is a critical security flaw that leads to data breaches. This skill audits your backend code to identify SQL injection vulnerabilities and automatically refactors them into secure, parameterized statements.

    What it does

    • Vulnerability detection scans source code for direct string interpolation and f-strings inside SQL queries.
    • Code refactoring converts vulnerable raw string concatenations into safe, parameterized execute calls.
    • ORM audit identifies dangerous bypasses like Sequelize.literal(), SQLAlchemy.text(), or Django extra().
    • Input validation implements strict typing and whitelisting for dynamic elements like ORDER BY columns.
    • Secure defaults enforces query parameterization across polyglot backend environments.

    How it works

    1. Scan the project workspace to detect dynamic SQL string assembly and unsafe ORM patterns.
    2. Generate refactored code snippets using parameterized query syntax specific to your database driver.
    3. Apply defensive validation rules to ensure dynamic inputs are typed and whitelisted.
    4. Verify that no raw secrets or hardcoded credentials are leaked during the remediation process.

    Frameworks & tools

    Works with Python (SQLAlchemy, Django), JavaScript/TypeScript (Sequelize, TypeORM), and raw SQL drivers using standard parameterization patterns.

    Why this beats prompting it yourself

    Generic prompts often miss subtle ORM bypasses or fail to handle complex dynamic clauses like LIMIT or ORDER BY. This skill follows a deterministic security workflow to ensure every identified vulnerability is closed using industry-standard defensive patterns rather than just escaping strings.

    Use cases

    • Auditing legacy Express or Flask apps for raw SQL concatenation.
    • Securing ORM implementations that use unsafe raw text escapes.
    • Refactoring internal tools to meet security compliance standards.
    • Implementing strict input whitelisting for dynamic sorting features.

    Known limitations

    Restricted to project workspace files. Does not perform runtime traffic analysis or active penetration testing.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.

    Restricted to project workspace (./). Does not perform active penetration testing or dynamic runtime analysis. Scope limited to static code analysis and refactoring.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    Software
    Zero global installation
    orelevated privileges required.

    File System Read/Write (strictly scoped to current project workspace `./`).

    Permissions

    Read Files

    Target Use Cases: - Fix SQL injection in raw database query. - Refactor vulnerable string concatenation into parameterized SQL. - Audit ORM code for SQL injection bypasses.

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    This skill automatically scans your codebase for raw string interpolation in database queries and refactors them into secure, parameterized statements, effectively closing one of the most common vectors for data breaches.

    It supports major backend ecosystems including Python (Django, SQLAlchemy) and JavaScript/TypeScript (Sequelize, TypeORM), as well as projects using raw SQL drivers.

    Unlike generic prompts that might just 'escape' characters, this skill uses a deterministic workflow to identify subtle ORM bypasses (like Sequelize.literal) and enforces industry-standard parameterization.

    No, this skill is designed for static code analysis and refactoring within your development environment; it does not monitor live traffic or perform active penetration testing on running servers.

    Upon purchase, you receive the full skill logic ready to be integrated into your AI agent, along with documentation on how to run it against your project workspace.

    The skill handles complex dynamic elements by implementing strict input whitelisting and defensive validation rules, ensuring that even non-parameterizable clauses like 'ORDER BY' remain secure.

    New in Data & Databases