Quick answer: Prompt injection can redirect an agent through malicious instructions in content it processes. If the agent can retrieve or use credentials, an attacker may try to steal those values or misuse the access without stealing them. Reduce risk with layered controls; credential scoping alone does not prevent injection or make every permitted action safe.
How untrusted content becomes an instruction
An agent may read webpages, repository files, documents, email or tool responses while completing a legitimate task. An attacker can place instructions in that material and try to make the agent treat them as authority rather than data.
In a direct attack, the adversary controls an input to the application. In an indirect attack, the instruction arrives through material the agent encounters elsewhere. Success depends on the model, application, tools and controls; it is not inevitable that every malicious instruction is followed.
The core problem is that language-based task instructions and untrusted content can interact. Formatting or filtering alone should not be treated as a reliable security boundary.
Theft and misuse are different outcomes
Credential exfiltration: The agent reveals a key through a message, log, tool argument or network destination. The attacker may then use it outside the original session until provider restrictions, expiry or invalidation stop them.
Misuse without theft: The agent uses an authorised tool to perform an unwanted operation. A key-hiding tool can prevent direct key disclosure while still allowing a harmful action if its request rules are too broad.
Persistence and wider access: If available permissions allow it, the agent might create another credential, add a collaborator or change a deployment. Revoking the original credential does not necessarily remove those new paths.
Data disclosure can be serious even with read-only credentials. A restricted key may prevent deletion while still allowing sensitive information to be read and transmitted.
Use layers with explicit responsibilities
The OWASP prompt-injection prevention guidance describes multiple controls rather than a single complete defence.
Separate trusted instructions from retrieved content
Keep the task and policy instructions distinct from external material. Treat fetched text, repository comments and tool output as untrusted input, not permission to change the task or reveal a credential.
Input validation, detection and output checks can help, but test them against realistic attacks. Do not assume a list of blocked phrases handles every language or rewording.
Limit tools and execution
Expose only the tools, files and resources needed for the task. Use isolation and outbound-network restrictions where the runtime supports them, and check the actual boundaries.
For example, denying arbitrary network destinations can reduce an exfiltration path. It does not prevent disclosure through every permitted destination, chat response or existing integration.
Enforce provider permissions
Use restricted provider credentials with appropriate resources and lifetime. A runtime receiving a read-only token cannot use that token for operations the provider rejects, but may still misuse permitted reads.
Distinguish the provider key's permissions from the agent's retrieval policy. A policy allowing retrieval of a broad key does not make that key task-specific after release.
Gate sensitive actions at execution time
Where appropriate, require approval or deterministic validation of the actual endpoint, destination, resource and parameters. The execution path must enforce it; an approval that can be bypassed with another tool or direct key use is incomplete.
Credential consent and operation approval are different. Approving a key for retrieval does not approve every later request made with it.
Where credential retrieval helps—and where it stops
Gazebo can limit which stored credentials an agent retrieves and record those attempts. It does not detect prompt injection, inspect subsequent provider requests or prevent misuse of an already-retrieved key. Use narrow provider permissions and appropriate runtime controls alongside retrieval policy.
Authorised retrieval returns the actual provider key to the runtime and its host. Whether it enters model context, traces or conversation history depends on the client. Removing manual key pasting is useful, but retrieval is not a guarantee that the model never sees a secret.
A request proxy is a different architecture that can keep provider keys inside the proxy and check forwarded operations. It still needs safe rules and cannot assume every permitted operation is benign. Gazebo does not currently provide that provider-request proxy.
Detect and investigate using the right evidence
Unusual credential requests, denied retrievals, unexpected provider operations and suspicious destinations are signals worth investigating. They are not automatic proof of injection.
Gazebo's records describe retrieval. Provider and runtime records are needed to investigate actual operations and possible data disclosure. One retrieval can precede many API calls; no recent retrieval does not prove inactivity.
If compromise is suspected, block further retrieval, stop or isolate the runtime where possible and invalidate potentially exposed provider keys. Check for any new credentials or other persistence the available permissions could have created. See the incident-response playbook.
The aim is to reduce the chance and consequences of an attack while keeping the remaining limitations visible—not to promise that one access layer makes an agent injection-proof.