agentic-asi-2026-v1
46 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.
seceng.asi06.mem0-zep-letta-write-from-untrusted-python
Section titled “seceng.asi06.mem0-zep-letta-write-from-untrusted-python”warning python data-flow rule mem0, zep, letta, python
Content from a web fetch, retriever, tool result or another agent’s output is written into long-term agent memory (Mem0 / Zep / Letta) without provenance or validation. A single poisoned page or tool response then persists and steers every later session. Validate and label the source before the write, or store it as untrusted reference material instead of memory.
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: writes one thing writes to another.
CWE-345 CWE-20 LLM08 LLM01 ASI06
Fix: Treat tool output, retrieved documents, fetched pages and peer-agent output as untrusted. Before a memory write, run it through a validator (schema, injection classifier, size cap), attach source/provenance metadata (url, tool name, agent id, timestamp, hash), and keep it in a separate untrusted namespace that is never promoted to instructions without review.
References: https://docs.mem0.ai/open-source/python-quickstart · https://help.getzep.com/adding-messages · https://docs.letta.com/v1-sdk/memory/archival-memory · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://pypi.org/project/zep-cloud/2.0.0/ · https://pypi.org/project/letta-client/1.12.1/
seceng.asi06.langgraph-langchain-memory-write-from-untrusted-python
Section titled “seceng.asi06.langgraph-langchain-memory-write-from-untrusted-python”error python data-flow rule langgraph, langchain, python
Untrusted content (web fetch, retriever hit, tool result, peer-agent output) is persisted into LangGraph store/checkpoint state or LangChain chat memory without validation. Later turns read it back as trusted context, so a one-off injection becomes durable. Validate and provenance-tag before persisting.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
CWE-345 CWE-20 LLM08 LLM01 ASI06
Fix: Do not write raw tool/retrieval/web content into store.put, graph.update_state, checkpointers or chat history. Persist a validated, size-capped summary with source metadata ({"source": ..., "trust": "untrusted"}) and render it to the model as quoted data, never as instructions.
References: https://langchain-ai.github.io/langgraph/concepts/persistence/#memory-store · https://reference.langchain.com/python/langchain-core · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi06.memory-write-from-untrusted-ts
Section titled “seceng.asi06.memory-write-from-untrusted-ts”warning typescript data-flow rule mem0, zep, letta, langgraphjs, langchainjs, typescript
Content from fetch(), a retriever, a tool result or another agent’s output is written into agent memory (mem0ai, Zep, Letta, LangGraph.js store, LangChain.js chat history) without provenance or validation. Poisoned content then persists across sessions. Validate and label the source before the write.
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: writes one thing writes to another.
CWE-345 CWE-20 LLM08 LLM01 ASI06
Fix: Run untrusted content through a validator (schema, injection classifier, size cap) and attach source metadata before memory.add, memory.add(sessionId, ...), passages.create, store.put or addMessage; keep it in an untrusted namespace that is rendered to the model as data.
References: https://docs.mem0.ai/open-source/node-quickstart · https://help.getzep.com/adding-messages · https://docs.letta.com/v1-sdk/memory/archival-memory · https://langchain-ai.github.io/langgraphjs/concepts/persistence/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://pypi.org/project/zep-cloud/2.0.0/
seceng.asi06.memory-read-into-system-prompt-python
Section titled “seceng.asi06.memory-read-into-system-prompt-python”error python data-flow rule mem0, langgraph, langchain, python
Recalled long-term memory (Mem0 search, LangGraph store, LangChain memory variables) is placed in the system prompt or agent instructions. Memory is user/tool-influenced data; promoting it to system authority lets a poisoned memory override policy. Put recalled memory in a clearly delimited user/context block instead.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
CWE-345 CWE-1427 LLM01 LLM08 ASI06 ASI01
Fix: Keep the system prompt static and reviewed. Render recalled memories as quoted reference data in a user or tool-context message (e.g. inside <memories> tags with an instruction that they are untrusted), and filter memories by owner and provenance before use.
References: https://docs.mem0.ai/open-source/python-quickstart · https://langchain-ai.github.io/langgraph/concepts/memory/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as assistant/chat.py and scan it with keryn scan assistant --verbose; the finding below appears.
from anthropic import Anthropicfrom mem0 import Memory
client = Anthropic()memory = Memory()
def reply(user_id: str, question: str) -> str: hits = memory.search(question, user_id=user_id, limit=5) notes = "\n".join(h["memory"] for h in hits["results"]) resp = client.messages.create( model="claude-sonnet-4-5", max_tokens=600, system=f"You are a helpful assistant. What you remember about this user:\n{notes}", messages=[{"role": "user", "content": question}], ) return resp.content[0].textChecked with Keryn’s browser engine when this page was built: it reports seceng.asi06.memory-read-into-system-prompt-python at line 14 (error, proof 2). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
seceng.asi06.memory-read-into-system-prompt-ts
Section titled “seceng.asi06.memory-read-into-system-prompt-ts”error typescript data-flow rule mem0, langgraphjs, vercel-ai-sdk, typescript
Recalled long-term memory (mem0ai search, LangGraph.js store) is placed in the system prompt or agent instructions. A poisoned memory then carries system authority. Render memories as delimited untrusted context in a user/context message instead.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
CWE-345 CWE-1427 LLM01 LLM08 ASI06 ASI01
Fix: Keep system/instructions static. Pass recalled memories as quoted data in a user/context message, filtered by owner and provenance.
References: https://docs.mem0.ai/open-source/node-quickstart · https://langchain-ai.github.io/langgraphjs/concepts/memory/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi06.memory-shared-user-scope-python
Section titled “seceng.asi06.memory-shared-user-scope-python”error python mem0, zep, langgraph, python
Agent memory is written or searched with a constant user/namespace (e.g. user_id="default", store.put(("memories",), ...)) or with no user scope at all. Every user then reads and writes the same memory, so one user can poison another’s context and recall their data. Scope memory to the authenticated principal.
Confidence P1: dangerous in context. 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-639 CWE-668 LLM08 LLM02 ASI06
Fix: Derive user_id / the store namespace from the authenticated session (never a literal, never model output), e.g. store.put((user.id, "memories"), ...) and memory.add(msgs, user_id=current_user.id).
References: https://docs.mem0.ai/core-concepts/memory-operations/add · https://langchain-ai.github.io/langgraph/concepts/persistence/#memory-store · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://pypi.org/project/zep-cloud/2.0.0/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as assistant/remember.py and scan it with keryn scan assistant --verbose; the finding below appears.
from mem0 import Memory
memory = Memory()
def remember_preference(text: str) -> None: memory.add( [{"role": "user", "content": text}], user_id="default", metadata={"kind": "preference"}, )
def recall(query: str): return memory.search(query, user_id="default", limit=3)Checked with Keryn’s browser engine when this page was built: it reports seceng.asi06.memory-shared-user-scope-python 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.
seceng.asi06.memory-shared-user-scope-ts
Section titled “seceng.asi06.memory-shared-user-scope-ts”error typescript mem0, langgraphjs, typescript
Agent memory is written or searched with a constant userId / namespace (mem0ai, LangGraph.js store), so all users share one memory and can poison or read each other’s context. Scope memory to the authenticated principal.
Confidence P1: dangerous in context. 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-639 CWE-668 LLM08 LLM02 ASI06
Fix: Pass userId from the verified session (session.user.id), never a literal; namespace stores as [userId, "memories"].
References: https://docs.mem0.ai/open-source/node-quickstart · https://langchain-ai.github.io/langgraphjs/concepts/persistence/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi06.vector-upsert-untrusted-without-source-python
Section titled “seceng.asi06.vector-upsert-untrusted-without-source-python”warning python data-flow rule langchain, chromadb, python
Fetched or tool-produced content is upserted into a vector store without any metadata, so retrieval cannot tell attacker-supplied chunks from curated ones. Poisoned chunks then resurface as trusted context. Attach source/trust metadata on every write and filter on it at query time.
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: Pass metadatas=[{"source": url, "trust": "untrusted", "ingested_by": tool_name}] (or Document metadata) on every upsert of external content, and filter retrieval on trust/source.
References: https://reference.langchain.com/python/langchain-core · https://docs.trychroma.com/docs/collections/add-data · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi06.vector-upsert-untrusted-without-source-ts
Section titled “seceng.asi06.vector-upsert-untrusted-without-source-ts”warning typescript data-flow rule langchainjs, chromadb, typescript
Fetched or tool-produced content is written to a vector store (Chroma JS / LangChain.js Document) without metadata, so retrieval cannot distinguish attacker-supplied chunks. Attach source/trust metadata on every write and filter on it at query time.
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: Include metadata: { source, trust: "untrusted" } on each Document / metadatas on each Chroma add, and filter retrieval on it.
References: https://docs.langchain.com/oss/javascript/langchain/overview · https://docs.trychroma.com/docs/collections/add-data · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi01.system-prompt-from-retrieved-or-tool-content-python
Section titled “seceng.asi01.system-prompt-from-retrieved-or-tool-content-python”error python data-flow rule langchain, openai, anthropic, python
A retrieved document or tool result is concatenated into the system prompt. Text the agent merely read now carries system authority and can rewrite the agent’s goal. Pass retrieved/tool content as delimited data in a user or tool message, never in the system role.
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: Keep the system role static. Put retrieved chunks and tool results in user/tool messages wrapped in explicit delimiters with an instruction that they are data, and run an injection filter on them.
References: https://docs.langchain.com/oss/python/langchain/overview · https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as rag/answer.py and scan it with keryn scan rag --verbose; the finding below appears.
from langchain_core.messages import HumanMessage, SystemMessage
def answer(llm, vectorstore, question: str) -> str: docs = vectorstore.similarity_search(question, k=4) context = "\n\n".join(d.page_content for d in docs) messages = [ SystemMessage(content=f"Follow the guidance below when answering.\n{context}"), HumanMessage(content=question), ] return llm.invoke(messages).contentChecked with Keryn’s browser engine when this page was built: it reports seceng.asi01.system-prompt-from-retrieved-or-tool-content-python at line 8 (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.
seceng.asi01.system-prompt-from-retrieved-or-tool-content-ts
Section titled “seceng.asi01.system-prompt-from-retrieved-or-tool-content-ts”error typescript data-flow rule langchainjs, vercel-ai-sdk, typescript
A retrieved document or tool result flows into the system prompt (role: "system", system:, SystemMessage). Text the agent read now carries system authority and can hijack its goal. Pass it as delimited data in a user/tool message.
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: Keep system static; put retrieved/tool content in user or tool messages with delimiters and an injection filter.
References: https://ai-sdk.dev/docs/foundations/prompts · https://docs.langchain.com/oss/javascript/langchain/overview · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi01.agent-instructions-loaded-at-runtime-python
Section titled “seceng.asi01.agent-instructions-loaded-at-runtime-python”error python data-flow rule openai-agents, crewai, autogen, langgraph, claude-agent-sdk, python
An agent’s instructions / system prompt / goal are loaded at runtime from a URL or database row and passed straight into the agent constructor. Whoever can edit that row or host can silently re-task the agent. Pin the instructions in code or verify a signature/hash before use.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).
CWE-494 CWE-345 LLM01 LLM03 ASI01
Fix: Ship instructions with the code (versioned, reviewed). If they must be dynamic, store them with a content hash/signature and an approval record, and verify (verify_signature(...)) before constructing the agent.
References: https://openai.github.io/openai-agents-python/agents/ · https://docs.crewai.com/en/concepts/agents · https://microsoft.github.io/autogen/stable/reference/python/autogen_agentchat.agents.html · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as crew/support_agent.py and scan it with keryn scan crew --verbose; the finding below appears.
import httpxfrom agents import Agent
PROMPT_URL = "https://config.example.com/prompts/support-agent.txt"
def load_support_agent() -> Agent: resp = httpx.get(PROMPT_URL, timeout=5) resp.raise_for_status() return Agent( name="support", model="gpt-4.1-mini", instructions=resp.text, )Checked with Keryn’s browser engine when this page was built: it reports seceng.asi01.agent-instructions-loaded-at-runtime-python 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.
seceng.asi01.agent-instructions-loaded-at-runtime-ts
Section titled “seceng.asi01.agent-instructions-loaded-at-runtime-ts”error typescript data-flow rule openai-agents, mastra, langgraphjs, vercel-ai-sdk, typescript
An agent’s instructions / system prompt are loaded at runtime from a URL or database row and passed into the agent constructor. Whoever controls that source can re-task the agent. Pin instructions in code or verify a signature before use.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).
CWE-494 CWE-345 LLM01 LLM03 ASI01
Fix: Keep instructions in reviewed source. For dynamic instructions require a stored hash/signature and verify it before constructing the agent.
References: https://openai.github.io/openai-agents-js/guides/agents/ · https://mastra.ai/docs/agents/overview · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi03.tool-uses-static-privileged-credential-python
Section titled “seceng.asi03.tool-uses-static-privileged-credential-python”warning python langchain, openai-agents, mcp, supabase, boto3, python
An agent tool performs actions with a static privileged credential (Supabase service_role key, admin/root token, long-lived AWS keys) instead of the calling user’s delegated token. Any user who can steer the agent inherits that privilege. Use the caller’s token (RLS) or short-lived, down-scoped credentials.
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 the end user’s access token into the tool context and build the client with it (Supabase anon key + user JWT so RLS applies), or mint per-request STS credentials with a session policy scoped to that user.
References: https://supabase.com/docs/guides/getting-started/api-keys · https://docs.aws.amazon.com/boto3/latest/reference/services/sts/client/assume_role.html · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi03.tool-uses-static-privileged-credential-ts
Section titled “seceng.asi03.tool-uses-static-privileged-credential-ts”error typescript vercel-ai-sdk, langchainjs, mcp, supabase, aws-sdk, typescript
An agent tool (AI SDK tool(), LangChain.js tool, MCP server.tool) uses a static privileged credential (service_role / admin / root key, static AWS keys) rather than the caller’s delegated token. Steering the agent grants that privilege. Use the user’s token or short-lived scoped credentials.
Confidence P1: dangerous in context. 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: Forward the user’s JWT into the tool (e.g. via experimental_context) and create the client with it, or use STS AssumeRole with a per-user session policy.
References: https://supabase.com/docs/guides/getting-started/api-keys · https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi03.tool-authz-from-model-argument-python
Section titled “seceng.asi03.tool-authz-from-model-argument-python”error python langchain, openai-agents, mcp, python
A tool makes an authorization decision from a model-supplied argument (role, is_admin, user_id, tenant_id). The model fills these from conversation text, so a prompt injection can claim admin or another tenant. Take identity and role from the authenticated request context, never from tool arguments.
Confidence P1: dangerous in context. 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: Remove identity/role parameters from the tool schema. Inject them from the server side (LangChain InjectedToolArg, OpenAI Agents RunContextWrapper, MCP auth context) and authorize against those.
References: https://docs.langchain.com/oss/python/langchain/overview · https://openai.github.io/openai-agents-python/context/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as support/tools.py and scan it with keryn scan support --verbose; the finding below appears.
from agents import function_tool
from support.store import orders
@function_tooldef cancel_order(order_id: str, role: str) -> str: """Cancel an order. Staff can cancel any order.""" if role == "staff": orders.cancel(order_id) return f"Order {order_id} cancelled" return "Only staff can cancel orders"Checked with Keryn’s browser engine when this page was built: it reports seceng.asi03.tool-authz-from-model-argument-python at line 9 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
seceng.asi03.tool-authz-from-model-argument-ts
Section titled “seceng.asi03.tool-authz-from-model-argument-ts”warning typescript vercel-ai-sdk, langchainjs, typescript
A tool’s execute handler authorizes on a model-supplied argument (role, isAdmin, userId, tenantId). A prompt injection can set these freely. Take identity and role from the authenticated server-side context.
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: Drop identity/role fields from the tool’s input schema; read them from the session passed via tool context and authorize against that.
References: https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi03.impersonation-header-from-model-output-python
Section titled “seceng.asi03.impersonation-header-from-model-output-python”error python data-flow rule openai, anthropic, langchain, python
An impersonation / delegation header (X-User-Id, Act-As, X-On-Behalf-Of, …) is set from model-controlled tool arguments. The downstream service trusts that header for identity, so the model (and anyone who can inject into it) chooses who the agent acts as. Set it from the authenticated session.
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: Derive the acting principal from the verified request (session/JWT) and pass a token exchanged for that user (OAuth token exchange, RFC 8693) instead of a free-form header.
References: https://developers.openai.com/api/docs/guides/function-calling · https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as mcp_server/tickets.py and scan it with keryn scan mcp_server --verbose; the finding below appears.
import httpxfrom mcp.server.fastmcp import FastMCP
mcp = FastMCP("tickets")API = "https://tickets.internal.example/api"
@mcp.tool()def list_tickets(requester: str, status: str = "open") -> list: """List tickets raised by a user.""" resp = httpx.get( f"{API}/tickets", params={"status": status}, headers={"X-User-Id": requester, "Accept": "application/json"}, timeout=10, ) resp.raise_for_status() return resp.json()Checked with Keryn’s browser engine when this page was built: it reports seceng.asi03.impersonation-header-from-model-output-python at line 14 (error, proof 2). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
seceng.asi03.impersonation-header-from-model-output-ts
Section titled “seceng.asi03.impersonation-header-from-model-output-ts”error typescript data-flow rule openai, anthropic, vercel-ai-sdk, typescript
An impersonation / delegation header (X-User-Id, Act-As, X-On-Behalf-Of, …) is set from model-controlled tool-call arguments, letting the model pick whose identity the agent uses downstream. Set it from the authenticated session.
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: Use the session’s user and an exchanged, user-bound token for downstream calls, never a header value taken from tool arguments.
References: https://developers.openai.com/api/docs/guides/function-calling · https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi03.agent-sandbox-runs-as-root-python
Section titled “seceng.asi03.agent-sandbox-runs-as-root-python”error python docker, e2b, langchain, python
The agent’s execution sandbox runs as root or the agent’s tools escalate with sudo. Any tool misuse or code-execution bug then has full privileges inside (and often outside) the sandbox. Run as an unprivileged user and drop sudo.
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: Set user="1000:1000" (or a named unprivileged user), drop capabilities (cap_drop=["ALL"]), and remove sudo from tool commands; if a privileged step is needed, perform it outside the agent with approval.
References: https://docker-py.readthedocs.io/en/stable/containers.html · https://docs.e2b.dev/commands · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi03.agent-sandbox-runs-as-root-ts
Section titled “seceng.asi03.agent-sandbox-runs-as-root-ts”error typescript dockerode, e2b, typescript
The agent’s execution sandbox runs as root (dockerode User: "root") or its tools escalate with sudo. A tool-misuse or code-execution bug then has full privileges. Run as an unprivileged user and drop sudo.
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: Create containers with User: "1000:1000" and CapDrop: ["ALL"]; remove sudo from agent commands.
References: https://github.com/apocas/dockerode · https://docs.docker.com/reference/api/engine/version/v1.47/#tag/Container/operation/ContainerCreate · https://docs.e2b.dev/commands · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi07.a2a-agent-card-without-security-schemes-python
Section titled “seceng.asi07.a2a-agent-card-without-security-schemes-python”warning python a2a, python
An A2A AgentCard is published without security_schemes / security (or with them empty). Peer agents and clients get no declared authentication requirement, so the agent’s JSON-RPC endpoint is effectively open to any caller that can reach it. Declare an auth scheme and enforce it on the endpoint.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: trusts one party believes another without evidence.
Fix: Set security_schemes={"bearer": SecurityScheme(...)} and security=[{"bearer": []}] on the AgentCard (OAuth2/OIDC or mTLS preferred), and validate the credential in middleware before the request handler.
References: https://a2a-protocol.org/latest/specification/ · https://github.com/a2aproject/a2a-python · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://pypi.org/project/a2a-sdk/0.3.25/
seceng.asi07.a2a-agent-card-without-security-schemes-ts
Section titled “seceng.asi07.a2a-agent-card-without-security-schemes-ts”warning typescript a2a, a2a-js, typescript
An A2A AgentCard is defined without securitySchemes (or with an empty one / authentication: null). The agent advertises no authentication, so its JSON-RPC endpoint is effectively open to any peer. Declare and enforce an auth scheme.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: trusts one party believes another without evidence.
Fix: Add securitySchemes and security to the card and validate the credential in Express middleware before A2AExpressApp routes.
References: https://a2a-protocol.org/latest/specification/ · https://github.com/a2aproject/a2a-js · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi07.a2a-push-notification-url-not-allowlisted-python
Section titled “seceng.asi07.a2a-push-notification-url-not-allowlisted-python”error python data-flow rule a2a, httpx, python
The A2A push-notification URL supplied by the client is used directly as the target of an outbound request. Any caller can make the agent POST task data to internal services or attacker hosts (SSRF and data exfiltration). Validate the URL against an allow-list and verify ownership before sending.
Confidence P1: dangerous in context. 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: Check the push URL with an allow-list (scheme https, approved hosts, no private/link-local IPs) and perform the A2A ownership challenge before storing or posting to it.
References: https://a2a-protocol.org/latest/specification/#95-push-notification-setup-and-usage · https://a2a-protocol.org/latest/topics/streaming-and-async/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi07.a2a-push-notification-url-not-allowlisted-ts
Section titled “seceng.asi07.a2a-push-notification-url-not-allowlisted-ts”error typescript data-flow rule a2a, a2a-js, typescript
The A2A push-notification URL from the request is fetched/posted without an allow-list, letting any client aim the agent’s outbound task updates at internal or attacker hosts. Validate the URL and verify ownership first.
Confidence P1: dangerous in context. 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: Allow-list push hosts (https only, deny private ranges) and complete the A2A validation-token handshake before sending notifications.
References: https://a2a-protocol.org/latest/specification/#95-push-notification-setup-and-usage · https://github.com/a2aproject/a2a-js · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi07.a2a-jsonrpc-endpoint-without-auth-python
Section titled “seceng.asi07.a2a-jsonrpc-endpoint-without-auth-python”warning python a2a, starlette, fastapi, python
An A2A Starlette/FastAPI application is built without authentication middleware. The JSON-RPC endpoint accepts message/send and task calls from any peer, so an unauthenticated agent or attacker can drive this agent. Add auth middleware (or pass middleware=[...] to build()).
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: trusts one party believes another without evidence.
Fix: Build with server.build(middleware=[Middleware(AuthenticationMiddleware, backend=...)]) or call app.add_middleware(...) on the built app, and reject requests lacking the scheme declared in the card.
References: https://github.com/a2aproject/a2a-python · https://a2a-protocol.org/latest/topics/enterprise-ready/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi07.a2a-jsonrpc-endpoint-without-auth-ts
Section titled “seceng.asi07.a2a-jsonrpc-endpoint-without-auth-ts”warning typescript a2a, a2a-js, express, typescript
A2AExpressApp.setupRoutes mounts the A2A JSON-RPC endpoint on an Express app with no auth middleware registered before it and none passed to setupRoutes. Any peer can call the agent. Register authentication middleware first.
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: trusts one party believes another without evidence.
Fix: app.use(authMiddleware) before setupRoutes(app) (or pass middlewares to setupRoutes) and verify the credential declared in the AgentCard.
References: https://github.com/a2aproject/a2a-js · https://a2a-protocol.org/latest/topics/enterprise-ready/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi07.peer-agent-message-as-instructions-python
Section titled “seceng.asi07.peer-agent-message-as-instructions-python”error python data-flow rule a2a, autogen, openai-agents, crewai, python
Output or messages from another agent (A2A request input, AutoGen last_message / chat summary, an OpenAI Agents final_output, a CrewAI kickoff result) are promoted to this agent’s system message or instructions. A compromised or spoofed peer can then re-task this agent. Treat peer messages as untrusted data in the user role, behind a trust boundary.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: trusts one party believes another without evidence.
CWE-1427 CWE-345 LLM01 LLM06 ASI07 ASI01
Fix: Pass peer-agent output as a user/tool message with explicit delimiters, validate it against a schema, and authenticate the peer (signed A2A messages / mTLS). Never call update_system_message or set instructions from a peer’s text.
References: https://github.com/a2aproject/a2a-python · https://microsoft.github.io/autogen/0.2/docs/reference/agentchat/conversable_agent/ · https://openai.github.io/openai-agents-python/results/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as orchestrator/handoff.py and scan it with keryn scan orchestrator --verbose; the finding below appears.
from autogen import AssistantAgent
def build_executor(llm_config, planner_chat): plan = planner_chat.summary return AssistantAgent( name="executor", llm_config=llm_config, system_message=f"You carry out the plan below step by step.\n{plan}", )Checked with Keryn’s browser engine when this page was built: it reports seceng.asi07.peer-agent-message-as-instructions-python 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.
seceng.asi07.peer-agent-message-as-instructions-ts
Section titled “seceng.asi07.peer-agent-message-as-instructions-ts”error typescript data-flow rule a2a-js, openai-agents, vercel-ai-sdk, typescript
A message or result from another agent (A2A requestContext.userMessage, OpenAI Agents finalOutput) is promoted to this agent’s system prompt or instructions. A compromised peer can re-task this agent. Treat peer output as untrusted data in the user role.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: trusts one party believes another without evidence.
CWE-1427 CWE-345 LLM01 LLM06 ASI07 ASI01
Fix: Deliver peer output as a delimited user message validated against a schema; authenticate the peer.
References: https://github.com/a2aproject/a2a-js · https://openai.github.io/openai-agents-js/guides/results/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://www.npmjs.com/package/@a2a-js/sdk/v/1.3.0
seceng.asi07.agent-event-stream-dispatches-commands-ts
Section titled “seceng.asi07.agent-event-stream-dispatches-commands-ts”error typescript data-flow rule ag-ui, sse, websocket, typescript
Data from an agent event stream (SSE/WebSocket event.data, AG-UI tool-call events) selects which function runs or is executed as code/shell. Events from a remote agent are untrusted; treating them as commands lets a compromised or spoofed agent invoke arbitrary local actions. Dispatch only through a fixed allow-list map after authenticating the stream.
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-470 LLM05 LLM06 ASI07
Fix: Authenticate the event source, validate event payloads with a schema, and look the action up in a Map of approved handlers (if (!HANDLERS.has(name)) return), never obj[name](...), eval, or exec.
References: https://docs.ag-ui.com/concepts/events · https://developer.mozilla.org/en-US/docs/Web/API/EventSource · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi09.approval-gate-disabled-python
Section titled “seceng.asi09.approval-gate-disabled-python”error python claude-agent-sdk, openai-agents, langgraph, agno, python
Human approval for agent actions is explicitly switched off (auto_approve=True, permission_mode="bypassPermissions", require_approval="never", interrupt_before=[], --dangerously-skip-permissions / --yolo, …). Every tool call, including destructive ones, now runs on the model’s say-so. Keep approval on for side-effecting tools.
Confidence P1: dangerous in context. 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: Use permission_mode="default" with a can_use_tool policy, require_approval={"always": {...}} for write tools, and interrupt_before=["tools"] (or interrupt() in the tool) for destructive actions. Restrict bypass modes to throwaway sandboxes with no credentials.
References: https://docs.claude.com/en/docs/agent-sdk/permissions · https://openai.github.io/openai-agents-python/mcp/ · https://langchain-ai.github.io/langgraph/concepts/human_in_the_loop/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://raw.githubusercontent.com/openai/codex/main/codex-rs/protocol/src/protocol.rs · https://raw.githubusercontent.com/openai/codex/main/codex-rs/utils/cli/src/shared_options.rs · https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/cli-reference.md
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as agent/mcp_setup.py and scan it with keryn scan agent --verbose; the finding below appears.
from openai import OpenAI
client = OpenAI()
def run(task: str): return client.responses.create( model="gpt-4.1", input=task, tools=[ { "type": "mcp", "server_label": "deploy", "server_url": "https://mcp.example.com/sse", "require_approval": "never", } ], )Checked with Keryn’s browser engine when this page was built: it reports seceng.asi09.approval-gate-disabled-python at line 11 (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.
seceng.asi09.approval-gate-disabled-ts
Section titled “seceng.asi09.approval-gate-disabled-ts”error typescript claude-agent-sdk, openai-agents, vercel-ai-sdk, langgraphjs, typescript
Human approval for agent actions is explicitly switched off (permissionMode: "bypassPermissions", dangerouslySkipPermissions, requireApproval: "never", needsApproval: false, interruptBefore: [], --yolo, …). Destructive tool calls run without a human check. Keep approval on for side effects.
Confidence P1: dangerous in context. 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: Use permissionMode: "default" with a canUseTool policy, needsApproval: true / requireApproval: "always" for write tools, and interruptBefore: ["tools"] for destructive graphs.
References: https://docs.claude.com/en/docs/agent-sdk/permissions · https://openai.github.io/openai-agents-js/guides/human-in-the-loop/ · https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://code.claude.com/docs/en/agent-sdk/typescript · https://raw.githubusercontent.com/openai/codex/main/codex-rs/protocol/src/protocol.rs · https://raw.githubusercontent.com/openai/codex/main/codex-rs/utils/cli/src/shared_options.rs · https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/cli-reference.md
seceng.asi09.approval-callback-always-allows-python
Section titled “seceng.asi09.approval-callback-always-allows-python”error python claude-agent-sdk, openai-agents, python
An approval / permission callback (can_use_tool, on_approval_request, approve_*, confirm_*) unconditionally allows. The UI or SDK shows a human-in-the-loop control that never actually blocks, which is worse than none because operators trust it. Implement a real policy or ask the human.
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: Evaluate the tool name and input against an allow/deny policy and route anything side-effecting to an interactive human prompt; return PermissionResultDeny / {"approve": False} by default.
References: https://docs.claude.com/en/docs/agent-sdk/permissions · https://openai.github.io/openai-agents-python/ref/tool/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://raw.githubusercontent.com/anthropics/claude-agent-sdk-python/main/src/claude_agent_sdk/types.py
seceng.asi09.approval-callback-always-allows-ts
Section titled “seceng.asi09.approval-callback-always-allows-ts”error typescript claude-agent-sdk, openai-agents, vercel-ai-sdk, typescript
An approval / permission callback (canUseTool, onApproval, approve*) unconditionally allows, so the human-in-the-loop control never blocks anything. Implement a real policy or ask the human.
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: Check tool name and input against policy; default to { behavior: "deny" } and prompt the user for side-effecting tools.
References: https://docs.claude.com/en/docs/agent-sdk/permissions · https://openai.github.io/openai-agents-js/guides/human-in-the-loop/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi10.agent-sandbox-host-escape-python
Section titled “seceng.asi10.agent-sandbox-host-escape-python”error python docker, python
An agent/tool container is started with host networking, host PID/IPC namespace, privileged mode, the Docker socket or the host root filesystem. A rogue or hijacked agent can then reach internal services or take over the host. Use an isolated network, unprivileged container, and no host mounts.
Confidence P0: exploitable as written. 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-250 CWE-668 LLM06 ASI10 ASI05
Fix: Run agent sandboxes with network_mode="none" (or a dedicated egress-filtered network), privileged=False, cap_drop=["ALL"], read-only rootfs and only a scratch volume; never mount /var/run/docker.sock or /.
References: https://docker-py.readthedocs.io/en/stable/containers.html · https://docs.docker.com/engine/security/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as sandbox/runner.py and scan it with keryn scan sandbox --verbose; the finding below appears.
import docker
client = docker.from_env()
def run_generated_script(path: str) -> str: container = client.containers.run( "python:3.12-slim", ["python", "/work/script.py"], volumes={path: {"bind": "/work/script.py", "mode": "ro"}}, network_mode="host", mem_limit="256m", remove=True, ) return container.decode()Checked with Keryn’s browser engine when this page was built: it reports seceng.asi10.agent-sandbox-host-escape-python 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.
seceng.asi10.agent-sandbox-host-escape-ts
Section titled “seceng.asi10.agent-sandbox-host-escape-ts”error typescript dockerode, docker, typescript
An agent/tool container (dockerode or docker CLI argv) is started with host networking, host PID, privileged mode, the Docker socket or the host root bind-mounted. A rogue agent can reach internal services or take over the host. Isolate the network and drop privileges.
Confidence P0: exploitable as written. 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-250 CWE-668 LLM06 ASI10 ASI05
Fix: Use HostConfig: { NetworkMode: "none", Privileged: false, CapDrop: ["ALL"], ReadonlyRootfs: true } with only a scratch bind; never bind the Docker socket or /.
References: https://github.com/apocas/dockerode · https://docs.docker.com/reference/api/engine/version/v1.47/#tag/Container/operation/ContainerCreate · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi10.code-sandbox-unrestricted-lifetime-or-network-python
Section titled “seceng.asi10.code-sandbox-unrestricted-lifetime-or-network-python”warning python e2b, modal, daytona, python
An agent code sandbox (E2B, Modal, Daytona) is created with open internet egress and no explicit timeout, or with auto-stop disabled. A hijacked agent gets an unbounded, internet-connected runtime to exfiltrate data or persist. Set a timeout and restrict egress.
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-400 CWE-668 LLM10 LLM06 ASI10
Fix: Pass timeout= and allow_internet_access=False (E2B), timeout= and block_network=True / cidr_allowlist= (Modal), and a non-zero auto_stop_interval plus network_block_all=True (Daytona).
References: https://docs.e2b.dev/sandbox · https://modal.com/docs/guide/sandboxes · https://www.daytona.io/docs/sandboxes · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://pypi.org/project/e2b/2.59.0/ · https://pypi.org/project/modal/1.6.2/ · https://pypi.org/project/daytona/0.226.1/
seceng.asi10.code-sandbox-unrestricted-lifetime-or-network-ts
Section titled “seceng.asi10.code-sandbox-unrestricted-lifetime-or-network-ts”warning typescript e2b, daytona, typescript
An agent code sandbox (E2B, Daytona) is created without a timeout and with internet access, or with auto-stop disabled. A hijacked agent gets an unbounded, internet-connected runtime. Set timeoutMs and restrict egress.
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-400 CWE-668 LLM10 LLM06 ASI10
Fix: Sandbox.create({ timeoutMs, allowInternetAccess: false }) for E2B; non-zero autoStopInterval and networkBlockAll: true for Daytona.
References: https://docs.e2b.dev/sandbox · https://www.daytona.io/docs/sandboxes · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://www.npmjs.com/package/e2b
seceng.asi10.scheduled-agent-without-budget-python
Section titled “seceng.asi10.scheduled-agent-without-budget-python”warning python celery, apscheduler, modal, openai-agents, langgraph, crewai, python
A scheduled / background job (Celery, APScheduler, Modal cron) runs an agent with no turn, recursion, time or cost bound on the call. Nobody is watching when it runs, so a hijacked or looping agent keeps acting with its write tools. Bound every unattended run and add a kill switch.
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-400 CWE-770 LLM10 LLM06 ASI10 ASI08
Fix: Pass max_turns= (OpenAI Agents), config={"recursion_limit": N} (LangGraph), max_iter/max_rpm (CrewAI), wrap in asyncio.wait_for(..., timeout), enforce a per-run cost budget and check a global kill-switch flag before each run.
References: https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html · https://modal.com/docs/guide/cron · https://openai.github.io/openai-agents-python/running_agents/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://pypi.org/project/modal/1.6.2/
seceng.asi10.scheduled-agent-without-budget-ts
Section titled “seceng.asi10.scheduled-agent-without-budget-ts”warning typescript node-cron, trigger-dev, openai-agents, vercel-ai-sdk, typescript
A cron / scheduled job (node-cron, cron, Trigger.dev schedules) runs an agent with no step, turn, time or cost bound on the call. Unattended runs keep acting with write tools if hijacked or looping. Bound every unattended run and add a kill switch.
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-400 CWE-770 LLM10 LLM06 ASI10 ASI08
Fix: Pass maxTurns / stopWhen: stepCountIs(n) / recursionLimit, an AbortSignal.timeout(ms), a cost budget, and check a kill-switch flag at the start of each scheduled run.
References: https://github.com/node-cron/node-cron · https://trigger.dev/docs/tasks/scheduled · https://openai.github.io/openai-agents-js/guides/running-agents/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ · https://www.npmjs.com/package/@trigger.dev/sdk
seceng.asi08.unbounded-agent-fanout-from-model-output-python
Section titled “seceng.asi08.unbounded-agent-fanout-from-model-output-python”error python data-flow rule asyncio, openai-agents, langchain, python
A list produced by the model (structured output, final_output, parsed JSON) drives an asyncio.gather / pool fan-out of agent runs with no cap. A manipulated or runaway plan can spawn hundreds of sub-agents, cascading cost, rate-limit and side-effect failures. Cap the list and bound concurrency.
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-770 CWE-400 LLM10 LLM06 ASI08
Fix: Truncate model-produced work lists (items[:MAX_SUBTASKS]), validate them against a schema with a max length, run sub-agents under an asyncio.Semaphore, and trip a circuit breaker on repeated failures.
References: https://docs.python.org/3/library/asyncio-task.html#asyncio.gather · https://openai.github.io/openai-agents-python/multi_agent/ · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as research/fanout.py and scan it with keryn scan research --verbose; the finding below appears.
import asyncio
from agents import Agent, Runner
planner = Agent(name="planner", instructions="List the sub-questions to research, one per line.")worker = Agent(name="worker", instructions="Research the sub-question and summarise.")
async def research(topic: str): plan = await Runner.run(planner, topic) subtasks = plan.final_output.splitlines() results = await asyncio.gather(*[Runner.run(worker, q) for q in subtasks]) return [r.final_output for r in results]Checked with Keryn’s browser engine when this page was built: it reports seceng.asi08.unbounded-agent-fanout-from-model-output-python 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.
seceng.asi08.unbounded-agent-fanout-from-model-output-ts
Section titled “seceng.asi08.unbounded-agent-fanout-from-model-output-ts”error typescript data-flow rule vercel-ai-sdk, openai, openai-agents, typescript
A list produced by the model (generateObject output, parsed completion, finalOutput) drives a Promise.all(items.map(...)) fan-out with no cap. A manipulated plan can spawn unbounded sub-agent runs and cascade failures. Cap the list and bound concurrency.
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-770 CWE-400 LLM10 LLM06 ASI08
Fix: Constrain the schema (z.array(...).max(N)), slice the list, and run sub-agents through p-limit / p-map({ concurrency }) with a circuit breaker.
References: https://ai-sdk.dev/docs/ai-sdk-core/generating-structured-data · https://github.com/sindresorhus/p-limit · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi08.agent-retry-without-cap-python
Section titled “seceng.asi08.agent-retry-without-cap-python”error python tenacity, backoff, python
An agent run is wrapped in a tenacity @retry / backoff decorator with no stop condition. A failing downstream (rate limit, poisoned input, broken tool) is retried forever, multiplying cost and side effects and cascading load to every dependent service. Add a stop and capped exponential backoff.
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: Use @retry(stop=stop_after_attempt(3), wait=wait_exponential(max=30)) (or max_tries/max_time with backoff), retry only idempotent steps, and open a circuit breaker after repeated failures.
References: https://tenacity.readthedocs.io/en/latest/ · https://github.com/litl/backoff · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi08.agent-retry-without-cap-ts
Section titled “seceng.asi08.agent-retry-without-cap-ts”error typescript p-retry, async-retry, typescript
An agent run is retried with an infinite policy (retries: Infinity, forever: true). A failing downstream is hammered indefinitely and every retry may repeat side effects. Cap attempts and back off.
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: Use a finite retries with factor/maxTimeout, retry only idempotent steps, and add a circuit breaker.
References: https://github.com/sindresorhus/p-retry · https://github.com/vercel/async-retry · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi08.tool-error-swallowed-as-success-python
Section titled “seceng.asi08.tool-error-swallowed-as-success-python”error python langchain, openai-agents, mcp, python
A tool catches an exception and reports success ("ok", {"success": True}, "done"). The model and any downstream agents then build on an action that never happened, propagating a silent failure through the workflow. Return the error (or raise) so the agent and orchestrator can react.
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.
CWE-390 CWE-755 LLM06 LLM09 ASI08
Fix: In the except branch return an explicit error result (MCP isError: true, LangChain ToolException, {"success": False, "error": ...}) or re-raise; never a success string.
References: https://docs.langchain.com/oss/python/langchain/overview · https://modelcontextprotocol.io/specification/2025-06-18/server/tools#error-handling · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
seceng.asi08.tool-error-swallowed-as-success-ts
Section titled “seceng.asi08.tool-error-swallowed-as-success-ts”error typescript vercel-ai-sdk, langchainjs, mcp, typescript
A tool’s execute handler catches an error and reports success, so the model and downstream agents act on a step that never happened. Return an error result (isError: true) or rethrow.
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.
CWE-390 CWE-755 LLM06 LLM09 ASI08
Fix: Return { isError: true, content: [...] } (MCP) or { success: false, error }, or rethrow so the SDK surfaces the failure to the model.
References: https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling · https://modelcontextprotocol.io/specification/2025-06-18/server/tools#error-handling · https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/