{
 "schema": "aiblocks-page/1",
 "id": "agency-security-ai-generated-code-auditor",
 "type": "agent",
 "name": "AI-written code security reviewer",
 "summary": "Paste AI-written app code. Get a ranked list of leaked keys, open database rules and prompt injection holes, each with the fix and a rescan list.",
 "headline": "AI-written code security reviewer",
 "subhead": "Paste or upload the files your AI coding tool wrote, plus your database rules if you have them. It checks for exposed keys, weak access rules and unsafe AI calls. You get findings ranked worst first, each with the line, the risk and the fix.",
 "job": {
  "id": "secure-code",
  "name": "Keep your code secure"
 },
 "level": "intermediate",
 "thinking": "high",
 "tested": true,
 "updated": "2026-11-03",
 "first_published": "2026-10-26",
 "inputs": [
  {
   "type": "codebase",
   "required": true,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  },
  {
   "type": "source_text",
   "required": false,
   "label": "Source text",
   "what": "a long source in full: an article, a video or talk transcript, or notes from a book, with its title, author and link"
  }
 ],
 "outputs": [
  {
   "type": "security_report",
   "required": true,
   "label": "Security report",
   "what": "the risks found in the code, ranked, each with a fix"
  }
 ],
 "you_give": [
  "The code files to review, pasted or uploaded. Start with client-side files, API routes, and any file that calls an AI model.",
  "Your database rules and setup files, such as SQL migrations or policy definitions (optional)",
  "The names of your environment variables, with the values removed (optional)",
  "Your stack, such as Next.js with Supabase, and what sensitive data the app holds",
  "The list from a past audit, if this is a rescan (optional)"
 ],
 "you_get": [
  "A coverage note saying what was checked and what was not",
  "Findings ranked worst first, each with file and line, how it could be abused, and the fix",
  "A rotate-now list for every key that was exposed",
  "A list of safe patterns that were left alone, so you know it did not miss them",
  "A fix order, and a checklist to rescan after changes"
 ],
 "use_when": [
  "You built an app with Cursor, Lovable, bolt, v0 or Claude Code and want a security check before real users sign up.",
  "Your app uses Supabase or Postgres and you are not sure the access rules really keep users apart.",
  "Your app has an AI chat or agent and you want to know if a user could hijack its instructions.",
  "You just fixed a list of security issues and want a rescan to see what is resolved and what is new."
 ],
 "skip_when": [
  "You want a deep review of any kind of code, a threat model or advice on scanning tools. Use the Application security reviewer.",
  "You only want a quick check of one code change. Use the Code change security reviewer.",
  "You want keys and private files found on a live website. Use the Exposed secrets finder.",
  "You want a hands-on attack test of your running app. Use the Penetration test planner or the Live app security tester, and only on systems you own."
 ],
 "output_sample": {
  "input": [
   "The code files your AI tool wrote, pasted or uploaded",
   "Your database rules and setup files (optional)",
   "Your stack and the sensitive data the app holds",
   "A past audit list, if this is a rescan (optional)"
  ],
  "prerequisites": [
   "Secret values removed from anything you paste",
   "An AI tool that can open your project folder, if you want a whole project checked at once"
  ],
  "output": [
   {
    "name": "Coverage",
    "contains": "Which files were checked, what was out of reach and the stack assumed."
   },
   {
    "name": "Findings",
    "contains": "Each problem worst first, with file and line, how it could be abused, the fix and a confidence level."
   },
   {
    "name": "Rotate now",
    "contains": "Each exposed key by type and location, never its value, with where to change it."
   },
   {
    "name": "Left alone",
    "contains": "Safe patterns it saw and did not flag, such as a public anon key."
   },
   {
    "name": "Fix order",
    "contains": "The order to fix findings in, with why."
   },
   {
    "name": "Rescan checklist",
    "contains": "What to re-check after fixes, and what a pass looks like."
   },
   {
    "name": "Gaps and checks",
    "contains": "What it could not check, such as live database settings, and how to check it yourself."
   }
  ]
 },
 "output_shape": "COVERAGE\n  Files seen <list> | Not checked <list and why> | Stack <what>\n\nFINDINGS (worst first)\n  <number> [<severity>] <what is wrong in plain words> | <file and line> | <weakness ID if known>\n    How it could be used: <one sentence>\n    Fix: <one change>\n    Confidence: <high or medium> | Rotate: <key to change at the provider, if any>\n\nROTATE NOW\n  <key type> | <where it was seen, value hidden> | <where to change it>\n\nLEFT ALONE (safe patterns)\n  <pattern> | <why it is safe>\n\nFIX ORDER\n  <finding number> | <why first>\n\nRESCAN CHECKLIST\n  <what to re-check> | <what a pass looks like>\n\nGAPS AND CHECKS\n  <what could not be checked> | <how to check it>",
 "how_to_use": [
  "Download the pack from this page and add it to your AI as a skill. If you cannot, paste SKILL.md into a new chat, then paste references/source-agent.md.",
  "Paste or upload the files to review. Remove real secret values first. Add your database rules and your stack. A chat AI reads only what you give it, so for a whole project use an AI tool that can open your project folder.",
  "Type \"Audit this code. Worst first. Show the line, the risk and the fix for each finding. Do not print secret values. Tell me what you could not check.\"",
  "Read the rotate-now list first. Change those keys at the provider, even if you delete them from the code.",
  "Ask your AI coding tool to apply the fixes one at a time. Then paste the changed files back and ask for a rescan.",
  "Treat prompt injection findings as a prompt to look closer. They are medium confidence, and you confirm each one by hand."
 ],
 "checks": [
  "The result addresses your actual task and cites the evidence used.",
  "Examples, role-play experience and targets are kept separate from verified results.",
  "Claims of tests, memory, tool access or completed actions match what actually happened."
 ],
 "next": [
  {
   "name": "Prompt injection defender",
   "url": "https://useaiblocks.com/skills/prompt-injection-defender",
   "why": "Prompt injection defender"
  },
  {
   "name": "AI agent attack tester",
   "url": "https://useaiblocks.com/skills/ai-agent-attack-tester",
   "why": "AI agent attack tester"
  }
 ],
 "source": {
  "by": "Michael Sitarzewski and Agency Agents contributors",
  "repo": "msitarzewski/agency-agents",
  "url": "https://github.com/msitarzewski/agency-agents/blob/b37b5bb33b78f2c1d6567d98e25ca818e3259219/security/security-ai-generated-code-auditor.md",
  "licence": "MIT",
  "original_name": "AI-Generated Code Security Auditor",
  "commit": "b37b5bb33b78f2c1d6567d98e25ca818e3259219"
 },
 "credits": [
  {
   "title": "AI-Generated Code Security Auditor",
   "by": "Michael Sitarzewski and Agency Agents contributors",
   "url": "https://github.com/msitarzewski/agency-agents/blob/b37b5bb33b78f2c1d6567d98e25ca818e3259219/security/security-ai-generated-code-auditor.md",
   "used": "Original agent profile, preserved in references/source-agent.md; AI Blocks adds setup and review instructions."
  }
 ],
 "files": [
  "LICENSE",
  "references/source-agent.md",
  "SETUP.md",
  "source.json"
 ],
 "links": {
  "page": "https://useaiblocks.com/agents/agency-security-ai-generated-code-auditor",
  "markdown": "https://useaiblocks.com/agents/agency-security-ai-generated-code-auditor.md",
  "json": "https://useaiblocks.com/agents/agency-security-ai-generated-code-auditor.json",
  "instructions": "https://useaiblocks.com/skills/agency-security-ai-generated-code-auditor/SKILL.md",
  "download": "https://useaiblocks.com/skills/agency-security-ai-generated-code-auditor.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/agency-security-ai-generated-code-auditor",
  "api_document": "https://useaiblocks.com/api/v1/documents/agent/agency-security-ai-generated-code-auditor",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
