Works with the AI Agents you already use

    AI Code Security Review

    by Jay

    1

    Defensive security review for source code that finds vulnerabilities, leaked secrets, and risky AI-generated patterns.

    $9.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    AI Code Security Review

    AI Code Security Review

    Example session with this skill installed

    Do a security review of app.py. It's a small Flask API for an online shop that I built with an AI assistant. Tell me what's unsafe to deploy and how to fix it.

    • Read your context and instructions
    • Compiled the ai code security

    Security Review: app.py (sample Flask shop API)

    Scope: app.py only (40 lines). No tests, config files or dependency manifests were provided.
    Stack: Python, Flask, flask-cors, sqlite3, requests
    Verdict: Not safe to deploy. Three critical issues are reachable without logging in.

    Summary

    SeverityCount
    Critical3
    High3
    Medium2
    Low0

    Fix first: (1) remove shell command injection in /ping, (2) parameterize the login query, (3) rotate the hardcoded key.

    Findings

    [SEC-1] OS command injection in /ping (Critical)

    Status: Confirmed
    Location: app.py:40
    Category: Command injection (CWE-78)

    What's wrong
    subprocess.check_output("ping -c 1 " + request.args["host"], shell=True) passes the query parameter straight into a shell. The route has no authentication.

    How it could be abused
    Anyone who can reach the server can append their own shell commands to the host value and run them with the app's privileges.

    Fix

    import re, subprocess
    HOST_RE = re.compile(r"^[A-Za-z0-9.-]{1,253}$")
    
    @app.route("/ping")
    def ping():
        host = request.args.get("host", "")
        if not HOST_RE.fullmatch(host):
            return "invalid host", 400
        return subprocess.check_output(["ping", "-c", "1", host], timeout=5)
    

    Regression test
    Request /ping?host=localhost;id and assert a 400 and that nothing but a ping ran.


    [SEC-2] SQL injection and auth bypass in /login (Critical)

    Status: Confirmed
    Location: app.py:16-18
    Category: SQL injection (CWE-89)

    What's wrong
    The username is placed inside an f-string SQL query. The /profile route is not the only SQL building; this one decides who gets in.

    How it could be abused
    A crafted username can change the query's logic so it matches a user without the right password.

    Fix

    row = db().execute(
        "SELECT id, pw FROM users WHERE name = ?", (u,)
    ).fetchone()
    
    # then verify with a password hash such as argon2/bcrypt (see SEC-8)
    

    Regression test
    Log in with a username containing a SQL quote and a comment marker; assert login fails and no row is returned.


    [SEC-3] Hardcoded live-looking secret key (Critical if live)

    Status: Confirmed in code; whether it is live: Needs context
    Location: app.py:8
    Category: Secrets in source (CWE-798)

    What's wrong
    A key with a sk_live_ prefix (payment-provider format) is hardcoded, with a TODO to move it later. Value not repeated here.

    How it could be abused
    Anyone with repo access, now or in git history, can use it.

    Fix
    Read it from the environment (os.environ["SECRET_KEY"]) and fail at startup if missing.

    Rotate the key now; deleting it from the file does not remove it from history.

    Regression test
    Add a CI secret scan (gitleaks or trufflehog) that fails the build on matches.


    [SEC-4] Missing authorization on /orders/<id> (High)

    Status: Confirmed
    Location: app.py:22-25
    Category: Broken access control / IDOR (CWE-639)

    What's wrong
    The comment says the user is "logged in via front end", but the server checks nothing. No session or token exists anywhere in the app, so any caller can read any order by counting IDs.

    Fix
    Add real server-side authentication, then filter by owner: WHERE id=? AND user_id=? using the ID from the session, not from the request.

    Regression test
    User A requests User B's order and expects 404/403.


    [SEC-5] Mass assignment and SQL injection through column names in /profile (High)

    Status: Confirmed
    Location: app.py:29-31
    Category: Mass assignment (CWE-915), SQL injection (CWE-89)

    What's wrong
    The user ID comes from the request body, so anyone can edit any account. Every key in the JSON is interpolated as a column name, so a caller can set fields like a role flag, and the key itself is injectable SQL.

    Fix
    Take the user from the session, allowlist editable fields ({"display_name", "email"}), and build the query only from that allowlist.

    Regression test
    Post {"role": "admin"} and a key containing SQL punctuation; assert both are rejected.


    [SEC-6] Server-side request forgery in /preview (High)

    Status: Confirmed
    Location: app.py:36
    Category: SSRF (CWE-918)

    What's wrong
    The server fetches any URL a caller supplies and returns the body.

    How it could be abused
    A caller can make the server request internal-only addresses, including cloud metadata endpoints, and read the response.

    Fix
    Allowlist expected hosts, require https, resolve the hostname and block private, loopback and link-local ranges, disable redirects, set a timeout and response size limit.

    Regression test
    Request http://127.0.0.1/ and the cloud metadata address; assert both are refused.


    [SEC-7] Debug mode and open CORS (Medium)

    Status: Likely (depends on how the app is launched)
    Location: app.py:6-7
    Category: Security misconfiguration (CWE-489, CWE-942)

    What's wrong
    DEBUG is on and CORS allows every origin. If the app runs with Flask's interactive debugger enabled, that debugger can allow code execution on the server. I could not confirm the launch command from this file.

    Fix
    Disable debug outside local development; restrict CORS to known origins.


    [SEC-8] Passwords hashed with MD5 (Medium)

    Status: Confirmed
    Location: app.py:17
    Category: Weak password storage (CWE-328)

    What's wrong
    MD5 is fast and unsalted, so leaked hashes can be cracked quickly.

    Fix
    Use argon2 or bcrypt with per-user salts and migrate existing hashes at next login.


    What was checked and found clean

    • Dependencies: Flask, flask-cors, requests, sqlite3 are well-known packages; no look-alike names. No lockfile provided, so versions were not audited.
    • /orders/<int:order_id> query is parameterized (the issue there is authorization, not injection).

    Not covered / needs follow-up

    • Launch command and deployment config, dependency versions (run pip-audit), git history, and whether the key in SEC-3 is live.

    Suggested next steps

    Step 1, today: rotate the key from SEC-3 and take the /ping route (SEC-1) offline until it's fixed.

    Step 2, before deploying: fix SEC-2, SEC-4, SEC-5 and SEC-6. Add real server-side authentication first, since SEC-4 and SEC-5 depend on it.

    Step 3, then: disable debug mode, restrict CORS, and move to argon2 or bcrypt (SEC-7, SEC-8).

    Step 4, verify: add the regression test listed under each finding, run pip-audit, and add a secret scanner to CI.

    Want me to apply these fixes to app.py, write the regression tests, or re-review after your changes?

    Sample run on demo code. This is an AI-assisted review, not a penetration test.

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

    About this skill

    Code generated by AI assistants often looks correct while harboring subtle, exploitable vulnerabilities. This skill provides a defensive security review tailored to find flaws in AI-generated or "vibe-coded" codebases before they reach production.

    What it does

    • Vulnerability detection identifies exploitable flaws like SQL injection, insecure defaults, and broken access controls.
    • Secret discovery finds hardcoded API keys, credentials, and sensitive configurations committed to the repository.
    • Attack surface mapping identifies entry points, trust boundaries, and sensitive assets to prioritize high-risk code paths.
    • Dependency red flags spots hallucinated or look-alike package names and recommends running your ecosystem's audit tool for known vulnerabilities.
    • Remediation planning provides a specific code fix and a regression test for every finding.

    How it works

    1. Scope the review by defining the target files, diffs, or repository and prioritizing authentication and input handling.
    2. Map the surface to identify where untrusted data moves from the user to the server or database.
    3. Verify findings by tracing data flows end to end, to cut false positives and label each finding Confirmed, Likely, or Needs context.
    4. Deliver a report organized by severity, including evidence, attack paths, and minimal, idiomatic fixes.

    Why use it instead of a generic prompt

    Generic prompts often return style suggestions or vague hardening advice. This skill uses a structured method to trace data flows and verify exploitability, so you can see which findings are confirmed and which need a closer look. It specifically checks for the hallucination patterns and permissive defaults typical of AI-generated code.

    Use cases

    • Reviewing a pull request generated by Cursor, Copilot, or Claude for security regressions.
    • Auditing an existing repository for hardcoded secrets, missing access checks, and risky dependencies.
    • Checking new API endpoints for missing authorization and input validation.
    • Verifying the safety of AI-refactored code before merging into a main branch.

    What's included

    • Core review workflow
    • Security checklist covering 10 areas
    • Guide to common AI-code security patterns
    • Standard report template with a severity guide

    Known limitations

    This skill performs a static review of the code you provide and may not identify runtime or environment-specific vulnerabilities. It cannot verify findings that rely on libraries or infrastructure outside the provided scope, and it cannot check live vulnerability databases. It is an AI-assisted review, not a penetration test or compliance certification, and it can miss issues. For high-stakes systems, use it alongside professional security testing.

    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 3 days ago

    Nothing to install. It runs in your AI agent.

    Optional
    npmpipGit

    Read-only by default: the skill reviews and reports, and only changes your code if you ask. Don't paste live production secrets into a chat; if the review finds one, rotate it. For large projects, review in sections (for example, one folder or pull request at a time).

    Permissions

    Read Files
    Write Files
    Network Access
    Listed3 days ago

    What's inside

    Frequently Asked Questions

    This skill identifies exploitable vulnerabilities, hardcoded secrets, and insecure defaults specifically in code generated by AI assistants. It goes beyond generic advice by tracing data flows to confirm if a flaw is truly reachable and providing a specific code fix with a regression test for every finding.

    You can provide a single file, a specific code diff, a branch, or an entire repository. If you do not specify a scope, the skill will review the code currently visible to your agent and prioritize high risk areas like authentication and input handling.

    The output is a structured report categorized by severity that includes the exact file and line locations of issues. Each finding contains a description of the risk, the evidence found in the code, a minimal fix, and a test to verify the resolution.

    This skill is strictly defensive and will not write working exploits or malware. It also performs static analysis, meaning it may not identify runtime environmental vulnerabilities or issues involving external libraries and infrastructure not visible in the provided code.

    You can trigger this skill by asking your agent to perform a security audit, check if a specific piece of code is safe, or review a pull request before merging. It is especially useful when you want to verify code written by AI tools or code that handles sensitive data like payments and API keys.

    If a real credential or API key is discovered, the skill will report the location and type of the secret but will never repeat the full value in the report. It will also provide instructions on rotating the credential since removing it from the code does not clear it from git history.

    New in Security

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