agent-frameworks-2026-python-v1
33 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-runner-no-max-turns
Section titled “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 authority is given or left unchecked.
Fix: Pass max_turns=<small bound> 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/
keryn.agents2026.openai-agents-function-tool-command-exec
Section titled “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 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: 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/
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.
import subprocess
from agents import Agent, function_tool
@function_tooldef 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 shows what does.
keryn.agents2026.openai-agents-function-tool-network-or-file
Section titled “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 content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
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/
keryn.agents2026.openai-agents-powerful-tool-no-input-guardrails
Section titled “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 authority is given or left unchecked.
CWE-862 CWE-77 LLM06 ASI02 ASI05
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/tools/
keryn.agents2026.openai-agents-web-search-with-write-tools
Section titled “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 one thing writes to another.
CWE-1427 LLM06 LLM01 ASI01 ASI02
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/guardrails/
keryn.agents2026.openai-agents-handoff-to-shell-agent
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
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/tools/
keryn.agents2026.openai-agents-stop-on-first-tool-raw-output
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
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/
keryn.agents2026.claude-agent-sdk-bypass-permissions
Section titled “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 authority is given or left unchecked.
CWE-862 CWE-269 LLM06 ASI03 ASI09
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/python · 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
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.
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 shows what does.
keryn.agents2026.claude-agent-sdk-allowed-tools-bash-wildcard
Section titled “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 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, 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://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md
keryn.agents2026.claude-agent-sdk-cwd-root-or-home
Section titled “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 one thing invokes another.
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://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/CHANGELOG.md
keryn.agents2026.claude-agent-sdk-hook-runs-shell-from-tool-input
Section titled “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 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 ASI05 ASI02
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/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.
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 shows what does.
keryn.agents2026.claude-agent-sdk-can-use-tool-always-allows
Section titled “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 authority is given or left unchecked.
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://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
keryn.agents2026.google-adk-unsafe-local-code-executor
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
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/agents/llm-agents/ · 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.
from google.adk.agents import LlmAgentfrom 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 shows what does.
keryn.agents2026.google-adk-code-executor-no-callbacks
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-94 CWE-862 LLM06 ASI05 ASI02
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/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/agents/llm_agent.py
keryn.agents2026.google-adk-tool-function-shell-or-file-write
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-78 CWE-73 LLM06 ASI02 ASI05
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/callbacks/ · https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py
keryn.agents2026.google-adk-agenttool-no-before-tool-callback
Section titled “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 one thing invokes another.
CWE-862 LLM06 ASI07 ASI08 ASI02
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/callbacks/ · https://raw.githubusercontent.com/google/adk-python/main/src/google/adk/agents/llm_agent.py
keryn.agents2026.pydantic-ai-tool-argument-to-exec
Section titled “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 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 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/
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.
import subprocess
from pydantic_ai import Agent
agent = Agent("openai:gpt-4o", system_prompt="You help engineers inspect logs.")
@agent.tool_plaindef 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.stdoutChecked 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 shows what does.
keryn.agents2026.pydantic-ai-tool-argument-to-sql-or-file
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-89 CWE-22 LLM06 LLM05 ASI02
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/
keryn.agents2026.pydantic-ai-excessive-retries
Section titled “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 one thing invokes another.
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/tools-toolsets/tools/ · 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
Section titled “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 authority is given or left unchecked.
Fix: Call agent.run*/run_sync with usage_limits=UsageLimits(request_limit=<n>, tool_calls_limit=<m>, total_tokens_limit=<t>).
References: https://pydantic.dev/docs/ai/core-concepts/agent/ · https://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/init.py
keryn.agents2026.pydantic-ai-instrument-prompts-to-exporter
Section titled “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 one thing reads from another.
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://raw.githubusercontent.com/pydantic/pydantic-ai/main/pydantic_ai_slim/pydantic_ai/agent/init.py
keryn.agents2026.strands-agent-dangerous-community-tool
Section titled “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 content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
CWE-94 CWE-78 CWE-732 LLM06 ASI02 ASI05
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://github.com/strands-agents/tools · https://raw.githubusercontent.com/strands-agents/tools/main/README.md
keryn.agents2026.strands-bypass-tool-consent
Section titled “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 authority is given or left unchecked.
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://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.
import os
from strands import Agentfrom 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 shows what does.
keryn.agents2026.agentcore-payload-to-code-interpreter
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-94 CWE-78 LLM06 LLM05 ASI05 ASI02
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://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.
from bedrock_agentcore import BedrockAgentCoreAppfrom bedrock_agentcore.tools.code_interpreter_client import CodeInterpreter
app = BedrockAgentCoreApp()
@app.entrypointdef 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 shows what does.
keryn.agents2026.agentcore-payload-to-browser-navigation
Section titled “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 content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
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-quickstart.html
keryn.agents2026.agentcore-entrypoint-passes-payload-unvalidated
Section titled “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 one thing invokes another.
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://raw.githubusercontent.com/aws/bedrock-agentcore-sdk-python/main/src/bedrock_agentcore/runtime/app.py
keryn.agents2026.agent-framework-hosted-code-interpreter-no-middleware
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-94 CWE-862 LLM06 ASI05 ASI02
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/overview/
keryn.agents2026.agent-framework-ai-function-shell-without-approval
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-862 CWE-78 LLM06 ASI09 ASI05
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/overview/
keryn.agents2026.agent-framework-mcp-tool-never-require-approval
Section titled “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 authority is given or left unchecked.
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/overview/ · https://pypi.org/project/agent-framework/
keryn.agents2026.smolagents-authorized-imports-dangerous
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
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
keryn.agents2026.smolagents-executor-type-local-explicit
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
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
keryn.agents2026.smolagents-codeagent-default-local-executor
Section titled “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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
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
keryn.agents2026.langgraph-react-agent-dangerous-tools-no-interrupt
Section titled “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 authority is given or left unchecked.
Fix: Compile with checkpointer=<saver> 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/