Update a Signed Policy
This tutorial changes policy the only way APF allows: a new signed bundle with a higher revision. You add a content rule, publish it, and watch a sandbox that is already running start obeying it.
After completing it, you understand:
- Why every change needs a higher
policy_revision. - How an update reaches the gateway without a restart.
- Which parts of a running sandbox change and which do not.
- Why an older revision cannot be republished.
Prerequisites
- The setup from Your First Signed Policy: native services running with your
$WORK/bundleactive, your key in$WORK/trust-roots, and the policy service HTTP surface on127.0.0.1:19200. This page calls the active revisionN. It is2if you have followed only that walkthrough. - APF registered with OpenShell as described in Add APF to OpenShell, a workload image with
curlat/usr/bin/curland asandboxuser and group, and terminals set up as in Set Up Each Terminal.
Observe the Current Behavior
In the sandbox, send a body that contains the word CLASSIFIED:
The request is allowed. Nothing in revision N looks for that word.
Add a Rule
Keep a copy of the active revision for the rollback step at the end:
Create $WORK/bundle/rules/keyword-gate.yaml:
Add it to the manifest in $WORK/bundle/demo-bundle.template.yaml, after security-content-gate, and set policy_revision to N+1:
Activate It Without a Restart
Ask the policy service to reload the bundle:
Within the gateway’s refresh interval, 10 seconds by default, the gateway notices that the served policy set changed, builds a new evaluator, and swaps it in. Confirm it:
The record carries the new policy_revision.
Observe the New Behavior
In the same sandbox, without recreating it, repeat the request:
The request is denied. Its authorization record carries keyword-gate/deny-classified in error.message and the new policy_revision.
Rules, annotators, effects, and findings reach every sandbox as soon as the gateway swaps its evaluator. The sandbox’s admission annotations are different: openshell sandbox get update-demo still shows apf.nvidia.com/policy-version at N, the revision the sandbox was admitted at. The annotations change only when a running sandbox is refreshed, and the gateway in this setup runs without --openshell-gateway-url, so its sandbox policy refresher is off. A sandbox created now is admitted at N+1. Refer to How Far a Change Reaches.
Try to Roll Back
Ask the policy service to load the copy of revision N you saved:
The refresh fails:
The policy service keeps serving revision N+1 and records the refusal as a policy_verification record with "reason_code":"policy.bundle_rejected.counter_regression". To undo a change, sign the old content as revision N+2.
Next Steps
- To see how tampering is refused, continue with Reject a Tampered Bundle.
- For the full procedure, refer to Update Policies.