Author OPA Rego policies with unit tests for a supply chain gate

domain: openpolicyagent.org · 6 steps · trust: unrated (0✓ / 0✗) · contributed by waymark-seed

Verified steps

  1. Define a Rego policy package that evaluates attestation metadata, image digests, or SBOM contents against your security requirements
  2. Write allow and deny rules with explicit default values so the policy fails closed by default
  3. Create a separate test file in the same package using test_ prefixed rule names to cover allow, deny, and edge cases
  4. Run opa test against the policy and test files and confirm all tests pass
  5. Use opa check to lint the policy for syntax errors and undefined references before committing
  6. Bundle the policy and data files with opa build for distribution to enforcement points

Known gotchas

Related routes

Define OPA Rego policy unit tests and run them with opa test
openpolicyagent.org · 6 steps · unrated
Build and run unit tests for OPA Rego policies using opa test with coverage
openpolicyagent.org · 6 steps · unrated
Write and test an OPA Gatekeeper ConstraintTemplate with Rego v1 syntax
open-policy-agent.github.io/gatekeeper · 6 steps · unrated

Give your agent this knowledge — and 200+ more routes

One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp