Rego is the declarative policy language used by Open Policy Agent (OPA). This tile covers writing and testing Rego policies for Kubernetes admission control, Terraform and infrastructure-as-code plan validation, Docker container authorization, HTTP API authorization, RBAC and role-based access control, data filtering, metadata annotations with opa inspect, and OPA policy testing with opa test.
96
94%
Does it follow best practices?
Impact
97%
1.18xAverage score across 32 eval scenarios
Low
Low-risk findings worth noting
{
"context": "Evaluates whether the agent correctly handles a Terraform repeatable HCL block (capabilities { ... }) that serializes as a list of 0-or-1 objects in plan JSON, rather than treating it as a bare object. This is the pattern behind a real production bug: object.get(capabilities, \"drop\", []) silently fails to match when capabilities is [] rather than {}, so the rule never fires and the check appears to work in tests that mock the wrong shape.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Deny when capabilities block is absent (empty list)",
"description": "A deny rule triggers when a docker_container resource has `capabilities` equal to `[]` (the real plan-JSON shape for 'no capabilities block configured') — not just when the `capabilities` key is missing entirely from the mock input",
"max_score": 30
},
{
"name": "Deny when drop does not include ALL",
"description": "A deny rule triggers when `capabilities` is a non-empty list whose first element's `drop` array does not contain `\"ALL\"` (e.g. `[{\"drop\": [\"CHOWN\"]}]`)",
"max_score": 20
},
{
"name": "Capabilities read as a list, not an object",
"description": "The policy iterates or indexes `capabilities` as a list (e.g. `some c in object.get(container.change.after, \"capabilities\", [])` or equivalent), rather than calling `object.get(capabilities, \"drop\", ...)` directly on the field as if it were a bare object",
"max_score": 25
},
{
"name": "Tests use the real list-shaped mock, not a bare-object mock",
"description": "Test fixtures represent `capabilities` as a list (`[]` or `[{\"drop\": [...]}]`), matching real `terraform show -json` output for a repeatable block — not as `{\"drop\": [...]}` or `{}`",
"max_score": 25
}
]
}.tessl-plugin
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
skills
rego-domain-reference
references