Policy Schemas
This page lists every field of every document kind a bundle can contain. For the bundle manifest itself, refer to Bundle Specification. For how to write each kind, refer to Author Policies.
Schema Files
The repository publishes a JSON Schema for each authored kind in contracts/jsonschema/.
APF’s services do not load these schemas. They describe the documents for authors and tooling, and the runtime applies its own checks, which differ in places. Validate against the schemas before you sign, as described in Validate and Test Policies, and read Schema and Runtime Differences.
Common Envelope
Every member document has the same four top-level fields.
The schemas forbid metadata.namespace. The runtime accepts it and ignores it.
SandboxPolicy
The sandbox perimeter. APF projects it into OpenShell’s SandboxPolicy and injects it at admission. The projection is served as openshell.sandbox.v1/<metadata.name>.
Network Policy Entry
Network Middleware Entry
There is no config field, because APF’s middleware takes no configuration. The schema allows up to 10 middleware entries and 32 hosts in each list. OpenShell allows 32 include and exclude patterns combined and requires each entry’s order to be unique. APF checks none of these limits.
Network Endpoint
Endpoints are shared by SandboxPolicy network policy entries and Provider documents. Their semantics are OpenShell’s. Refer to the OpenShell policy schema reference for enforcement details.
Layer 7 Rules
The schemas express some of OpenShell’s cross-field endpoint rules, such as requiring access or rules for rest endpoints and forbidding them for tcp. OpenShell enforces more of them at admission. APF does not check these rules, so validate against the schema or rely on OpenShell to reject an invalid policy at admission.
Provider
A provider profile: the endpoints, binaries, and credentials for one external service. APF projects each Provider into an OpenShell provider profile, served as openshell.provider-profile.v1/<metadata.name>, and reconciles it to the OpenShell gateway.
Credential
Credential Sources
material entries have name, description, required, and secret. additionalOutputs entries have output and credential. For oauth2, each parameters key is projected as a required material entry, marked secret when its name contains secret, token, or key. The parameter values and the name of host-env and external sources are not projected. Refer to Credential Integration.
ProviderProfile
A ProviderProfile member is an OpenShell provider profile in OpenShell’s own YAML format. APF passes it through unchanged as openshell.provider-profile.v1/<metadata.name>. A member without a kind that has a top-level id and endpoints is also treated as a provider profile. There is no APF schema for this kind. A Provider with the same name replaces it.
PolicyRule
Cedar Request
APF Annotations
PolicyAnnotator
threshold_from is rejected. Every annotation needs at least one rule. For field selectors and operations, refer to Annotators.
PolicyEffect
Set exactly one of body.replace and body.patches. source must have the form context.annotations.<key>. Refer to Effects and Findings.
PolicyFinding
Other Kinds
The loader also collects HostTool members, but no component uses them in this release.
Schema and Runtime Differences
The runtime checks some things the schemas do not, and skips some things the schemas require.
Several checks run only when the policy gateway builds its evaluator, not when the policy service loads the bundle, so a bundle that fails them still loads and consumes its revision: Cedar syntax and schema validation, @apf_effect and @apf_finding placement and references, effect finding references, annotator field selectors, operands, patterns, output types, rule counts, and key uniqueness, effect body and operand combinations, and source and label_source forms. Duplicate document names are caught earlier, when the policy service loads the members.
Next Steps
- For the manifest that binds these documents, refer to Bundle Specification.
- To check documents before signing, refer to Validate and Test Policies.