creating-agents-in-medusa
Warn
Audited by Gen Agent Trust Hub on Jul 15, 2026
Risk Level: MEDIUMREMOTE_CODE_EXECUTIONCOMMAND_EXECUTIONDATA_EXFILTRATIONPROMPT_INJECTION
Full Analysis
- [REMOTE_CODE_EXECUTION]: The skill implements a dynamic code execution pattern in
reference/medusa-exec.md. TheexecuteCodefunction writes agent-generated TypeScript to a temporary file on the server's disk and subsequently loads it using the Node.jsrequire()function. This allows for the execution of arbitrary code in the context of the Medusa server process. - [COMMAND_EXECUTION]: The 'MedusaExec' tool is explicitly designed to allow the AI agent to write scripts that interact with the Medusa server's internal services and database to perform queries and mutations.
- [DATA_EXFILTRATION]: Because the agent has full access to the Medusa Dependency Injection container (
MedusaContainer) via the code execution tool, it can access any data managed by the platform. If the agent's logic is manipulated, this capability could be abused to exfiltrate sensitive store data. - [PROMPT_INJECTION]: The skill architecture is vulnerable to indirect prompt injection as it processes data from the store to make decisions.
- Ingestion points: External data enters the agent context through
query.graph()results inreference/medusa-exec.mdand user-provided messages inreference/api-route.md. - Boundary markers: The instructions do not define strict delimiters or 'ignore' instructions for the data being processed by the agent.
- Capability inventory: The agent has the capability to write files and execute arbitrary TypeScript code via
executeCodeinreference/medusa-exec.md. - Sanitization: There is no implemented sanitization or validation of the agent-generated code before it is written to disk and executed by the server process.
Audit Metadata