Policy Projection
Projection turns the policy an enterprise authored into the form each enforcement surface understands. One signed bundle can feed several surfaces: the runtime’s sandbox configuration, the runtime’s provider catalog, and APF’s own decision engine. Each surface gets only the part of the policy it can enforce.
Projection happens once, when the policy service loads a bundle. Nothing is lowered at sandbox admission or on the request path. The interceptor fetches documents that were already projected. The gateway builds its Cedar evaluator from the served policy set, and the interceptor converts provider profile YAML to OpenShell’s format when it reconciles profiles.
Compilation Pipeline
The compiler in apf-compiler runs three stages on the verified bundle members.
- Frontend. Each member is routed by its
kindand parsed into APF’s canonical intermediate representation, which mirrors the protobuf contracts incontracts/proto/. The frontend rejects unknownspecfields, aPolicyRulewhoselanguageis notcedar, and adatablock that is not a mapping. A member whosekindis not recognized is skipped without an error, unknownmetadatakeys are allowed, and passthroughProviderProfiledocuments are not parsed. - Passes. Substrate-neutral transforms over the IR. The pass pipeline is empty in this release.
- Projectors. Each registered projector lowers the aggregate IR to one runtime’s native surfaces. The policy service registers the OpenShell projector.
The compiler also emits two surfaces itself, independent of any projector: the apf.policy.v1 policy set and the openshell.provider-profile.v1/default profile set.
Surfaces
OpenShell Sandbox Policy
The OpenShell projector lowers each APF SandboxPolicy to the OpenShell SandboxPolicy protobuf at the pinned OpenShell version. The two schemas are structurally aligned. The differences are:
- APF documents are nested as
metadataandspec. The OpenShell target is flat and carries a schemaversionof1. - Endpoint
tls,enforcement, andaccessare authored as strings and projected as OpenShell enums. An unknown value is a projection error, so the bundle does not load.tls: terminateandtls: passthroughproject successfully, but OpenShell 0.1.x rejects them at admission. landlock.compatibilityis passed through as a string without a check. OpenShell acceptsbest_effortandhard_requirement.- MCP
versionsare left empty, each middleware entry’sconfigis left unset, and endpoint request-signing fields are left empty. - APF sets OpenShell’s internal
advisor_proposedfield tofalseon every endpoint. Policy authors never set it. network_middlewaresentries are projected into the OpenShell policy’snetwork_middlewaresmap, which is how OpenShell selects APF’s middleware for the listed hosts.- Endpoint
credential_bindingis always projected as unset, andallow_uninspected_credentialsasfalse. - Binary
harnessflags are not projected.
OpenShell Provider Profiles
An APF Provider document is composed into an OpenShell provider profile YAML document.
A bundle may also carry OpenShell-native provider profiles, either as kind: ProviderProfile documents or as profiles with a top-level id and endpoints and no kind. These pass through unchanged. If a Provider and a passthrough profile share a name, the composed Provider wins.
Refer to Credential Integration for how credential sources are projected.
What Is Not Projected
HostTooldocuments are recognized when a bundle is loaded, but no surface is built from them in this release.- No projector emits OpenShell OPA or Rego policy. Cedar policy ships to APF’s own evaluator as source in
apf.policy.v1, and OpenShell receives only its declarative sandbox policy and provider profiles.
Adding a Runtime
A new runtime needs a new projector that implements the Projector trait from apf-compiler and is registered with the compiler in the policy service. The frontend, the passes, and the other projectors do not change. Refer to APF Adapter.
Next Steps
- To see how the sandbox projection reaches OpenShell, refer to Sandbox Admission.
- To author the documents that are projected, refer to Sandbox Policies.