Scenario
An implicit deny that looked like an outage
RolesAgent Systems EngineeringCustomer AI Deployment
- Engine
- sbx v0.47.0
- Model
- none; shell commands inside the sandbox
- Hardware
- one Mac with the microVM runtime
Situation
A shell agent in a sandbox is asked to fetch a page from example.com as the first step of a larger task. It reports back that the network is down inside the sandbox and asks the operator to repair the connection. The operator pastes the agent's command into sbx exec and gets a reply within a second, so nothing timed out. The sandbox was created with the balanced preset and no rule of its own.
The team's first guess is a broken proxy, because the reply holds two status lines that disagree. The second guess is a DNS failure. You have the two requests the operator ran, the policy check for that host, the policy log, and the commands that changed the rules afterwards.
Questions
- The HEAD request printed two status lines and exited 0. Which component sent each line, and why is the exit code 0?
- The check says implicit and names no rule. What decided the request?
- The log shows two allowed hosts with different proxy paths. What does forward-bypass tell you?
- After the allow rule, what changed in the first status line of the same request?
- An explicit deny gives a different body. How do you tell the two denials apart from inside the sandbox and from the host?
- Why was the deny rule refused the first time, and what is the right order of operations?
Commit to a cause after each listing. Write it down before you read the next one.
Evidence
a HEAD request and a GET request to example.com from inside m101-policy
Read the two status lines of the first request, the body of the second, and the exit codes.
$ sbx exec m101-policy sh -c 'curl -sS --max-time 10 -I https://example.com; echo exit=$?'
HTTP/1.1 200 OK
HTTP/1.1 403 Forbidden
Content-Length: 90
Content-Type: text/plain
exit=0
[exit 0]
$ sbx exec m101-policy sh -c 'curl -sS --max-time 10 https://example.com; echo; echo exit=$?'
Approval required for example.com:443.
Review and respond with:
sbx policy approval ls
exit=0
[exit 0]Source: manuals/docker-sandboxes-101/capture/out/09-blocked.txt
the decision for example.com from sbx policy check network
Read deny_kind and reason.
{
"action": "net:connect:tcp",
"allowed": false,
"context": "sandbox:m101-policy",
"deny_kind": "implicit",
"governance": {
"active": false
},
"reason": "No matching allow rule (default deny)",
"resource_type": "net:domain",
"resource_value": "example.com:443",
"target": "example.com:443",
"type": "network"
}Source: manuals/docker-sandboxes-101/capture/out/09-check-verbose.json
the policy log of m101-policy
One blocked row with its rule text, and two allowed rows with their proxy path.
$ sbx policy log m101-policy
Blocked requests:
SANDBOX TYPE HOST PROXY RULE REASON LAST SEEN COUNT
m101-policy network example.com:443 forward no applicable policies for op(action=net:connect:tcp, resource=net:domain:example.com:443) No matching allow rule (default deny) <ts> <n>
Allowed requests:
SANDBOX TYPE HOST PROXY RULE REASON LAST SEEN COUNT
m101-policy network download.docker.com:443 forward-bypass <ts> <n>
m101-policy network ports.ubuntu.com:80 forward <ts> <n>
[exit 0]Source: manuals/docker-sandboxes-101/capture/out/09-policy-log.txt
a sandbox-scoped allow rule and the policy list after it
Read the scope in the first reply and the host count in the list.
$ sbx policy allow network --sandbox m101-policy example.com
Rule added to policy local (scope: sandbox:m101-policy): <uuid> (example.com [tcp])
[exit 0]
$ sbx policy ls m101-policy
Policy for sandbox: m101-policy
NETWORK
allow 195 hosts from <uuid>, local-policy
FILESYSTEM
read allow all paths from local-policy
write allow all paths from local-policy
Details: sbx policy ls m101-policy --wide
[exit 0]Source: manuals/docker-sandboxes-101/capture/out/09-allow.txt
the HEAD request after the allow rule
Compare the first status line with the one in the first listing.
$ sbx exec m101-policy sh -c 'curl -sS --max-time 10 -I https://example.com; echo exit=$?'
HTTP/1.0 200 Connection established
HTTP/2 200
date: <value>
content-type: text/html; charset=utf-8
server: cloudflareSource: manuals/docker-sandboxes-101/capture/out/09-allowed.txt, lines 1-7
the GET request after a deny rule replaced the allow
Compare the body with the approval body of the first listing.
$ sbx exec m101-policy sh -c 'curl -sS --max-time 10 https://example.com; echo; echo exit=$?'
Blocked by local rule for example.com:443
exit=0
[exit 0]Source: manuals/docker-sandboxes-101/capture/out/09-blocked-by-rule.txt
a deny rule added while the allow rule still exists
The CLI refuses it and names the rule it conflicts with.
$ sbx policy deny network --sandbox m101-policy example.com
error: deny network rule: deny: "example.com" conflicts with existing allow rule "<uuid>" (name "<uuid>") for tcp
[exit 1]Source: manuals/docker-sandboxes-101/capture/out/09-deny-conflict.txt
The answer
Show the walkthrough
- Read the HEAD request line by line.
HTTP/1.1 200 OKis the forward proxy accepting theCONNECT. TheHTTP/1.1 403 Forbiddenbelow it arrived inside the TLS session, with a 90 byte plain text body, under a certificate the sandbox trusts. curl printed both and exited 0 because it received a complete reply. The GET shows the body: an approval is required forexample.com:443. Nothing was slow and nothing was unreachable. A proxy answered with a decision. - Ask the authorizer.
sbx policy check networkruns the same authorizer as the proxy, without sending anything. For this host in the sandbox context it returnsallowed: false,deny_kind: implicit, the reasonNo matching allow rule (default deny), and no rule. The balanced preset lists 194 hosts, andexample.comis not one of them. The request matched nothing and was denied by default. - Read the log. The blocked row names the host, the proxy path
forward, the rule textno applicable policies for op(...)and the same reason. Two allowed rows show what the preset admits: a package host overforward, and a download host overforward-bypass, a tunnel that the proxy does not inspect. The log says what passed, and the check says why. - Add the narrow rule.
sbx policy allow network --sandbox m101-policy example.comadds a rule in the local scope for that one sandbox, andpolicy lsthen counts 195 hosts. The same HEAD request now begins withHTTP/1.0 200 Connection established, and the origin'sHTTP/2 200follows. The proxy tunnels the connection and no longer speaks. - Compare the two denials. With a deny rule in place of the allow, the GET body reads
Blocked by local rule for example.com:443. The implicit one asks for an approval. On the host, the check reportsdeny_kind: explicitwith the rule id for the second case, andimplicitfor the first. - Mind the order. The deny for
example.comwas refused while the allow for the same host existed in the same scope, and the error named the allow rule. Remove the allow first, then add the deny. Deny wins at evaluation time, but the CLI does not store the pair.
Show the resolution
There was no outage. example.com is not on the allow list of the balanced preset, which has 194 hosts. The proxy denied the connection as an implicit default and answered inside TLS with a 403 and an approval message. A sandbox-scoped allow rule turned the same request into a tunnelled 200 from the origin. The agent's report was wrong in the way the lesson on failure modes predicts: it read one status code and reported a cause it had not checked.
Fixes:
- Change the agent's instructions so that a 403 with an approval body is reported as a policy decision, with the host and the port, so the operator can add a rule.
- Run
sbx policy check network --sandbox NAME host:port --jsonbefore you touch the network, and readdeny_kindandrule. - Add rules with
--sandboxfor one agent, and keep the global policy for hosts every agent needs. Before you add a deny in a scope, remove any allow for that host in that scope.
Show the wrong turns
“Restart the daemon, the proxy returns two different codes.”
Both lines are the proxy doing its job: the first accepts the tunnel, the second refuses the host. A restart changes no rule.
“It is DNS, because example.com does not resolve.”
The request reached the proxy with the host name, and the proxy denied the host by policy. The body, the check and the log all name the host and the port.
“Allow example.com globally so this stops.”
A global rule admits the host for every sandbox. The local scope exists for one agent's need.
“Add a deny rule now so the agent cannot try again.”
The deny conflicts with the allow in the same scope and is refused, and the agent's task needed the host. Fix the report, not the host.
Show the general rule
An agent that reports a failure gives you a claim, not a diagnosis. Reproduce the call outside the agent, read the whole reply and not only the first status line, and ask the policy layer for its decision before you look for a fault in the network. A deny with a body is an answer. A timeout is a fault.
Taught in
The policy page explains the scopes and check network, the proxy page reads the 403 and the log, and the failure modes lesson names the mode where an agent reports a cause it did not check.