Compile and Sign a Bundle
Signing turns a reviewed set of policy documents into a bundle a policy service will accept. apf-compile genfixture hashes every member listed in a manifest template, writes the digests into the manifest, and signs it. Run it in your authoring and publish path, not on an APF host.
Write the Manifest Template
The template is the manifest with a placeholder in place of each digest. List members in manifest order and increase policy_revision for every change you publish.
Sign
For each manifest entry, in order, the command reads the member file, computes the SHA-256 of its bytes, and replaces the next REPLACE_WITH_DIGEST placeholder in the template text. It then signs the filled-in template and writes the payload followed by the signature document.
The whole template text is the signed payload, including comments. Anything you change in the signed file afterward, including whitespace, invalidates the signature.
The command fails if the template has fewer placeholders than manifest entries. Keep exactly one placeholder per member, in manifest order. Do not write the placeholder text anywhere else in the template, including comments, and do not mix placeholders with literal digests. An extra placeholder shifts every digest after it to the wrong member, and the signed bundle is then rejected with manifest_hash_mismatch or manifest_hash_unset.
For the demo bundle, mise run sign-bundle runs this command with the repository’s development key.
Verify the Signed Bundle
Verify the result with the trust roots your hosts use before you publish it:
Then build the evaluator against a local gateway to catch Cedar and annotator errors. Refer to Validate and Test Policies.
Package for Distribution
A local policy source reads the signed manifest directly. An HTTP policy source fetches a gzipped tar archive of the bundle directory. Create it from inside the directory so paths stay relative to the manifest:
Refer to Publish and Distribute.
Signing in CI
APF does not ship a signing pipeline. A conventional GitOps flow is:
- Teams open pull requests against the bundle directories they own.
- Review and checks run on the pull request: schema validation, offline compilation, and an evaluator build.
- On merge to the main branch, CI detects which bundles changed.
- CI signs each changed bundle with the signing authority’s key, held in the CI system’s secret manager or a signing service, never in Git or in the artifact.
- CI publishes each signed bundle, versioned by revision, to your artifact store.
Any process that produces a correctly signed bundle and publishes it where the policy service can read it is compatible. GitOps is a convention, not a requirement.
Next Steps
- To deliver the bundle to hosts, refer to Publish and Distribute.
- To understand each check the policy service runs, refer to Verify and Activate.