Skip to content

S09-10 - Approval Flow

Purpose: How an approval request for a name behaves, from the lookup that raises it to its answer or its expiry.

host: trusted guest: untrusted agent's tool looks up a name, retries if it failed guest OS daemons background list wb-netd holds the answer 4 s, then NXDOMAIN, TTL 0 one event per name background list: no event wb-hostd one request per name a new request id risk check boundary check expires when its sessions end user notification wb approve <id> event answer allow approved within the hold: the waiting lookup succeeds stale id: refused
The approval flow. The agent's tool and the guest's own daemons look up names in wb-netd. For a name not on the allowlist, wb-netd holds the answer for 4 seconds, then answers NXDOMAIN with a TTL of 0, and raises one event per name. Names on the background list raise none. wb-hostd opens one request per name with a new id, runs the risk check and the boundary check, and notifies the user. The user answers with the request's id. An approval within the hold lets the waiting lookup succeed. An answer with a stale id is refused, and a request expires when its sessions end.

The VM is the unit for each rule here. The host can’t tell which session looked a name up (S07-01-per-vm-policyS07-01-per-vm-policy: Enforced per VMWhy the VM is the unit the gateway enforces, how the policies of its projects combine, and what happens when they conflict or change., I36I36 (closed): S07-egress-gateway: attribute network flows to projects in the shared work VMThe work VM hosts every trusted project, and its wb-netd sees one guest MAC and one leased IPv4 address (S07-egress-gateway "Addressing").).

wb-netd holds the answer to a refused lookup for 4 seconds (S07-04-dns-refusalsS07-04-dns-refusals: DNS RefusalsHow wb-netd refuses a name: approval events, the hold before each refusal, quiet refusals, and the answer that is the same for every reason., “Hold”).

These don’t raise a request (S07-03-dnsS07-03-dns: DNSHow wb-netd answers the guest's DNS queries: synthetic addresses, the name form, negative answers and the wildcard budget., and S07-17-approvals-and-learningS07-17-approvals-and-learning: Approvals and LearningHow an unknown destination reaches the user as an approval request, what an approval grants, and how learn mode collects names.):

  • a name on the guest OS’s background list;
  • a host refused with profile-part-off;
  • a name that fails the name form rule;
  • a name collected in a learn period.

The image turns off the services behind the background list where it can (X17-image-buildX17-image-build: Unattended image buildCan a macOS guest installed from an Apple restore image get past Setup Assistant, with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks, or MDM?).

A VM has at most one open request per name. Later lookups of that name join it, and are counted on it.

The request shows the count in its body, as guest-driven: “the guest looked this up N times”. It never shows it in the notification’s title.

Each request has an id that wb-hostd never reuses. The notification’s actions, wb approve <id> and wb deny <id> name it. An answer applies only to the request with that id.

An answer whose id doesn’t name an open request is refused, and logged with the rule approval-stale. An example is an answer for a request that expired or was replaced.

So an old answer can’t apply to a newer request for the same name. The newer one may have other sessions or other risk-check findings.

An answer can be refused because the VM’s sessions changed (S07-04-dns-refusalsS07-04-dns-refusals: DNS RefusalsHow wb-netd refuses a name: approval events, the hold before each refusal, quiet refusals, and the answer that is the same for every reason., “Session set at the answer”). Then:

  1. the request closes, and its notification is withdrawn;
  2. a new request, with a new id and the current set of sessions, replaces it;
  3. the risk check runs again, against the VM’s current union.

The new request’s 5019 event names the old id. The host caused the replacement, so it doesn’t count against the rate of new requests.

wb approve and wb deny need an id. Without one they are refused, and the error lists the pending ids (S05-cliS05-cli: Command Line InterfaceSpecify wb, the single user-facing command.).

So the user answers the request they read, not one the guest swapped in after it.

Each VM has two limits, fixed in code:

  • 16 pending requests;
  • 10 new requests a minute.

The guest chooses which names it looks up. So it could raise requests to wear down the user’s attention (T04-bad-approvalsT04-bad-approvals: Bad approvalsA user approving a malicious request or merging a malicious change despite the flags.). These limits are the control against that. They bound the prover runs too (SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.).

wb-hostd keeps each VM’s count of pending requests and its rate of new requests. It applies both limits to every approval event it receives.

An event over either limit is dropped, and logged with the rule approval-pending-cap or approval-rate. It doesn’t raise a request, so the user sees no notification for it.

So a compromised or restarted wb-netd can’t raise more requests than the limits allow.

wb-netd checks both limits when the query arrives, only to decide the answer and the hold. It checks them under the lock of the one-open-event-per-name check (S07-04-dns-refusalsS07-04-dns-refusals: DNS RefusalsHow wb-netd refuses a name: approval events, the hold before each refusal, quiet refusals, and the answer that is the same for every reason., “Same answer for every refusal”).

A name over either limit is refused at DNS, with the same answer and hold as any unknown name, without a request. It is logged with the same rule. These refusals are aggregated per rule (S07-02-packet-pathS07-02-packet-path: Packet PathHow wb-netd carries the guest's frames: the packet transport, the stack, the link filter, its caps, addressing, the MTU and connections., “Events and rate limits”).

wb status shows the VM’s pending requests, and the count of names refused under each limit since the VM started.

A request has no wall-clock timeout. It stays pending, in wb status and as a notification, until:

A replaced request’s set is the one it was replaced with. So a request replaced with sessions A and B doesn’t expire when A ends.

A request that expires has its notification withdrawn. The expiry is a Device Config State Change (5019) event, with the name, the sessions and the rule approval-expired.

An expired request grants nothing. The next lookup of the name raises a new request.

A notification, wb approve, wb deny and wb status show a name in ASCII: as wb-netd received it, but in lowercase and without a trailing dot.

The name form rule lets only letters, digits, hyphens and dots through (S07-03-dnsS07-03-dns: DNSHow wb-netd answers the guest's DNS queries: synthetic addresses, the name form, negative answers and the wildcard budget., “Name form”). The display code still escapes every other byte as \xNN, as a second layer.

An internationalized name arrives in punycode, with labels that start with xn--. It is shown in that form.

wb-hostd decodes such a name with the IDNA 2008 lookup rules. It shows the Unicode form next to the ASCII form, marked as decoded.

When a label fails to decode, no Unicode form is shown. The request shows a warning that the name isn’t a valid internationalized name.

A warning next to the Unicode form names the reason when a label mixes scripts, or the name holds a confusable character. The rule the user approves always holds the ASCII form.

  • Mixed scripts: a label holds letters from more than one script (UTS 39, Single Script). Characters of the Common and Inherited scripts, such as digits and hyphens, don’t count.
  • Confusable: a non-ASCII character that Unicode’s confusables.txt (UTS 39) maps to a prototype in another script, or to an ASCII letter or digit. ASCII characters never count, so bücher1.de doesn’t warn.

The decoder and the script check read bytes the guest chose. So they have a fuzz target (C03-policy-and-approvalsC03-policy-and-approvals: Policy and ApprovalsThe test cases for network policy: loading it, combining the policies of the projects in one VM, modes per host, profile parts, learn mode, and the approval flow.).

“Allow for this session” is shown as “for this VM until these sessions end”, with the sessions listed (S07-17-approvals-and-learningS07-17-approvals-and-learning: Approvals and LearningHow an unknown destination reaches the user as an approval request, what an approval grants, and how learn mode collects names., “Who an approval reaches”).

How an approval request for a name behaves, from the lookup that raises it to its answer or its expiry.

Status: Draft