Credential and Secret Injection in Computer-Use Agent Environments
Isolating agents in VMs with placeholder credentials prevents secret theft at scale.

Credential and secret injection makes it safer to deploy persistent AI agents per user at scale because it keeps real tokens outside the agent’s execution environment. The strongest pattern combines a network-isolated VM, worthless placeholder credentials, and an external proxy that attaches secrets only to approved outbound requests. Persistent context can then last between sessions without bringing live credentials into the next task.
Why credential exposure is a structural problem for computer-use agents, not a configuration mistake
A traditional web server loads a credential and uses it predictably, but a computer-use agent decides which tools to call after reading untrusted material. Emails, web pages, issue trackers, and configuration files become inputs to those decisions. When credentials enter the same context, the agent has to tell instructions apart from content while it has the authority to act.
Trellix’s October 2026 research names this the “unseen credential surface”. Secrets move from protected storage into command histories, shell arguments, transcripts, and model context during normal work. An OAuth token used as a command-line argument may be seen by process monitors, and a.env file given to the agent as background may end up in model context. The agent can then misuse the credential autonomously, follow a prompt injection that exfiltrates it, or leak it passively through a log or stack trace. Because normal workflow creates the exposure path, the reliable fix is architectural.
What recent incidents reveal about the blast radius when agents hold real credentials
The incidents show how credential access amplifies an initial manipulation. CVE-2026-21852 involved a malicious repository settings file that set ANTHROPIC_BASE_URL to an attacker-controlled endpoint. Claude Code sent API requests, including credentials, to that endpoint before it showed a trust prompt. The configuration redirected a request, but the stolen credential extended the attacker’s access beyond that interaction.
CVE-2026-12957 exposed a different route to the same outcome. A workspace.amazonq/mcp.json file caused Amazon Q to auto-load an attacker-controlled MCP server process. That process inherited AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and active session tokens from the developer’s environment. Credential inheritance was dangerous because it gave the new process authority it should not have had.
LangChain CVE-2025-68664, rated CVSS 9.3 in December 2025, connected prompt injection to secret extraction through the serialization system. Raw credentials in environment variables made that exposure possible. GitLost demonstrated the related risk of delegated authority without credential theft. Noma Labs’ July 2026 disclosure described a crafted public GitHub Issue that allowed an unauthenticated attacker to pull data from private repositories.
Why the standard mitigations — scoped keys, rotation, scanning — are necessary but not sufficient for agent workloads
Scoped keys, rotation, and scanning remain useful because they limit permissions, shorten exposure, and uncover misplaced secrets. They do not remove a live secret from the agent’s reach. Repository scanning also covers only part of the surface, since credentials can reside in.env files, CI/CD variables, MCP configuration, and collaboration tools.
Least privilege narrows what a manipulated agent can do, but even a narrowly scoped token can authorize an unintended action. GitLost makes the distinction clear because an attacker did not need to steal a credential to exploit the authority already available. Rotation cannot fix that problem while the agent still has permission to act. Nor can scope prevent a process from probing a shared runtime for credentials belonging to other workloads.
Non-Human Identity, or NHI, provides the more useful frame. Organizations cannot predict every action an autonomous agent will choose, but they can define what its identity may reach. They can also decide whether the agent ever possesses the secret behind that identity.
The credential injection pattern — never giving the agent real secrets in the first place
Credential injection separates the ability to request an action from possession of the token that authorizes it. The agent runs in a network-isolated sandbox with placeholder credentials. All outbound traffic passes through an external egress proxy, which checks the request and attaches a real token only when policy permits it. The agent sees the response without seeing the substitution.
This pattern gives the agent a plastic replica of a key with no authority to start the engine. A literal string such as replaced_by_egress_proxy communicates where authorization belongs but grants no access if copied or stolen.
Onyx Craft’s reference architecture combines a mitmproxy-based gateway, firewall-enforced isolation, and per-action ALWAYS/ASK/DENY policies. Consequential actions such as sending email or deleting a record pause for human approval before a credential is attached. The agent cannot exfiltrate a real secret it does not have, but policy must still stop it from asking to take harmful actions that its authority allows.
Why VM-level isolation is what makes the injection pattern enforceable
A placeholder is useful only if the agent cannot bypass the proxy or reach the secrets behind it. An agent running arbitrary code can inspect its environment, read accessible files, and make syscalls. With a process boundary, the agent can still do those things inside the same operating system, and containers share a host kernel. Neither has the separate guest kernel that this architecture needs to enforce its rules.
A microVM places the workload behind a hardware-virtualized boundary. The guest does not receive access to the host filesystem, host memory, or the proxy’s credential store. Firecracker provides this separation for secure, multi-tenant workloads through lightweight microVMs. The important property here is not startup speed but the division between the guest’s execution space and the host-held authority.
Maritime’s persistent VM-based agent hosting follows this isolation model by giving each agent its own micro-VM kernel. For credential injection, that separation must also extend to networking. The guest firewall permits traffic only to the proxy, and hypervisor-level enforcement drops other egress, so enforcement does not depend solely on a process the agent could disable. In the “brain-outside” design, the orchestrator and agent loop remain outside the sandbox with the secrets, while the guest holds task context, execution processes, and placeholders.
How the egress proxy enforces policy and injects credentials at the network layer
The proxy first resolves which sandbox originated a request and maps it to the relevant tenant or user. It then evaluates whether that identity may contact the destination and perform the requested action under ALLOW, ASK, or DENY policy. Only after permission is established does substitution occur. The proxy replaces the literal placeholder string in the authentication header with the real credential and forwards the request.
Matchlock’s MITM proxy methodology implements this interception outside the agent’s environment. The agent sends a request containing a placeholder and receives the service response without observing the real token. Destination checks are essential to that separation. A GitHub token must be substituted only for a request to its registered destination.
ASK policy puts human approval at the same boundary. Requests to send an email, modify a record, or make a payment pause before any credential is attached. The proxy also logs every allowed, held, or denied request with identity, destination, action, and timestamp. This creates a per-agent audit trail without instrumentation inside the sandbox. Teams building this layer can inspect the code that enforces the rules in Onyx Craft’s open-source gateway.
Credential scoping and lifecycle management across agent sessions and multi-tenant fleets
Session lifecycle determines how long authority lasts, which need not match how long an agent’s workspace persists. Credentials are provisioned for a task and actively revoked when its session ends. AWS AgentCore illustrates a session-isolated model in which each session receives its own Firecracker microVM. A session can contain many interactions and tool calls, but its microVM is destroyed at completion and its session context is securely forgotten. In persistent hosting, by contrast, the workspace lasts, but keeping it must stay separate from renewing authorization.
Tenant isolation keeps track of whose authority each call uses. Every tool call should carry the tenant, the user acting on that tenant’s behalf, and the invocation context identifying the agent turn. In MCP deployments, credentials should be fetched per invocation from a tenant-scoped secrets backend, retained only in a short-lived context outside the guest, and cleared on completion. They should never be logged or cached beyond the call. A per-URL binding can further restrict an MCP server URL to one connected account through a cryptographically hashed token.
The tenant model must also match the product. Agent-as-tenant fits agents that serve different downstream consumers, while user-as-tenant fits compliance-sensitive workflows and consumer products that need per-user audit trails. Persistent VM hosting, including Maritime’s model, supplies a separate kernel and process namespace for each agent, removing the shared-runtime route to another agent’s credentials.
How snapshot-restore supports per-user persistent AI agent deployment at scale
Persistent context and persistent credentials are not the same requirement. When real tokens stay at the proxy, guest memory contains placeholders for the credentials used for outbound calls. A snapshot preserves execution state with the live-credential exposure path removed.
The same separation supports the economics of persistent fleets. Agent sessions spend much of their time waiting for LLM inference or user input, so always-on compute pays for long idle periods. Snapshot-restore lets a provider keep the state without keeping the VM running. With Maritime’s snapshot-restore scheduler, agents sleep as snapshots, pay for storage rather than idle compute, and wake in under a second. Its flat-rate fleet costs rely on this way of scheduling agents, which lets them sleep between tasks.
Copy-on-write forks also bring isolation and scheduling together. A frozen VM state can branch cheaply into multiple candidate solutions, with the successful branch retained. Each branch gets a separate credential context at the proxy rather than inheriting a real token from the frozen state. The preserved workspace supplies continuity, while the external credential context supplies current authority.
Putting the architecture together — what a production credential injection deployment looks like

A production deployment has five layers with distinct responsibilities. The agent VM supplies a Firecracker guest kernel, placeholder credentials, and a sole outbound route through the proxy. The egress proxy sits outside that VM and evaluates identity, destination, and action before substitution. It also records the decision, making the network boundary both the authorization point and the audit point.
The secrets backend is the third layer: it stores credentials keyed to tenant and service, issues short-lived tokens for each invocation, and revokes them when the session ends. The external orchestrator and agent loop form the fourth layer, dispatching tasks, propagating identity, and managing snapshot and restore. The human-approval queue is the fifth layer. It presents ASK-policy requests with their full context and permits injection only after explicit approval, with denial as the default on timeout.
Maritime can supply persistent VM hosting and snapshot-restore scheduling, while teams add the credential proxy, secrets backend, identity propagation, and approval workflow. Hosting alone is not credential injection. The host needs to control the deployment’s network configuration and egress policy so the guest cannot find another route to external services. That is the connection between the VM’s isolation properties and the proxy’s authority.
The practical assessment starts by confirming that no real credential appears in guest environment variables, configuration files, or agent context. Teams should check the policy and test that all egress except the proxy route is dropped. Every credential should cover only the destinations and actions needed for the task, and session closure should trigger active revocation. Every proxy decision, including a denial, should be logged with the full identity context for the compliance audit trail. The guarantee holds only when all layers preserve the same separation between the agent that requests an action and the system that holds authority to authorize it.


