# agent-frameworks-2026-python-v1

> agent-frameworks-2026-python-v1: 33 Keryn rules for python (7 error, 26 warning).

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

33 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-runner-no-max-turns

`warning` python openai-agents

Runner.run / run\_sync / run\_streamed is called without max\_turns, so a looping or injected agent runs until the SDK default. Pass an explicit max\_turns sized for the task and handle MaxTurnsExceeded.

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 max\_turns=&lt;small bound&gt; to Runner.run\*, catch MaxTurnsExceeded, and add a per-request token or cost budget outside the agent loop.

**References:** [https://openai.github.io/openai-agents-python/running_agents/](https://openai.github.io/openai-agents-python/running_agents/)

## keryn.agents2026.openai-agents-function-tool-command-exec

`error` python data-flow rule openai-agents

A @function\_tool argument supplied by the model reaches subprocess, os.system, eval or exec. A prompt-injected model can run arbitrary commands or code; use a fixed argv with an allow-list and never evaluate model text.

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:** Do not pass model-controlled strings to a shell or interpreter. Map the argument to an allow-listed command table, pass a fixed argv list with shell=False, and require human approval for anything outside the table.

**References:** [https://openai.github.io/openai-agents-python/tools/](https://openai.github.io/openai-agents-python/tools/)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `agent/tools.py` and scan it with `keryn scan agent --verbose`; the finding below appears.

```python
import subprocess

from agents import Agent, function_tool

@function_tool
def disk_report(path: str) -> str:
    """Show disk usage for a directory on the build host."""
    result = subprocess.run(
        f"du -sh {path}", shell=True, capture_output=True, text=True, timeout=20
    )
    return result.stdout or result.stderr

ops_agent = Agent(
    name="ops-helper",
    instructions="Answer questions about build host health.",
    tools=[disk_report],
)
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.openai-agents-function-tool-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-function-tool-network-or-file

`warning` python data-flow rule openai-agents

A @function\_tool argument supplied by the model is used as an HTTP URL or file path. The model (or injected content) can reach internal hosts or read and write arbitrary files; validate the host or confine the path to a base directory.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

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

**Fix:** Resolve the path against a fixed base directory and reject traversal, or check the URL host against an allow-list and block private address ranges before issuing the request.

**References:** [https://openai.github.io/openai-agents-python/tools/](https://openai.github.io/openai-agents-python/tools/)

## keryn.agents2026.openai-agents-powerful-tool-no-input-guardrails

`warning` python openai-agents

Agent is given a computer, local shell, or code interpreter tool but no input\_guardrails. Untrusted user text goes straight to an agent that can act on the machine; add input guardrails and a tool approval step.

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:** Attach input\_guardrails=[...] that screen the request before the agent runs, run shell and computer tools in a sandbox, and gate them behind human approval.

**References:** [https://openai.github.io/openai-agents-python/guardrails/](https://openai.github.io/openai-agents-python/guardrails/) · [https://openai.github.io/openai-agents-python/tools/](https://openai.github.io/openai-agents-python/tools/)

## keryn.agents2026.openai-agents-web-search-with-write-tools

`warning` python openai-agents

Agent combines WebSearchTool (attacker-influenced content) with write-capable tools and has no input\_guardrails. Injected web content can steer the write tools; separate retrieval from action or require approval.

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

[CWE-1427](https://keryn.dev/taxonomies/cwe/#cwe-1427-improper-neutralization-of-input-used-for-llm-prompting) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Split the agent: a read-only research agent with WebSearchTool hands back a structured summary to an agent that owns write tools, and put approval or guardrails in front of the write tools.

**References:** [https://openai.github.io/openai-agents-python/tools/](https://openai.github.io/openai-agents-python/tools/) · [https://openai.github.io/openai-agents-python/guardrails/](https://openai.github.io/openai-agents-python/guardrails/)

## keryn.agents2026.openai-agents-handoff-to-shell-agent

`warning` python openai-agents

Agent hands off to another agent that owns shell, computer, or file-write tools. A handoff transfers the conversation, so injected content in the first agent can drive the privileged one; gate the handoff or the tools.

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-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) [ASI07](https://keryn.dev/taxonomies/owasp-agentic/#asi07-insecure-inter-agent-communication)

**Fix:** Keep shell and file-write tools on an agent that is not reachable by handoff from agents exposed to untrusted input, or add an on\_handoff callback that checks authorisation and require tool approval on the target agent.

**References:** [https://openai.github.io/openai-agents-python/handoffs/](https://openai.github.io/openai-agents-python/handoffs/) · [https://openai.github.io/openai-agents-python/tools/](https://openai.github.io/openai-agents-python/tools/)

## keryn.agents2026.openai-agents-stop-on-first-tool-raw-output

`warning` python openai-agents

Agent uses tool\_use\_behavior="stop\_on\_first\_tool", so the first tool's raw output becomes the final answer shown to the user without a model pass. Tool output that contains attacker text or secrets is relayed unreviewed; sanitise it or let the model respond.

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:** Use the default tool\_use\_behavior (or a StopAtTools list for tools whose output is already sanitised) and run an output guardrail before returning tool output to the user or a renderer.

**References:** [https://openai.github.io/openai-agents-python/agents/](https://openai.github.io/openai-agents-python/agents/)

## keryn.agents2026.claude-agent-sdk-bypass-permissions

`error` python claude-agent-sdk

Claude Agent SDK runs with permission\_mode="bypassPermissions", so every tool call (Bash, Write, MCP) executes without a permission check. A prompt-injected session gets the host's full authority; use a restrictive mode plus can\_use\_tool 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 permission\_mode="default" or "acceptEdits" with an explicit allowed\_tools list and a can\_use\_tool callback, and run unavoidable bypass sessions only inside a disposable container with no 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/python](https://code.claude.com/docs/en/agent-sdk/python) · [https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md](https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md) · [https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/src/claude_agent_sdk/client.py](https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/src/claude_agent_sdk/client.py)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `run_agent.py` and scan it with `keryn scan run_agent.py --verbose`; the finding below appears.

```python
import asyncio

from claude_agent_sdk import ClaudeAgentOptions, query

async def main() -> None:
    options = ClaudeAgentOptions(
        cwd="./workspace",
        allowed_tools=["Read", "Edit", "Bash"],
        permission_mode="bypassPermissions",
        max_turns=12,
    )
    async for message in query(prompt="Fix the failing unit tests", options=options):
        print(message)

if __name__ == "__main__":
    asyncio.run(main())
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.claude-agent-sdk-bypass-permissions` at line 7 (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-allowed-tools-bash-wildcard

`warning` python claude-agent-sdk

allowed\_tools pre-approves unscoped Bash or a wildcard, so those tools run without prompting. Scope Bash to specific 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, keep destructive tools out of allowed\_tools, and use disallowed\_tools for explicit denials.

**References:** [https://code.claude.com/docs/en/agent-sdk/permissions](https://code.claude.com/docs/en/agent-sdk/permissions) · [https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md](https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md)

## keryn.agents2026.claude-agent-sdk-cwd-root-or-home

`warning` python claude-agent-sdk

ClaudeAgentOptions sets cwd to the filesystem root or the home directory, so file tools can read and write 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, set cwd to it, and run the agent as an unprivileged user in a container or sandbox so file tools cannot reach credentials.

**References:** [https://code.claude.com/docs/en/agent-sdk/python](https://code.claude.com/docs/en/agent-sdk/python) · [https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md](https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md)

## keryn.agents2026.claude-agent-sdk-hook-runs-shell-from-tool-input

`error` python data-flow rule claude-agent-sdk

A Claude Agent SDK hook callback (input\_data, tool\_use\_id, context) passes data from the tool call into a shell or eval. The hook sees model-controlled tool input, so this is command injection from inside the guard.

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-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) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Inspect tool\_input with Python code (parse and compare), never interpolate it into a shell string. If an external checker is required, invoke it with a fixed argv and the data on stdin.

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

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `hooks.py` and scan it with `keryn scan hooks.py --verbose`; the finding below appears.

```python
import subprocess

from claude_agent_sdk import ClaudeAgentOptions, HookMatcher

async def lint_before_write(input_data, tool_use_id, context):
    target = input_data.get("tool_input", {}).get("file_path", "")
    check = subprocess.run(
        "ruff check " + target, shell=True, capture_output=True, text=True
    )
    if check.returncode != 0:
        return {"decision": "block", "reason": check.stdout}
    return {}

options = ClaudeAgentOptions(
    hooks={"PreToolUse": [HookMatcher(matcher="Write", hooks=[lint_before_write])]}
)
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.claude-agent-sdk-hook-runs-shell-from-tool-input` at line 9 (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.claude-agent-sdk-can-use-tool-always-allows

`warning` python claude-agent-sdk

can\_use\_tool callback unconditionally returns PermissionResultAllow, so it approves every tool call and gives a false impression of a permission gate. Inspect tool\_name and input before allowing.

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) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Return PermissionResultDeny for tools and inputs outside an allow-list (for example Bash commands not matching a fixed prefix), and route sensitive tools to a human prompt.

**References:** [https://code.claude.com/docs/en/agent-sdk/permissions](https://code.claude.com/docs/en/agent-sdk/permissions) · [https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/src/claude_agent_sdk/types.py](https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/src/claude_agent_sdk/types.py) · [https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md](https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md)

## keryn.agents2026.google-adk-unsafe-local-code-executor

`error` python google-adk

UnsafeLocalCodeExecutor runs model-generated Python inside the agent's own process with its credentials and filesystem. Use a container or hosted sandbox executor instead.

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-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) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**Fix:** Switch to ContainerCodeExecutor, VertexAiCodeExecutor or BuiltInCodeExecutor (provider sandbox) and never run generated code in the application process.

**References:** [https://adk.dev/tools/built-in-tools/](https://adk.dev/tools/built-in-tools/) · [https://adk.dev/agents/llm-agents/](https://adk.dev/agents/llm-agents/) · [https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/code_executors/unsafe_local_code_executor.py](https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/code_executors/unsafe_local_code_executor.py)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `analyst/agent.py` and scan it with `keryn scan analyst --verbose`; the finding below appears.

```python
from google.adk.agents import LlmAgent
from google.adk.code_executors import UnsafeLocalCodeExecutor

root_agent = LlmAgent(
    name="data_analyst",
    model="gemini-2.0-flash",
    instruction="Answer questions about the sales CSV by writing and running Python.",
    code_executor=UnsafeLocalCodeExecutor(),
)
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.google-adk-unsafe-local-code-executor` at line 8 (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.google-adk-code-executor-no-callbacks

`warning` python google-adk

LlmAgent has a code\_executor but no before\_model\_callback or before\_tool\_callback, so user text reaches a code-running agent with no screening step. Add a callback that checks the request, or restrict who can reach the agent.

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: [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-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Register before\_model\_callback to screen prompts and before\_tool\_callback to validate tool arguments, and run the executor in a sandbox with no network or secrets.

**References:** [https://adk.dev/callbacks/](https://adk.dev/callbacks/) · [https://adk.dev/agents/llm-agents/](https://adk.dev/agents/llm-agents/) · [https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/code_executors/unsafe_local_code_executor.py](https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/code_executors/unsafe_local_code_executor.py) · [https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py](https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py)

## keryn.agents2026.google-adk-tool-function-shell-or-file-write

`warning` python google-adk

A plain function that runs a shell command or writes/deletes files is registered as an ADK tool. The model chooses its arguments, so any injected instruction can run commands or alter files; validate arguments and add before\_tool\_callback 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: [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-73](https://keryn.dev/taxonomies/cwe/#cwe-73-external-control-of-file-name-or-path) [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:** Expose narrow, parameter-checked functions (fixed command table, base-directory confinement) and use before\_tool\_callback to reject calls that fail policy or need human sign-off.

**References:** [https://adk.dev/tools/function-tools/](https://adk.dev/tools/function-tools/) · [https://adk.dev/callbacks/](https://adk.dev/callbacks/) · [https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py](https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py)

## keryn.agents2026.google-adk-agenttool-no-before-tool-callback

`warning` python google-adk

LlmAgent exposes another agent through AgentTool without before\_tool\_callback. A delegated sub-agent's tools become reachable from this agent's prompt, and no hook checks the delegated call.

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

[CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI07](https://keryn.dev/taxonomies/owasp-agentic/#asi07-insecure-inter-agent-communication) [ASI08](https://keryn.dev/taxonomies/owasp-agentic/#asi08-cascading-failures) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Add before\_tool\_callback to the parent agent to validate delegated requests, keep privileged tools on sub-agents the parent cannot invoke with untrusted text, and cap delegation depth.

**References:** [https://adk.dev/tools/function-tools/](https://adk.dev/tools/function-tools/) · [https://adk.dev/callbacks/](https://adk.dev/callbacks/) · [https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py](https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py)

## keryn.agents2026.pydantic-ai-tool-argument-to-exec

`error` python data-flow rule pydantic-ai

A Pydantic AI tool parameter (chosen by the model) reaches subprocess, os.system, eval or exec. Tool arguments are validated only for type, not for safety; use an allow-listed command table and 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 a Literal or Enum type, map it to a fixed command, and pass an argv list with shell=False. Raise ModelRetry for values outside the allow-list.

**References:** [https://pydantic.dev/docs/ai/tools-toolsets/tools/](https://pydantic.dev/docs/ai/tools-toolsets/tools/)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `app/agent.py` and scan it with `keryn scan app --verbose`; the finding below appears.

```python
import subprocess

from pydantic_ai import Agent

agent = Agent("openai:gpt-4o", system_prompt="You help engineers inspect logs.")

@agent.tool_plain
def tail_log(service: str) -> str:
    """Return the last lines of a service log."""
    out = subprocess.run(
        f"tail -n 50 /var/log/{service}.log",
        shell=True,
        capture_output=True,
        text=True,
    )
    return out.stdout
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.pydantic-ai-tool-argument-to-exec` at line 12 (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.pydantic-ai-tool-argument-to-sql-or-file

`warning` python data-flow rule pydantic-ai

A Pydantic AI tool parameter (chosen by the model) is used as a SQL string or file path. Injected content can make the model emit SQL or traversal paths; bind parameters and confine paths.

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-89](https://keryn.dev/taxonomies/cwe/#cwe-89-sql-injection) [CWE-22](https://keryn.dev/taxonomies/cwe/#cwe-22-path-traversal) [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:** Expose parameterised queries (named query ids with bound values) rather than raw SQL, use a read-only database role, and resolve file paths against a fixed base directory before opening.

**References:** [https://pydantic.dev/docs/ai/tools-toolsets/tools/](https://pydantic.dev/docs/ai/tools-toolsets/tools/)

## keryn.agents2026.pydantic-ai-excessive-retries

`warning` python pydantic-ai

Pydantic AI retries are set to ten or more, so a failing or adversarial tool/validator loop re-calls the model that many times per run. Keep retries low and cap total requests with UsageLimits.

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.

[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 retries between 1 and 3 and pass usage\_limits=UsageLimits(request\_limit=..., tool\_calls\_limit=...) to every run.

**References:** [https://pydantic.dev/docs/ai/core-concepts/agent/](https://pydantic.dev/docs/ai/core-concepts/agent/) · [https://pydantic.dev/docs/ai/tools-toolsets/tools/](https://pydantic.dev/docs/ai/tools-toolsets/tools/) · [https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/__init__.py](https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/__init__.py)

## keryn.agents2026.pydantic-ai-run-with-tools-no-usage-limits

`warning` python pydantic-ai

Agent that registers @agent.tool functions is run without usage\_limits, so request and tool-call counts rely only on library defaults. Pass UsageLimits sized 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:** Call agent.run\*/run\_sync with usage\_limits=UsageLimits(request\_limit=&lt;n&gt;, tool\_calls\_limit=&lt;m&gt;, total\_tokens\_limit=&lt;t&gt;).

**References:** [https://pydantic.dev/docs/ai/core-concepts/agent/](https://pydantic.dev/docs/ai/core-concepts/agent/) · [https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/__init__.py](https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/__init__.py)

## keryn.agents2026.pydantic-ai-instrument-prompts-to-exporter

`warning` python pydantic-ai, logfire, opentelemetry

Pydantic AI instrumentation is on and full prompt and completion content is not disabled, so every prompt, tool argument and tool result is exported to the tracing backend (Logfire or any OTLP endpoint). Set include\_content=False or scrub before export.

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

[CWE-532](https://keryn.dev/taxonomies/cwe/#cwe-532-insertion-of-sensitive-information-into-log-file) [CWE-201](https://keryn.dev/rules/?cwe=CWE-201) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning)

**Fix:** Use InstrumentationSettings(include\_content=False) for production, scrub PII with the Logfire scrubbing options, and send traces only to a backend with the same data-handling approval as your prompt store.

**References:** [https://pydantic.dev/docs/ai/integrations/logfire/](https://pydantic.dev/docs/ai/integrations/logfire/) · [https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/__init__.py](https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/__init__.py)

## keryn.agents2026.strands-agent-dangerous-community-tool

`warning` python strands-agents

Strands Agent is given python\_repl, shell, file\_write, editor, or another host-level community tool. The model can execute code or modify files; keep tool consent enabled, sandbox the host, and narrow the toolset.

Confidence **P1**: dangerous in context. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [CWE-732](https://keryn.dev/rules/?cwe=CWE-732) [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:** Remove host-level tools from agents that process untrusted input, or run the agent in a container; leave tool consent prompts on and write custom tools that expose only the operations the task needs.

**References:** [https://strandsagents.com/latest/documentation/docs/user-guide/concepts/tools/community-tools-package/](https://strandsagents.com/latest/documentation/docs/user-guide/concepts/tools/community-tools-package/) · [https://github.com/strands-agents/tools](https://github.com/strands-agents/tools) · [https://raw.githubusercontent.com/strands-agents/tools/main/README.md](https://raw.githubusercontent.com/strands-agents/tools/main/README.md)

## keryn.agents2026.strands-bypass-tool-consent

`error` python strands-agents

BYPASS\_TOOL\_CONSENT is set to a truthy value, which turns off the confirmation prompt for Strands tools such as shell and file\_write. Do not set it where untrusted input can reach the agent.

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) [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:** Remove BYPASS\_TOOL\_CONSENT; keep human confirmation for shell, file\_write, python\_repl and editor, and use a sandbox if unattended execution is unavoidable.

**References:** [https://github.com/strands-agents/tools](https://github.com/strands-agents/tools) · [https://raw.githubusercontent.com/strands-agents/tools/main/src/strands_tools/shell.py](https://raw.githubusercontent.com/strands-agents/tools/main/src/strands_tools/shell.py)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `main.py` and scan it with `keryn scan main.py --verbose`; the finding below appears.

```python
import os

from strands import Agent
from strands_tools import file_write, shell

os.environ["BYPASS_TOOL_CONSENT"] = "true"

agent = Agent(tools=[shell, file_write])

if __name__ == "__main__":
    agent("Clean up the old release folders under ./releases")
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.strands-bypass-tool-consent` at line 6 (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.agentcore-payload-to-code-interpreter

`error` python data-flow rule bedrock-agentcore

The AgentCore entrypoint payload flows into a code interpreter session's executeCode or executeCommand call. Caller-supplied text becomes code run with the interpreter session's role; let the model write code only after policy checks, and scope the session role.

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

**Fix:** Never forward caller input as code. Have the agent generate code from a fixed task description, screen it, and run it in a code interpreter whose execution role has no access to production data or credentials.

**References:** [https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-tool.html](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-tool.html) · [https://raw.githubusercontent.com/aws/bedrock-agentcore-sdk-python/main/src/bedrock_agentcore/tools/code_interpreter_client.py](https://raw.githubusercontent.com/aws/bedrock-agentcore-sdk-python/main/src/bedrock_agentcore/tools/code_interpreter_client.py)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `app.py` and scan it with `keryn scan app.py --verbose`; the finding below appears.

```python
from bedrock_agentcore import BedrockAgentCoreApp
from bedrock_agentcore.tools.code_interpreter_client import CodeInterpreter

app = BedrockAgentCoreApp()

@app.entrypoint
def handler(payload):
    interpreter = CodeInterpreter("us-west-2")
    interpreter.start()
    result = interpreter.invoke(
        "executeCode",
        {"code": payload.get("snippet"), "language": "python"},
    )
    interpreter.stop()
    return {"result": result}

if __name__ == "__main__":
    app.run()
```

Checked with Keryn's browser engine when this page was built: it reports `keryn.agents2026.agentcore-payload-to-code-interpreter` at line 13 (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.agentcore-payload-to-browser-navigation

`warning` python data-flow rule bedrock-agentcore

The AgentCore entrypoint payload flows into a browser tool page.goto. A caller-chosen URL makes the cloud browser fetch internal or attacker pages; allow-list destinations.

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: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[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:** Parse the URL, compare the host to an allow-list of approved sites, and reject non-https schemes and private address ranges before navigating.

**References:** [https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-tool.html](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-tool.html) · [https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-quickstart.html](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-quickstart.html)

## keryn.agents2026.agentcore-entrypoint-passes-payload-unvalidated

`warning` python bedrock-agentcore

AgentCore @app.entrypoint handler passes payload fields straight to the agent with no visible schema validation, length limit or guardrail. Validate the payload shape and size before invoking the model.

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

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Parse the payload into a Pydantic model with max lengths, reject unknown fields, and apply a guardrail or classifier before calling the agent.

**References:** [https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html) · [https://raw.githubusercontent.com/aws/bedrock-agentcore-sdk-python/main/src/bedrock_agentcore/runtime/app.py](https://raw.githubusercontent.com/aws/bedrock-agentcore-sdk-python/main/src/bedrock_agentcore/runtime/app.py)

## keryn.agents2026.agent-framework-hosted-code-interpreter-no-middleware

`warning` python microsoft-agent-framework

Agent Framework agent has HostedCodeInterpreterTool but no middleware, so nothing inspects the code requests or results. Add function or agent middleware that logs and enforces policy.

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: [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-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [CWE-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Pass middleware=[...] that screens inputs and outputs, avoid attaching uploaded untrusted files to the interpreter session, and keep the session free of credentials.

**References:** [https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-tools](https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-tools) · [https://learn.microsoft.com/en-us/agent-framework/overview/](https://learn.microsoft.com/en-us/agent-framework/overview/)

## keryn.agents2026.agent-framework-ai-function-shell-without-approval

`warning` python microsoft-agent-framework

An Agent Framework @ai\_function that runs a shell, eval or destructive file operation does not set approval\_mode="always\_require" (the default never asks). The model can trigger it without a human decision.

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-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [CWE-78](https://keryn.dev/taxonomies/cwe/#cwe-78-os-command-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**Fix:** Set @ai\_function(approval\_mode="always\_require") for tools with side effects and handle the approval request in your UI before the call executes.

**References:** [https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-tools](https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-tools) · [https://learn.microsoft.com/en-us/agent-framework/overview/](https://learn.microsoft.com/en-us/agent-framework/overview/)

## keryn.agents2026.agent-framework-mcp-tool-never-require-approval

`warning` python microsoft-agent-framework, mcp

An Agent Framework MCP tool is configured with approval\_mode="never\_require", so every tool on that server runs without a human decision. Require approval for tools with side effects.

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: [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) [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:** Use approval\_mode="always\_require" or a per-tool map that lists only read-only tools under never\_require\_approval.

**References:** [https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-tools](https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-tools) · [https://learn.microsoft.com/en-us/agent-framework/overview/](https://learn.microsoft.com/en-us/agent-framework/overview/) · [https://pypi.org/project/agent-framework/](https://pypi.org/project/agent-framework/)

## keryn.agents2026.smolagents-authorized-imports-dangerous

`warning` python smolagents

CodeAgent authorizes a wildcard or os/subprocess/sys/shutil/socket imports, which removes the local interpreter's main guard against model-written code touching the host. Authorize only pure-computation modules.

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-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) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**Fix:** Limit additional\_authorized\_imports to modules such as math, statistics or pandas, and use executor\_type="docker", "e2b", "modal" or "wasm" when the agent needs broader access.

**References:** [https://huggingface.co/docs/smolagents/tutorials/secure_code_execution](https://huggingface.co/docs/smolagents/tutorials/secure_code_execution)

## keryn.agents2026.smolagents-executor-type-local-explicit

`warning` python smolagents

CodeAgent sets executor\_type="local", so model-written code runs in the host process (restricted interpreter only). Use docker, e2b, modal or wasm for untrusted tasks.

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-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**Fix:** Set executor\_type to a sandboxed backend and configure executor\_kwargs (network off, resource limits, no mounted secrets).

**References:** [https://huggingface.co/docs/smolagents/tutorials/secure_code_execution](https://huggingface.co/docs/smolagents/tutorials/secure_code_execution)

## keryn.agents2026.smolagents-codeagent-default-local-executor

`warning` python smolagents

CodeAgent is created without executor\_type, so it uses the default local executor and runs model-written code inside the host process. Choose a sandbox executor.

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: [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-94](https://keryn.dev/taxonomies/cwe/#cwe-94-code-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**Fix:** Pass executor\_type="docker" (or e2b, modal, wasm) and keep the executor free of credentials and network access where possible.

**References:** [https://huggingface.co/docs/smolagents/tutorials/secure_code_execution](https://huggingface.co/docs/smolagents/tutorials/secure_code_execution)

## keryn.agents2026.langgraph-react-agent-dangerous-tools-no-interrupt

`warning` python langgraph

create\_react\_agent is given shell, code, file-write or delete tools without interrupt\_before, so the model's tool calls execute without a human checkpoint. Add a checkpointer and interrupt\_before=["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:** Compile with checkpointer=&lt;saver&gt; and interrupt\_before=["tools"] (or call interrupt() inside the tool) and resume only with an authenticated approval.

**References:** [https://langchain-ai.github.io/langgraph/how-tos/human_in_the_loop/add-human-in-the-loop/](https://langchain-ai.github.io/langgraph/how-tos/human_in_the_loop/add-human-in-the-loop/)
