creating-internal-agents
Warn
Audited by Gen Agent Trust Hub on Oct 5, 2026
Risk Level: MEDIUMDYNAMIC_EXECUTIONCOMMAND_EXECUTIONINDIRECT_PROMPT_INJECTION
Full Analysis
- [DYNAMIC_EXECUTION]: The
executeCodefunction inreference/medusa-exec.mdimplements a runtime execution environment. It usesfs.writeFileSyncto write LLM-generated TypeScript to a temporary file in the current working directory and then usesrequire()to load and execute that file. This pattern constitutes dynamic code generation and loading from computed paths. - [COMMAND_EXECUTION]: The
medusaExecToolallows the agent to generate and execute arbitrary TypeScript code with full access to the Medusa dependency injection container (MedusaContainer). This gives the agent unrestricted programmatic access to the host application's database and internal services, which is highly sensitive if the agent's logic is compromised. - [INDIRECT_PROMPT_INJECTION]: The skill defines agents that query and process store data, creating a surface for indirect prompt injection.
- Ingestion points: Data enters the agent's context through
query.graph()calls within theMedusaExectool (reference/medusa-exec.md) and through the message history passed to the POST API route (reference/api-route.md). - Boundary markers: The system prompts outlined in
reference/agent-setup.mddo not utilize explicit delimiters or instructions to ignore potential commands embedded in store data (e.g., product descriptions or customer notes). - Capability inventory: The skill includes capabilities for filesystem writes (
writeFileSync), dynamic module loading (require), and full database/service access via the Medusa container. - Sanitization: There is no evidence of sanitization, escaping, or schema validation for data retrieved from the store before it is presented to the model or processed within the execution environment.
Audit Metadata