Mastra is a TypeScript framework for building AI agents and workflows in code, giving developers full programmatic control over agent behaviour. That power comes with risk: because Mastra agents can access any system you grant them access to, a single prompt injection embedded in a GitHub issue, email, or document can trick the agent into reading private data and publishing it somewhere public. Archestra acts as a security layer between your Mastra agent and the LLM, dynamically restricting tool calls the moment untrusted content enters the context.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/archestra-ai/archestra/llms.txt
Use this file to discover all available pages before exploring further.
Security Risks with Mastra Agents
Mastra agents are susceptible to the Lethal Trifecta — a three-condition pattern that makes prompt injection both feasible and dangerous.Private Data Access
The agent can access all your GitHub repositories, including private ones with sensitive code and documentation.
Untrusted Content
The agent reads public issues created by any user, which can contain hidden malicious instructions.
External Communication
The agent can create issues in third-party repositories, effectively exfiltrating private data publicly.
Demonstration
Step 0: Run Mastra and Archestra Together
A pre-built Docker Compose configuration launches both services locally.- Mastra is available at
http://localhost:4111 - Archestra Platform UI is available at
http://localhost:3000
Step 1: Reproduce the Prompt Injection Attack
Create a public GitHub issue with an innocent-looking title (e.g. “Add more documentation”) but include malicious instructions in the description:Step 2: Enable Archestra Protection
Stop the vulnerable Mastra agent:OPENAI_PROXY_URL environment variable:
mastra-ai-archestra-1 is the in-Docker DNS name for the Archestra platform container launched by Docker Compose. Optionally verify it is active by checking the log output for the message: Using Archestra proxy: http://mastra-ai-archestra-1:9000/v1/openai.Step 3: Verify the Attack Is Blocked
Try the same prompt again:get_issue — succeeds normally. The second — get_file_content targeting the private repository — is blocked before it executes.
You can inspect the blocked tool call in detail in the platform UI at http://localhost:3000/logs/.