Skip to content

C03 - Policy and Approvals

Purpose: The 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.

Verifies: 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. (“Session end”), S07-07-hosts-and-modesS07-07-hosts-and-modes: Hosts and ModesHow wb-proxyd binds a stream to its name, which upstream addresses it refuses, and the inspect, pass and audit modes. (“Modes, per host”), S07-11-http-policyS07-11-http-policy: HTTP PolicyThe HTTP rules of inspected hosts, the built-in profiles, and the parts a user can turn off. (“Profile parts”), 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., 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. (“Deny duration”), S09-02-precedenceS09-02-precedence: PrecedenceHow the policy sources merge, how the mode of each host and port resolves, and how the merge works for a VM with more than one project. (“Mode per host and port”, “The OAuth token paths”), S09-04-boundary-checkS09-04-boundary-check: Boundary CheckThe check of a project's policy against the boundary policy with OpenShell's prover, and which policy it checks when. (“Built-in profiles in the check”), S09-10-approval-flowS09-10-approval-flow: Approval FlowHow an approval request for a name behaves, from the lookup that raises it to its answer or its expiry., S13-guest-confinementS13-guest-confinement: Guest ConfinementControls inside the guest that narrow what a project user's processes can do, and tell the host which program opened each connection.

Spec: S07-07-hosts-and-modesS07-07-hosts-and-modes: Hosts and ModesHow wb-proxyd binds a stream to its name, which upstream addresses it refuses, and the inspect, pass and audit modes., “Modes, per host”.

Spec: 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..

  • End a project’s last session, and see its binding no longer injected, its open streams closed with the rule policy-recomputed, and its project user’s processes stopped.
  • Give two projects different wildcard budgets or minimum ages, start both, and see the stricter one applied to both, including to a count reached before the second one joined.
  • For every host and port of a union, see the mode wb-proxyd applies equal the mode the boundary check projected (S09-02-precedenceS09-02-precedence: PrecedenceHow the policy sources merge, how the mode of each host and port resolves, and how the merge works for a VM with more than one project., “Mode per host and port”). With a boundary that allows only GET on a host:
    • put the host’s port 443 in audit with a GET rule in one project, and add an enforce endpoint with a GET rule on the same host and port in another file. See the start pass and a DELETE to that port refused;
    • then put port 8443 of the same host in audit with a GET rule while port 443 stays in enforce, and see the start refused with a counterexample that names the host, so a DELETE to port 8443 is never sent.
  • Put port 443 of a host in audit in the global policy, with one project’s enforce endpoint with a GET rule keeping it in enforce, and a boundary that allows only GET. Remove that endpoint while sessions run, and separately end that project’s last session while another session stays. See each change checked as widening and refused by the boundary, the host and port held in enforce with a 5019 event, and a DELETE to it still refused.
  • Put github.com, a host a project’s remote names, or a host with a credential binding in audit, in a policy file and as a global entry loaded before a project names the host. Add a binding on a host in audit with wb cred set. See each refused with the host and the rule. Load repository configuration with enforcement: audit, and see a load error (S07-07-hosts-and-modesS07-07-hosts-and-modes: Hosts and ModesHow wb-proxyd binds a stream to its name, which upstream addresses it refuses, and the inspect, pass and audit modes., “Modes, per host”, audit).
  • With the prover unavailable, remove a binding while sessions run, and see it no longer injected and its streams closed. Then add a rule, and separately remove a deny_rules entry, and see each change refused and shown as pending.
  • Start a second project whose policy puts a host in pass mode that the first project binds or inspects, whose binding overlaps the first one’s on the same host, port and path with another secret, or whose rules leave the boundary in union. See the start refused with both projects named and the first project’s policy unchanged.
  • With the prover unavailable, end the last session of a project that held the stricter minimum age, turned a part off, set inspection on a host the other project passes, or had a deny_rules entry. See each kept as a held source, a 5019 event that names the project, and the widening shown as pending, while the project’s binding is no longer injected (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., “Session end”).
  • Deny a name, start and end another session, and see the name still refused with no new approval event until every session running at the deny has ended (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., “Deny duration”).
  • Answer an approval after a session started or ended, and see the answer refused with approval-sessions-changed and the request shown again with a new id.
  • Start a learn-mode session while a session or a debug shell of another project runs, and start another project’s session while a learn-mode session runs, and see each refused with the other project named.
  • Start another project, or an --isolated session, in the isolated VM while a project with placement = isolated has a session there, and the reverse, and see each refused.
  • Start --learn in a project with placement = isolated, and start with --isolated in a project with placement = work and config_trust on, and see each refused.

Spec: S07-11-http-policyS07-11-http-policy: HTTP PolicyThe HTTP rules of inspected hosts, the built-in profiles, and the parts a user can turn off., “Profile parts”.

Spec: S09-10-approval-flowS09-10-approval-flow: Approval FlowHow an approval request for a name behaves, from the lookup that raises it to its answer or its expiry..

  • Look up a burst of unknown hostnames from the guest, and see the approval limits deny the requests past the limit and log each with the rule approval-pending-cap or approval-rate, wb status show the counts, and no more prover runs than the cap.
  • Leave a request unanswered, end every session it records, and see it expire with the rule approval-expired and grant nothing.
  • Look up an xn-- name whose Unicode form mixes Latin and Cyrillic, and one that fails to decode, and see each request show the ASCII form with a warning. Look up xn--bcher1-3ya.de (bücher1.de), and see no warning.
  • Answer a request with wb approve <id> after it expired, and after it was replaced when the VM’s sessions changed. See each answer refused with approval-stale, and the newer request for the same name still pending, its old notification withdrawn.
  • With one request pending, run wb approve without an id, and see it refused with the pending id listed.
  • With 16 requests pending, restart wb-netd, look up a 17th unknown name, and see it refused with approval-pending-cap.
  • From a test wb-netd that skips its own check, send a 17th approval event, and see wb-hostd drop it without a notification, logged with the same rule.

Spec: S13-guest-confinementS13-guest-confinement: Guest ConfinementControls inside the guest that narrow what a project user's processes can do, and tell the host which program opened each connection..

Once X14-flow-attributionX14-flow-attribution: Guest flow attributionA Network Extension transparent proxy in a macOS guest (S13-guest-confinement): can it be approved during the image build without MDM? has delivered labels:

  • Forge or omit a flow label, and see only rules without program narrowing match.
  • Replace a pinned binary, and see its connections denied.

Status: Draft