S09-04 - Boundary Check
Purpose: The check of a project’s policy against the boundary policy with OpenShell’s prover, and which policy it checks when.
Design
Section titled “Design”Boundary check
Section titled “Boundary check”The boundary policy is the most a project may ever be allowed. The merged project policy is checked against it with OpenShell’s prover:
- at
wb trust; - whenever the repository configuration of a project with
config_trustchanges.
The prover runs as an external program (S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice.):
openshell-prover check --output json.
A policy is accepted only when the result is within_boundary and
coverage.domains lists network_l4 and network_rest.
- A policy that exceeds the boundary is refused, and the prover’s counterexample is shown.
- Every other result refuses the policy too:
unsupported,inconclusive,error, or a missing or unknown field. The prover’sreason_codeand reason are shown and logged.
The default boundary ships with Wraith Box. An organization may supply its own.
How the prover runs
Section titled “How the prover runs”The prover parses repository bytes, so it doesn’t run with
wb-hostd’s access.
wb-hostdwrites the candidate and the boundary to two documents.wb-hostdstartswb-proverthroughwb-launcher(S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.).wb-proversets its memory cap on itself, before it runs the prover, becausewb-hostdisn’t its parent.wb-proverconfines itself to those descriptors, with no network.wb-proverruns the prover with fixed arguments.
The two documents and the pipe for the result are inherited
descriptors, never paths in the request. So wb-prover adds no
exception to the launcher’s “no arguments” rule. The prover reads them
as /dev/fd/N, or wb-prover copies them into its own confined
temporary directory first.
wb-hostd kills wb-prover past a wall-clock limit. A kill or any
non-zero exit refuses the policy (SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts.,
SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.).
Which binary
Section titled “Which binary”The prover comes from the installed bundle, re-signed with Wraith Box’s signing identity at release.
Before it runs the prover, wb-prover checks the binary’s SHA-256
against the value pinned at release. A mismatch refuses the policy, and
is a Detection Finding (2004) event.
The release checks OpenShell’s build attestation, not the run (S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice.).
Output
Section titled “Output”wb trust shows the prover’s reason and counterexample stripped of
control and escape sequences, as approval text is.
The user’s own policy
Section titled “The user’s own policy”User policy
Section titled “User policy”The user’s global and project network rules are checked against the
boundary too. That happens at session start and whenever they change,
also for a project without config_trust.
The candidate is what the VM enforces (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.):
- the global rules;
- the rules of every project with a session in the VM;
- the built-in profiles.
It is projected the same way (“Built-in profiles in the check” below).
A failing check refuses the session start. The reason, the project and the rule that caused it are shown and logged.
Changes while sessions run
Section titled “Changes while sessions run”A change that narrows the union applies without this check. Narrowing means the new union allows a subset of what the old one allowed.
These widen:
- removing a
deny_rulesentry; - loosening a limit;
- weakening a mode;
- any change that moves a host and port from
enforcetoaudit, such as removing the lastenforceendpoint on it (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”).
A change that widens and fails the check, or can’t be checked, is
refused. The VM then keeps its last policy that passed, and
wb policy explain shows the change as pending (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., “Policy changes while sessions run”).
A recompute when a session ends goes through the same check when it widens the union. On failure, the departing project’s denies, limits, modes and parts that are off stay as a held source (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”).
The result is cached on the SHA-256 of the candidate and of the boundary. So an unchanged policy adds no prover run to session start (NFR01-startupNFR01-startup: StartupGoals: a warm VM reaches the Claude prompt in about 4 s and a suspended VM in about 7 s, and no start takes more than 10 s (p95), excluding first-time project setup and the first boot after a host restart.).
What the prover covers
Section titled “What the prover covers”What the prover models
Section titled “What the prover models”At v0.1.2 the prover compares hosts, ports and programs, and method and
path rules on protocol: rest endpoints in enforce mode.
It answers unsupported for:
- GraphQL and WebSocket rules;
- query matchers;
- a host and port that has both a REST endpoint and one without rules (X24-openshell-artifactsX24-openshell-artifacts: OpenShell artifactsDo the OpenShell parts that S07-egress-gateway, S09-policy-credentials-audit and S10-tech-stack build on exist in the assumed form, under a permissive license, at a version that can be pinned: the networkpolicies sche…);
- an endpoint in
auditmode.
The candidate never holds an endpoint in audit mode. Wraith Box
writes it as the whole host in enforce mode (S09-01-policy-filesS09-01-policy-files: Policy FilesWhere policy is written, the network policy schema Wraith Box accepts, how the prover sees it, and narrowing by program and project., “Audit as the whole host”).
Built-in profiles in the check
Section titled “Built-in profiles in the check”The candidate holds the parts of the built-in profiles that are on (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”). No built-in rule is left out.
- The candidate holds the git hosting profile on every host that a project’s remotes name, with the GraphQL path of that host’s kind.
- A host whose kind isn’t known doesn’t add an allow rule until the user sets its kind.
An organization’s boundary limits these rules like any other rule. The default boundary allows every rule of every built-in part as the prover sees it.
GraphQL
Section titled “GraphQL”The prover can’t model GraphQL rules, and the git hosting profile has
them (S07-egress-gatewayS07-egress-gateway: Egress GatewayThe only path from a guest to any network: a userspace network stack (wb-netd) and a policy-enforcing proxy (wb-proxyd) on the host.). So the candidate holds each built-in GraphQL
rule as a REST rule. That rule allows POST to its GraphQL path on its
host, such as POST api.github.com/graphql.
The REST rule allows every operation the GraphQL rule allows, and more. So a candidate inside the boundary with the REST rule is inside it with the GraphQL rule too.
By source, not by shape
Section titled “By source, not by shape”The default boundary admits that projection because it comes from a built-in rule.
A user or repository rule that can match a request to a built-in host’s GraphQL endpoint is a load error (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.). So no other source can put a rule of that shape in the candidate.
The built-in operation filter applies to every request on that endpoint. It denies mutations unless the operation name is allowlisted.
The gap
Section titled “The gap”The boundary then limits whether a host’s GraphQL endpoint is reachable, not which operations are allowed on it.
An organization that wants no GraphQL on a host forbids the endpoint in
its boundary. The check then refuses every session start until the user
turns that part off, such as the GitHub graphql part.
wb policy explain shows each such rule as “boundary-checked as POST
to its endpoint”, and the docs list them.
Only built-in rules
Section titled “Only built-in rules”A user or repository rule the prover can’t model still refuses the policy.
Merge rules
Section titled “Merge rules”The merge rules still hold (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.). So user or repository policy can’t replace or weaken a built-in rule.
Decisions
Section titled “Decisions”Check the user’s own policy too
Section titled “Check the user’s own policy too”- Why: approvals are bound by the boundary (S09-09-approvalsS09-09-approvals: ApprovalsWhat an approval adds, the checks that each request goes through, and approvals for a joining project.).
- Decided: I35I35 (closed): X24-openshell-artifacts: OpenShell artifactsX24-openshell-artifacts (added to S11-verification-and-spikes in #14) (B35-openshell-artifactsB35-openshell-artifacts: Do the OpenShell parts the specs reuse exist as assumed?Yes, with conditions.).
Built-in GraphQL rules are checked as POST to their endpoint
Section titled “Built-in GraphQL rules are checked as POST to their endpoint”The brief’s option C, applied to the built-in rules.
- Decided: I35I35 (closed): X24-openshell-artifacts: OpenShell artifactsX24-openshell-artifacts (added to S11-verification-and-spikes in #14) (B35-openshell-artifactsB35-openshell-artifacts: Do the OpenShell parts the specs reuse exist as assumed?Yes, with conditions.), in the addendum to decision 1.
Status: Draft