Secure coding Agent version 1.0.0
AI-Written Code Security Reviewer
Check code written by an AI assistant for the security mistakes they make most: injectable queries, secrets in the source, packages that do not exist and safety steps left as a comment.
Run the agent
No account needed for a few runs a day.
What it checks
- Reads code in Python, JavaScript and TypeScript, PHP, Go, Java, Ruby and shell, as one snippet, several files or a diff. For a diff it checks only the added lines.
- Flags queries, commands and pages built from untrusted input, unsafe loading of data, and code that runs text it was given.
- Flags keys, tokens and passwords written into the source, including keys exposed to the browser.
- Flags mistakes specific to AI features: model output that is executed, queried or rendered as it arrives, and user text placed inside system instructions.
- Flags switched-off certificate checks, debug mode, weak hashing, predictable random values and security work left as a comment.
- Looks up the packages the code imports or installs in npm and PyPI, and reports names that do not exist or appeared very recently.
- Explains the findings in plain language and writes corrected versions of the flagged lines.
What it does not do
- It does not run your code or follow data through functions. It matches known risky patterns line by line, so it can miss a problem and can flag a line that is safe in context.
- It is not a replacement for a full static analyser, dependency audit or human review. Use it as a fast first pass.
- A result with no findings means none of these checks matched. It is not a guarantee that the code is secure.
How it works
The agent runs these steps in order. The result includes a record of each one, so you can see what ran and what was skipped.
- Read the inputSplits it into files, works out each language, and for a diff keeps the added lines.
parse - Look for secretsKeys, tokens and passwords in the source.
secrets - Check risky patternsInjection, unsafe data handling, access, encryption and settings.
patterns - Check AI handlingHow model output and prompts are used.
llm - Look up packagesWhether each imported or installed package exists and how new it is.
packages - Explain and fixPlain-language summary and corrected lines.
explain
Use it from your code or your assistant
Post the input with your API key and the reply is the full result. Get a free key, or read the full API documentation.
POST https://securityelites.com/wp-json/agentic-x/v1/agents/ai-code-reviewer/runscurl -X POST 'https://securityelites.com/wp-json/agentic-x/v1/agents/ai-code-reviewer/runs' \
-H 'X-API-Key: YOUR_KEY' \
-H 'Content-Type: application/json' \
--data @request.jsonimport json, urllib.request
with open("request.json") as f:
body = f.read().encode()
req = urllib.request.Request(
"https://securityelites.com/wp-json/agentic-x/v1/agents/ai-code-reviewer/runs",
data=body,
headers={"X-API-Key": "YOUR_KEY", "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req, timeout=90) as res:
result = json.load(res)
print(result["verdict"]["level"], result["summary"])
for f in result["findings"]:
print(f["severity"], f["id"], f["title"])import { readFile } from "node:fs/promises";
const res = await fetch("https://securityelites.com/wp-json/agentic-x/v1/agents/ai-code-reviewer/runs", {
method: "POST",
headers: { "X-API-Key": process.env.SE_API_KEY, "Content-Type": "application/json" },
body: await readFile("request.json", "utf8"),
});
const result = await res.json();
if (!res.ok) throw new Error(result.error.message);
console.log(result.verdict.level, result.summary);
for (const f of result.findings) console.log(f.severity, f.id, f.title);Fails the step when the result has high or critical findings.
# Fail the build when the agent finds anything high or critical.
curl -sS -X POST 'https://securityelites.com/wp-json/agentic-x/v1/agents/ai-code-reviewer/runs' \
-H "X-API-Key: $SE_API_KEY" -H 'Content-Type: application/json' \
--data "$(jq -n --rawfile c change.diff '{input:{diff:$c, explain:false}}')" \
| jq -e '.verdict.counts.critical + .verdict.counts.high == 0'This agent is the tool ai_code_reviewer on the Agentic X MCP server. Add the server to an MCP client and your assistant can run the agent itself, with the same key and limits. MCP server documentation.
{
"mcpServers": {
"securityelites-agentic-x": {
"type": "http",
"url": "https://securityelites.com/wp-json/agentic-x/v1/mcp",
"headers": {
"X-API-Key": "YOUR_KEY"
}
}
}
}The sample input for this agent, as the body of the request.
{
"input": {
"filename": "app.py",
"code": "import sqlite3\nimport hashlib\nimport requests\nfrom flask import Flask, request\nimport flask_auth_helper_pro\n\napp = Flask(__name__)\nOPENAI_API_KEY = \"sk-EXAMPLEexampleEXAMPLEexample1234\"\n\n@app.route(\"/user\")\ndef get_user():\n name = request.args.get(\"name\")\n db = sqlite3.connect(\"app.db\")\n # TODO: add authentication before production\n rows = db.execute(f\"SELECT * FROM users WHERE name = '{name}'\").fetchall()\n return {\"rows\": rows}\n\ndef store_password(password):\n return hashlib.md5(password.encode()).hexdigest()\n\ndef fetch(url):\n return requests.get(url, verify=False).text\n\nif __name__ == \"__main__\":\n app.run(host=\"0.0.0.0\", debug=True)\n",
"explain": true
}
}Limits
| What you get | No account | Free account | Premium |
|---|---|---|---|
| Runs a day | 2 | 5 | 100 |
| AI explanations a day | 1 | 3 | 75 |
| API access with a key | No | Yes | Yes |
| Package registry lookups | No | Yes | Yes |
| Saved baselines for change alerts | 0 | 1 | 12 |
| Past runs kept | 0 | 10 | 100 |
Limits reset at midnight UTC. A run that fails on our side is not counted.
Specification
Machine-readable versions: this agent's schemas as JSON and the OpenAPI specification.
Input fields
Give at least one of code, files or diff.
| Field | Type | Meaning |
|---|---|---|
code | string | One file or snippet of source code. Up to 60,000 characters. |
filename | string | Name of the file "code" came from. Used to pick the language. Up to 120 characters. |
language | string | Language of "code". Leave out to have it worked out from the file name or the code. One of: python, javascript, php, go, java, ruby, shell, other. |
files | array of object | Several files to review together, up to 200,000 characters in total. |
files[].path | string | Up to 200 characters. |
files[].content | string | |
diff | string | A unified diff, such as the output of git diff. Only added lines are reviewed. Up to 120,000 characters. |
explain | boolean | Add the AI-written summary, fix steps and corrected lines. Uses one AI credit. Default: true. |
Result fields
| Field | Type | Meaning |
|---|---|---|
run_id | string | |
agent | string | |
agent_version | string | |
created | string | |
verdict | object | |
verdict.level | string | One of: high_risk, needs_work, minor_issues, no_issues_found. |
verdict.label | string | |
verdict.risk_score | integer | |
verdict.counts | object | |
summary | string | |
scanned | object | |
scanned.files | integer | |
scanned.lines | integer | |
scanned.languages | array of string | |
findings | array of object | |
findings[].id | string | Stable rule identifier, for example CODE-SQL-BUILT-FROM-INPUT. |
findings[].area | string | One of: secrets, injection, llm, auth, data, crypto, config, deps, leftover. |
findings[].severity | string | One of: critical, high, medium, low, info. |
findings[].title | string | |
findings[].detail | string | |
findings[].evidence | string | The matching lines, with secrets masked. |
findings[].fix | string | |
findings[].refs | array of string | |
findings[].file | string | File the finding is in. Empty for a single snippet without a name. |
findings[].line | integer | First matching line. 0 when the finding is not tied to a line. |
findings[].lines | array of integer | Every matching line, up to 20. |
files | array of object | |
files[].path | string | |
files[].language | string | |
files[].lines | integer | |
files[].findings | integer | |
packages | array of object | Registry facts for each package looked up. |
ai | object or null | |
ai.summary | string | |
ai.steps | array | |
ai.snippets | array of object | |
ai_status | string | One of: done, skipped, not_needed, limit, busy, failed. |
trace | array of object | Each step the agent took, its status and timing. |
limits | object | |
notice | string |
Finding areas
| Area | Covers |
|---|---|
secrets | Secrets in the code |
injection | Injection and code execution |
llm | AI and model handling |
auth | Sign-in, sessions and access |
data | Files and untrusted data |
crypto | Encryption and randomness |
config | Unsafe settings |
deps | Packages |
leftover | Unfinished security work |
Severity levels
- critical: stop and do not use it as it is.
- high: fix before relying on it.
- medium: fix soon, or accept the risk knowingly.
- low: worth tidying.
- info: a fact to be aware of. It does not affect the verdict.
Questions
Why does AI-written code need its own check?
Assistants produce code that runs and reads well, which makes it easy to accept without the review hand-written code gets. The common faults are consistent: queries built by joining strings, example keys left in place, certificate checks switched off to make an error go away, and notes saying a safety step should be added later.
What is a package that does not exist?
Assistants sometimes import or install a package with a plausible name that was never published. If someone later registers that name with harmful code, everyone who runs the suggested install command gets it. The reviewer checks each name against the public registry before you install anything.
Does it replace my static analyser?
No. It checks one line at a time against known patterns and does not trace how data moves through the program. Keep your analyser and dependency audit. This agent is quick enough to run on every suggestion or pull request before those.
Is my code stored?
No. The code you submit is not stored. The result is stored so you can fetch it again, and the lines quoted as evidence have anything that looks like a secret masked. Only the flagged lines, with secrets masked, are sent to the AI step.
Can I run it on a pull request?
Yes. Send the diff to the API and fail the check when the verdict has high or critical findings. Only added lines are reviewed, so existing code does not block the change.
Which languages are covered?
Python, JavaScript and TypeScript, and PHP have the most checks. Go, Java, Ruby and shell have a smaller set. The secret, AI handling and leftover-work checks apply to any language.