Interview › Security & DevSecOps
What is OPA, and what is the Rego language used for? [Intermediate]
Answer
OPA, the Open Policy Agent, is a general-purpose policy engine. Rego is OPA's policy language, used to express rules over structured input such as Kubernetes admission requests, Terraform plans, API authorization decisions, or CI metadata.
Technical explanation
OPA separates policy decision logic from application or platform code.
Rego evaluates input JSON and data documents to return decisions such as allow, deny, or violations.
OPA can run in CI, as a sidecar, as an admission controller, or as part of an authorization service.
Hands-on example
Simple Rego pattern:
package kubernetes.admission
deny[msg] {
input.request.kind.kind == "Pod"
container := input.request.object.spec.containers[_]
container.securityContext.privileged == true
msg := "Privileged containers are not allowed"
}Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Security & DevSecOps interview questions
- What is workload identity, and how does it remove static credentials? [Intermediate]
- How do you apply least privilege to service-to-service communication (e.g., with Istio mTLS)? [Intermediate]
- What is secrets management, and how does HashiCorp Vault work at a high level? [Intermediate]
- What is encryption at rest versus in transit, and how do you ensure both? [Advanced]
- What is the difference between symmetric and asymmetric encryption? [Advanced]
- What is certificate management, and how do tools like cert-manager help? [Advanced]
- What is the difference between authentication and authorization? [Advanced]
- What is vulnerability management as a lifecycle (discover, prioritise, remediate, verify)? [Intermediate]