Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Open Policy Agent is a general-purpose policy engine that separates authorisation decisions from application code. Policies are written in Rego and return JSON answers to JSON questions.

What Is Open Policy Agent?
Open Policy Agent, usually shortened to OPA, is a policy engine that answers one kind of question: given this input, what does policy say? You hand it a JSON document describing a request, it evaluates the rules you have loaded, and it returns a JSON decision. What that decision means — allow the API call, reject the Terraform plan, filter these rows, admit this pod — is entirely up to the system that asked.
It was created at Styra by Tim Hinrichs and Torin Sandall in 2016, donated to the Cloud Native Computing Foundation, and graduated there in 2021.
The problem OPA addresses is familiar in any system that has grown for a few years. Authorisation logic ends up scattered across services, written differently in each language, impossible to audit centrally, and requiring a deployment to change. Moving those rules into a dedicated engine makes them reviewable, testable, and changeable without touching the applications.
Evaluation uses two documents. input is the question — the request, the user, the resource. data is the context the engine already holds: role mappings, approved regions, a list of exempt accounts, pushed in by whatever system owns that information.
Policies are written in Rego, a declarative language derived from Datalog. It reads oddly at first because rules are defined by what makes them true, not by a sequence of steps:
package authz
default allow := false
allow if {
input.method == "GET"
input.path[0] == "reports"
input.user.roles[_] == "analyst"
}
allow if {
input.user.roles[_] == "admin"
}
Several rules with the same name are alternatives: the decision is true if any of them holds. The underscore iterates over a collection. A default makes the deny-by-default behaviour explicit, and omitting it is one of the most common ways a policy ends up weaker than intended. OPA 1.0, released at the start of 2025, made the newer Rego syntax with if and contains the default, so older examples found online may need adjusting.
Rego ships with a built-in test framework. A policy without tests is a liability, because the failure mode of an authorisation rule is silent over-permission.
Deployment is flexible: a daemon exposing a REST API, a Go library embedded in your service, or a policy compiled to WebAssembly and evaluated in-process. The daemon is the common choice because it keeps policy distribution separate from application releases.
Two features matter for anyone who will be audited. The bundle API lets OPA pull signed policy and data archives from an object store or registry on an interval, so updating a rule across a hundred instances is a publish rather than a deployment. Decision logs stream every evaluation, with its input and result, to a collector.
Those logs are unusually useful evidence. For ISO 27001 or a customer security review, being able to show every access decision for a six-month period, with the policy version that produced it, is a stronger answer than a document describing intended behaviour. It is also a privacy consideration: decision inputs often contain personal data, so apply retention limits and the same protections you would give any other log under UK GDPR.
Rego is genuinely hard for the first fortnight, and teams underestimate this. Evaluation adds latency to every request that consults it, which is manageable with a sidecar and unacceptable over a wide-area network. Centralised policy also creates a central failure point — decide what happens when OPA is unreachable, and make that choice explicit rather than discovering it during an incident.
Used well, it turns scattered conditional logic into policy as code that can be reviewed, versioned, tested, and proven.
No, although Kubernetes admission control through Gatekeeper is how most teams first encounter it. OPA is a general engine: it authorises API calls, gates Terraform plans, filters database queries, enforces rules in continuous integration, and makes decisions for Envoy and Kafka. Anywhere a system needs to ask whether something is permitted and can express the question as JSON, OPA can answer it.
OPA is the engine and Rego is its language. Gatekeeper is a Kubernetes-specific project that packages OPA as an admission controller, adds constraint templates and constraints as Kubernetes resources, provides an audit loop over existing objects, and manages the webhook. You can run bare OPA as an admission controller, but Gatekeeper handles the operational detail that makes it workable.
OPA includes a test framework. Write rules in files whose names begin with test_ in the same package, assert the expected decision for a given input, and run opa test with coverage reporting. Treat authorisation policies like any other security-critical code: tests for the allow cases, tests for the deny cases, and a test that proves the default denies when no rule matches.
It adds latency proportional to policy complexity and the size of the data it must search. A simple policy evaluated by a local sidecar typically costs single-digit milliseconds, which most applications absorb easily. Problems appear when policies iterate over large replicated datasets or when the engine is called across a network. Benchmark with production-sized data before committing to an inline authorisation path.
You May Be Interested In These
Cybersecurity Terms
17 November 2026
What Is Physical-Cyber Convergence in Critical Infrastructure?
Read More
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.