# agent-frameworks-2026-ts-v1

> agent-frameworks-2026-ts-v1: 19 Keryn rules for typescript, javascript (3 error, 16 warning).

Source: https://keryn.dev/rules/agent-frameworks-2026-ts-v1/

19 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do 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

`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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI08](https://keryn.dev/taxonomies/owasp-agentic/#asi08-cascading-failures)

**Fix:** Pass &#123; maxTurns: &lt;small bound&gt; &#125; 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://openai.github.io/openai-agents-js/guides/running-agents/) · [https://raw.githubusercontent.com/openai/openai-agents-js/main/packages/agents-core/src/run.ts](https://raw.githubusercontent.com/openai/openai-agents-js/main/packages/agents-core/src/run.ts)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**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/](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.

```tsx
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](https://keryn.dev/playground/) shows what does.

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-22](https://keryn.dev/taxonomies/cwe/#cwe-22-path-traversal) [CWE-918](https://keryn.dev/taxonomies/cwe/#cwe-918-server-side-request-forgery) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**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/](https://openai.github.io/openai-agents-js/guides/tools/)

## 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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [CWE-77](https://keryn.dev/taxonomies/cwe/#cwe-77-command-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**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/guardrails/) · [https://openai.github.io/openai-agents-js/guides/tools/](https://openai.github.io/openai-agents-js/guides/tools/)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [CWE-200](https://keryn.dev/taxonomies/cwe/#cwe-200-exposure-of-sensitive-information-to-an-unauthorized-actor) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**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://openai.github.io/openai-agents-js/guides/agents/) · [https://raw.githubusercontent.com/openai/openai-agents-js/main/packages/agents-core/src/agent.ts](https://raw.githubusercontent.com/openai/openai-agents-js/main/packages/agents-core/src/agent.ts)

## 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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [CWE-269](https://keryn.dev/rules/?cwe=CWE-269) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation)

**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/permissions) · [https://code.claude.com/docs/en/agent-sdk/typescript](https://code.claude.com/docs/en/agent-sdk/typescript) · [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.

```tsx
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](https://keryn.dev/playground/) shows what does.

## 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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-269](https://keryn.dev/rules/?cwe=CWE-269) [CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Replace 'Bash', '\*' and 'mcp\_\_server\_\_\*' with exact tool names or Bash(&lt;prefix&gt;:\*) rules and use disallowedTools for explicit denials.

**References:** [https://code.claude.com/docs/en/agent-sdk/permissions](https://code.claude.com/docs/en/agent-sdk/permissions)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-732](https://keryn.dev/rules/?cwe=CWE-732) [CWE-22](https://keryn.dev/taxonomies/cwe/#cwe-22-path-traversal) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**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](https://code.claude.com/docs/en/agent-sdk/typescript)

## 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](https://keryn.dev/docs/edges/edge-kinds/#reads) one thing reads from another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Add inputSchema: z.object(&#123;...&#125;) using enums, regex and max lengths for every field the model controls.

**References:** [https://mastra.ai/docs/agents/tools](https://mastra.ai/docs/agents/tools) · [https://mastra.ai/reference/agents/agent](https://mastra.ai/reference/agents/agent)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**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/docs/agents/tools) · [https://mastra.ai/reference/agents/agent](https://mastra.ai/reference/agents/agent)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-22](https://keryn.dev/taxonomies/cwe/#cwe-22-path-traversal) [CWE-89](https://keryn.dev/taxonomies/cwe/#cwe-89-sql-injection) [CWE-918](https://keryn.dev/taxonomies/cwe/#cwe-918-server-side-request-forgery) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**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/docs/agents/tools) · [https://mastra.ai/reference/agents/agent](https://mastra.ai/reference/agents/agent)

## 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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI08](https://keryn.dev/taxonomies/owasp-agentic/#asi08-cascading-failures) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Pass &#123; maxSteps: &lt;small n&gt; &#125; 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/docs/agents/overview) · [https://mastra.ai/reference/agents/generate](https://mastra.ai/reference/agents/generate) · [https://mastra.ai/reference/agents/agent](https://mastra.ai/reference/agents/agent)

## keryn.agents2026.vercelai-v5-stopwhen-excessive-steps

`warning` typescript, javascript vercel-ai-sdk

stopWhen allows fifty or more tool-calling steps, or never stops (() =&gt; 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI08](https://keryn.dev/taxonomies/owasp-agentic/#asi08-cascading-failures)

**Fix:** Use stopWhen: stepCountIs(&lt;small n&gt;) (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://ai-sdk.dev/docs/agents/loop-control) · [https://registry.npmjs.org/ai/-/ai-5.0.100.tgz](https://registry.npmjs.org/ai/-/ai-5.0.100.tgz)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**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://ai-sdk.dev/docs/foundations/tools) · [https://registry.npmjs.org/ai/-/ai-6.0.315.tgz](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.

```tsx
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](https://keryn.dev/playground/) shows what does.

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Replace z.any()/z.unknown() with z.object(&#123;...&#125;) using enums, formats and max lengths for every field the model sets.

**References:** [https://ai-sdk.dev/docs/foundations/tools](https://ai-sdk.dev/docs/foundations/tools)

## 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](https://keryn.dev/docs/edges/edge-kinds/#reads) one thing reads from another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Pass inputSchema: z.object(&#123;...&#125;) in the tool config, using enums and max lengths for model-controlled fields.

**References:** [https://genkit.dev/docs/js/tool-calling/](https://genkit.dev/docs/js/tool-calling/) · [https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/tool.ts](https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/tool.ts)

## 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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI08](https://keryn.dev/taxonomies/owasp-agentic/#asi08-cascading-failures)

**Fix:** Pass maxTurns: &lt;small n&gt; to ai.generate when tools are supplied and cap tokens with config.maxOutputTokens.

**References:** [https://genkit.dev/docs/js/tool-calling/](https://genkit.dev/docs/js/tool-calling/) · [https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/generate.ts](https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/generate.ts)

## 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](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**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://genkit.dev/docs/js/tool-calling/) · [https://raw.githubusercontent.com/firebase/genkit/main/js/ai/src/tool.ts](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.

```tsx
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](https://keryn.dev/playground/) shows what does.

## 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](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation)

**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://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](https://raw.githubusercontent.com/langchain-ai/langgraphjs/main/libs/langgraph-core/src/prebuilt/react_agent_executor.ts)
