agent-frameworks-2026-ts-v1
19 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo not. - Confidence
- P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
- False-positive risk
- low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
- Edge
- The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
- Taxonomy chips
- References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.
keryn.agents2026.openai-agents-js-run-no-max-turns
Section titled “keryn.agents2026.openai-agents-js-run-no-max-turns”warning typescript, javascript openai-agents-js
run() from @openai/agents is called without maxTurns, so a looping or injected agent runs until the SDK default turn limit. Pass maxTurns sized for the task and handle MaxTurnsExceededError.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: Pass { maxTurns: <small bound> } as the third argument to run(), catch MaxTurnsExceededError, and enforce a per-request token budget outside the loop.
References: https://openai.github.io/openai-agents-js/guides/running-agents/ · https://raw.githubusercontent.com/openai/openai-agents-js/main/packages/agents-core/src/run.ts
keryn.agents2026.openai-agents-js-tool-execute-command-exec
Section titled “keryn.agents2026.openai-agents-js-tool-execute-command-exec”error typescript, javascript data-flow rule openai-agents-js
A tool() execute handler passes a model-supplied argument to child_process, eval or Function. A prompt-injected model can run arbitrary commands; use an allow-listed command table and execFile with a fixed argv.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-78 CWE-94 LLM06 LLM05 ASI02 ASI05
Fix: Constrain the parameter with z.enum(…), map it to a fixed command, and call execFile with an argv array; never build shell strings from tool input.
References: https://openai.github.io/openai-agents-js/guides/tools/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as src/tools.tsx and scan it with keryn scan src --verbose; the finding below appears.
import { tool } from "@openai/agents";import { execSync } from "node:child_process";import { z } from "zod";
export const pingHost = tool({ name: "ping_host", description: "Ping a host to check connectivity", parameters: z.object({ host: z.string() }), execute: async ({ host }) => { const out = execSync(`ping -c 2 ${host}`, { timeout: 15000 }); return out.toString(); },});Checked with Keryn’s browser engine when this page was built: it reports keryn.agents2026.openai-agents-js-tool-execute-command-exec at line 10 (error, proof 2). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.agents2026.openai-agents-js-tool-execute-file-or-network
Section titled “keryn.agents2026.openai-agents-js-tool-execute-file-or-network”warning typescript, javascript data-flow rule openai-agents-js
A tool() execute handler uses a model-supplied argument as a file path or request URL. The model (or injected content) can read or write arbitrary files or reach internal hosts; confine the path and allow-list hosts.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Resolve paths against a fixed base directory and reject traversal; parse URLs and compare the host to an allow-list before fetching.
References: https://openai.github.io/openai-agents-js/guides/tools/
keryn.agents2026.openai-agents-js-powerful-tool-no-input-guardrails
Section titled “keryn.agents2026.openai-agents-js-powerful-tool-no-input-guardrails”warning typescript, javascript openai-agents-js
Agent is given a computer, shell, patch or code-interpreter tool but no inputGuardrails. Untrusted user text goes directly to an agent that can act on the machine; add input guardrails and tool approval.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-862 CWE-77 LLM06 ASI02 ASI05
Fix: Add inputGuardrails: […] that screen requests before the agent runs, sandbox the shell or computer environment, and require approval (needsApproval) on the tool.
References: https://openai.github.io/openai-agents-js/guides/guardrails/ · https://openai.github.io/openai-agents-js/guides/tools/
keryn.agents2026.openai-agents-js-stop-on-first-tool-raw-output
Section titled “keryn.agents2026.openai-agents-js-stop-on-first-tool-raw-output”warning typescript, javascript openai-agents-js
Agent uses toolUseBehavior: ‘stop_on_first_tool’, so the first tool’s raw output becomes the final answer shown to the user. Attacker text or secrets in that output reach the user and any renderer unreviewed.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Keep the default toolUseBehavior or use a stopAtToolNames list for tools whose output is already sanitised, and add an output guardrail before returning text to a renderer.
References: https://openai.github.io/openai-agents-js/guides/agents/ · https://raw.githubusercontent.com/openai/openai-agents-js/main/packages/agents-core/src/agent.ts
keryn.agents2026.claude-agent-sdk-ts-bypass-permissions
Section titled “keryn.agents2026.claude-agent-sdk-ts-bypass-permissions”error typescript, javascript claude-agent-sdk
Claude Agent SDK options use permissionMode ‘bypassPermissions’ (or allowDangerouslySkipPermissions), so every tool call executes without a permission check. A prompt-injected session gets the host’s authority; use a restrictive mode with canUseTool or hooks.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: grants authority is given or left unchecked.
CWE-862 CWE-269 LLM06 ASI03 ASI09
Fix: Use permissionMode ‘default’ or ‘acceptEdits’ with an explicit allowedTools list and a canUseTool callback; run unavoidable bypass sessions only in a disposable container without credentials.
References: https://code.claude.com/docs/en/agent-sdk/permissions · https://code.claude.com/docs/en/agent-sdk/typescript · https://code.claude.com/docs/en/agent-sdk/typescript
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as src/runner.tsx and scan it with keryn scan src --verbose; the finding below appears.
import { query } from "@anthropic-ai/claude-agent-sdk";
export async function fixTests(dir: string) { for await (const message of query({ prompt: "Make the test suite pass", options: { cwd: dir, maxTurns: 15, permissionMode: "bypassPermissions", allowedTools: ["Read", "Edit", "Bash"], }, })) { if (message.type === "result") console.log(message); }}Checked with Keryn’s browser engine when this page was built: it reports keryn.agents2026.claude-agent-sdk-ts-bypass-permissions at line 9 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.agents2026.claude-agent-sdk-ts-allowed-tools-bash-wildcard
Section titled “keryn.agents2026.claude-agent-sdk-ts-allowed-tools-bash-wildcard”warning typescript, javascript claude-agent-sdk
allowedTools pre-approves unscoped Bash or a wildcard, so those tools run without prompting. Scope Bash to command prefixes such as Bash(git status:*) and list MCP tools individually.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: grants authority is given or left unchecked.
CWE-269 CWE-78 LLM06 ASI02 ASI03
Fix: Replace ‘Bash’, ‘*’ and ‘mcp__server__*’ with exact tool names or Bash(<prefix>:*) rules and use disallowedTools for explicit denials.
References: https://code.claude.com/docs/en/agent-sdk/permissions
keryn.agents2026.claude-agent-sdk-ts-cwd-root-or-home
Section titled “keryn.agents2026.claude-agent-sdk-ts-cwd-root-or-home”warning typescript, javascript claude-agent-sdk
Claude Agent SDK cwd is the filesystem root or home directory, so file tools can reach SSH keys, shell profiles and other projects. Point cwd at a dedicated workspace directory.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another.
Fix: Create a per-task scratch directory, use it as cwd, and run the agent as an unprivileged user in a container.
References: https://code.claude.com/docs/en/agent-sdk/typescript
keryn.agents2026.mastra-createtool-no-inputschema
Section titled “keryn.agents2026.mastra-createtool-no-inputschema”warning typescript, javascript mastra
Mastra createTool has no inputSchema, so the model’s arguments reach execute unvalidated. Define a Zod inputSchema with tight types, lengths and enums.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: reads one thing reads from another.
Fix: Add inputSchema: z.object({…}) using enums, regex and max lengths for every field the model controls.
References: https://mastra.ai/docs/agents/tools · https://mastra.ai/reference/agents/agent
keryn.agents2026.mastra-tool-execute-command-exec
Section titled “keryn.agents2026.mastra-tool-execute-command-exec”warning typescript, javascript data-flow rule mastra
A Mastra createTool execute handler passes model-supplied input to child_process, eval or Function. A prompt-injected model can run arbitrary commands; use an allow-listed command table and a fixed argv.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-78 CWE-94 LLM06 LLM05 ASI02 ASI05
Fix: Constrain fields with z.enum, map to fixed commands, and use execFile with an argv array; never concatenate tool input into a shell string.
References: https://mastra.ai/docs/agents/tools · https://mastra.ai/reference/agents/agent
keryn.agents2026.mastra-tool-execute-file-db-network
Section titled “keryn.agents2026.mastra-tool-execute-file-db-network”warning typescript, javascript data-flow rule mastra
A Mastra createTool execute handler uses model-supplied input as a file path, URL or raw SQL. Injected content can steer these; confine paths, allow-list hosts and bind SQL parameters.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-22 CWE-89 CWE-918 LLM06 LLM05 ASI02
Fix: Use parameterised queries with a read-only role, resolve file paths against a base directory, and validate URL hosts before fetching.
References: https://mastra.ai/docs/agents/tools · https://mastra.ai/reference/agents/agent
keryn.agents2026.mastra-agent-call-write-tools-no-maxsteps
Section titled “keryn.agents2026.mastra-agent-call-write-tools-no-maxsteps”warning typescript, javascript mastra
A Mastra agent that owns write, delete, shell or send tools is called via generate/stream without maxSteps. Cap tool-calling steps per call; the library default is permissive for write-capable agents.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: grants authority is given or left unchecked.
CWE-770 LLM10 LLM06 ASI08 ASI02
Fix: Pass { maxSteps: <small n> } to generate/stream (or set it in the agent’s default options) and require approval for write-capable tools.
References: https://mastra.ai/docs/agents/overview · https://mastra.ai/reference/agents/generate · https://mastra.ai/reference/agents/agent
keryn.agents2026.vercelai-v5-stopwhen-excessive-steps
Section titled “keryn.agents2026.vercelai-v5-stopwhen-excessive-steps”warning typescript, javascript vercel-ai-sdk
stopWhen allows fifty or more tool-calling steps, or never stops (() => false). Each step is a billed model call that can run tools; bound agent loops tightly.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Use stopWhen: stepCountIs(<small n>) (or hasToolCall for terminal tools) sized for the task and add a per-request token or cost budget.
References: https://ai-sdk.dev/docs/agents/loop-control · https://registry.npmjs.org/ai/-/ai-5.0.100.tgz
keryn.agents2026.vercelai-tool-needsapproval-disabled-destructive
Section titled “keryn.agents2026.vercelai-tool-needsapproval-disabled-destructive”warning typescript, javascript vercel-ai-sdk
A destructive-sounding AI SDK tool explicitly sets needsApproval: false, so the model can run it without a human decision. Require approval for tools with side effects.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Set needsApproval: true (or an async predicate that approves read-only inputs) for delete, write, send, payment and shell tools and surface the approval request in the UI.
References: https://ai-sdk.dev/docs/foundations/tools · https://registry.npmjs.org/ai/-/ai-6.0.315.tgz
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as src/tools.tsx and scan it with keryn scan src --verbose; the finding below appears.
import { tool } from "ai";import { z } from "zod";import { db } from "./db";
export const tools = { deleteProject: tool({ description: "Delete a project and all of its files", inputSchema: z.object({ projectId: z.string() }), needsApproval: false, execute: async ({ projectId }) => { await db.projects.delete({ where: { id: projectId } }); return { deleted: projectId }; }, }),};Checked with Keryn’s browser engine when this page was built: it reports keryn.agents2026.vercelai-tool-needsapproval-disabled-destructive at line 6 (warning, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.agents2026.vercelai-tool-permissive-input-schema
Section titled “keryn.agents2026.vercelai-tool-permissive-input-schema”warning typescript, javascript vercel-ai-sdk
An AI SDK tool declares a permissive input schema (z.any, z.unknown or a passthrough object), so the model’s arguments reach execute unchecked. Describe the real shape with a strict schema.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Replace z.any()/z.unknown() with z.object({…}) using enums, formats and max lengths for every field the model sets.
References: https://ai-sdk.dev/docs/foundations/tools
keryn.agents2026.genkit-definetool-no-inputschema
Section titled “keryn.agents2026.genkit-definetool-no-inputschema”warning typescript, javascript genkit
Genkit defineTool has no inputSchema, so the model’s tool arguments are not validated before the handler runs. Add a Zod inputSchema with tight types.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: reads one thing reads from another.
Fix: Pass inputSchema: z.object({…}) in the tool config, using enums and max lengths for model-controlled fields.
References: https://genkit.dev/docs/js/tool-calling/ · https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/tool.ts
keryn.agents2026.genkit-generate-tools-no-maxturns
Section titled “keryn.agents2026.genkit-generate-tools-no-maxturns”warning typescript, javascript genkit
Genkit generate is called with tools but without maxTurns, relying on the default tool-call loop limit. Set an explicit maxTurns for the task.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: grants authority is given or left unchecked.
Fix: Pass maxTurns: <small n> to ai.generate when tools are supplied and cap tokens with config.maxOutputTokens.
References: https://genkit.dev/docs/js/tool-calling/ · https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/generate.ts
keryn.agents2026.genkit-definetool-handler-command-exec
Section titled “keryn.agents2026.genkit-definetool-handler-command-exec”error typescript, javascript data-flow rule genkit
A Genkit defineTool handler passes the model’s tool input to child_process, eval or Function. A prompt-injected model can run arbitrary commands; use an allow-listed command table.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-78 CWE-94 LLM06 LLM05 ASI02 ASI05
Fix: Constrain the input with z.enum, map it to a fixed command and call execFile with an argv array.
References: https://genkit.dev/docs/js/tool-calling/ · https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/tool.ts
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as src/tools.tsx and scan it with keryn scan src --verbose; the finding below appears.
import { genkit, z } from "genkit";import { execSync } from "node:child_process";
const ai = genkit({ plugins: [] });
export const gitLog = ai.defineTool( { name: "gitLog", description: "Show recent commits for a branch", inputSchema: z.object({ branch: z.string() }), outputSchema: z.string(), }, async ({ branch }) => { return execSync(`git log --oneline -n 10 ${branch}`).toString(); },);Checked with Keryn’s browser engine when this page was built: it reports keryn.agents2026.genkit-definetool-handler-command-exec at line 14 (error, proof 2). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.agents2026.langgraphjs-react-agent-destructive-tools-no-interrupt
Section titled “keryn.agents2026.langgraphjs-react-agent-destructive-tools-no-interrupt”warning typescript, javascript langgraph-js
createReactAgent is given shell, file-write or delete tools without interruptBefore, so the model’s tool calls execute without a human checkpoint. Add a checkpointer and interruptBefore: [‘tools’] or an approval inside the tool.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: grants authority is given or left unchecked.
Fix: Pass checkpointer and interruptBefore: [‘tools’] (or call interrupt() inside the tool) and resume only with an authenticated approval.
References: https://langchain-ai.github.io/langgraphjs/concepts/human_in_the_loop/ · https://raw.githubusercontent.com/langchain-ai/langgraphjs/main/libs/langgraph-core/src/prebuilt/react_agent_executor.ts