On 12 November, Alibaba Cloud's community blog published a hands-on account by Hosung Kim of reducing an agent code sandbox to a single exit, the AI Gateway, and then discovering that the lockdown still leaked. The post is worth reading for a narrow reason: it does not show how to stop a prompt injection. It measures what leaves after one has already succeeded, and it publishes the exit the author missed on his first pass.
The starting distinction is the one most agent-security writeups skip. A tool-call hook inspects what the agent intends to do. Code running inside the sandbox that opens a socket is not a tool call; it is plain network traffic, and it never passes through the hook. The author is explicit that he did not reproduce an injection at all. He assumed the agent had already fallen for one and ran, by hand, the code it would then have executed. That makes the exercise an egress measurement rather than a test of injection resistance. Read as containment-after-failure, it is the right shape.
The target topology has four layers. The sandbox sits on a dedicated vSwitch with a custom route table that carries no default route. A NAT gateway with SNAT entries exists only for the gateway's vSwitches. The sandbox security group allows TCP 443 to the gateway's private address and denies everything else at a lower priority. The gateway holds the real Model Studio key; the sandbox carries a consumer key valid only at that gateway. Guardrail, PII masking, a per-consumer token quota and access logging all sit on the single permitted path.
Two implementation details carry more weight than the diagrams. First, the route table, not the security group, is what keeps the sandbox off the internet. Second, allow rules alone block nothing: a default security group permits all outbound traffic, so the deny-all rule is what does the work. A related trap is that creating the NAT gateway inserts an internet route into the system route table automatically, which is why the sandbox has to be moved onto its own table before the NAT is attached.
The experiment itself is unusually clean. One body of test code runs unchanged in two AgentRun Code Interpreter templates that differ only in network mode. Both environments hold exactly three values: the gateway address, the consumer key, and a fake CANARY_SECRET. Neither holds the model key. From the public template, an external site answered 200 in 0.05 seconds, a direct model API call reached the endpoint and returned 400 for lack of a key, and a webhook POST carrying the canary returned 200 and arrived outside. From the private template, all three timed out, while a gateway call returned 200. Because the code is identical, configuration is the only variable, and the attribution is causal rather than correlational.
Then comes the finding that justifies the post. With the internet route gone, the NAT scoped and the security group denying, DNS still worked. Direct queries to public resolvers timed out, but queries to the VPC resolver were answered, and that resolver looked the names up externally on the sandbox's behalf. A query for a hostname beginning with canary-not-a-real-key-001 was answered by the external authoritative name server for the domain. The canary therefore left the sandbox with no HTTP request and no layer-3 route of its own.
The reason is structural rather than a configuration slip. A recursive resolver is an authorised client acting for the workload. Permitting port 53 to it delegates resolution, and the resolver's own upstream path is not constrained by the sandbox route table or the NAT scope. Egress control is usually framed as a question about destinations: which addresses may this workload reach. A name lookup is a question asked on the workload's behalf, so the destination model does not describe it. Blocking an address range does not block a question about a name.
The fix cost nothing: the author removed the four port-53 rules to the VPC DNS servers, two UDP and two TCP, and left the two outbound rules in place. The sandbox then resolved nothing, so the external site, the direct API call and the canary upload all failed at name resolution, while the gateway still answered 200 when called by pinned IP. The trade-off is real. No name resolution means calling the gateway by private IP with a resolve override or a hosts entry, and that IP now lives in two places that must change together. Package installs and web reading need a pre-baked image or an in-VPC mirror. Per-domain control is deferred to Cloud Firewall's DNS Boundary Firewall, which the author says he did not test.
The limits are stated plainly, and they matter. The author confirmed from sandbox-side responses that the query reached an external authoritative server, but he did not run a receive log on a domain he controls. That is the distance between a channel that provably exists and a full exfiltration proof, and the post does not claim the latter. The test matrix also covers DNS only: instance metadata endpoints, logging agents and any in-VPC service reachable under the allow-443 rule sit outside it. Finally, the stack is one vendor in one region, with no throughput or latency numbers for the extra hop, so the cost of the chokepoint is unmeasured.
What the gateway enforces is reported with the same concreteness. A call without a consumer key returned 401. A DAN-style prompt was blocked at promptAttack level high, and the author warns that the block still returns HTTP 200 with a model field of from-security-guard, so status codes are not the verdict. Masked values reached the model and were restored for the caller only after one particular flag was set, which he verified by asking the model to count asterisks rather than by trusting the response. A 500-token daily quota cut off on the fifth call because metering lags, so hard budgets need margin. And if request bodies are logged, the log becomes a store of personal data unless masking covers it.
One failure mode generalises beyond this stack. Enabling the guardrail through the API switched off the consumer authentication that was already on, because the update replaces the whole configuration instead of patching it; binding the HTTPS domain did it again. Automated changes to a security chokepoint can silently disable another control. The practice the post demonstrates, re-checking after every change that a keyless call still returns 401, is worth more than any individual setting.
The wider lesson is about how exits are counted. A sandbox with no default route and a deny-all security group still had a name-resolution path that carried attacker-chosen labels to an external server, and nothing in the destination-based model described it. Teams that enumerate the internet and stop there will miss the resolver, and the same reasoning applies to any service the environment is allowed to ask on its behalf. The pairing the author describes, a hook for intent and the gateway plus network for destination, holds only if the enumeration is complete. The value of the post is that it publishes the enumeration he got wrong, and the test that showed him.