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.
99
Quality
Pending
Does it follow best practices?
Impact
99%
1.19xAverage score across 31 eval scenarios
Pending
The risk profile of this skill
_test.rego filename suffix
100%
100%
test_ function prefix
100%
100%
positive and negative test cases
100%
100%
tests pass
100%
100%
_test.rego filename suffix
100%
100%
test_ function prefix
100%
100%
positive and negative test cases
100%
100%
tests pass
0%
100%
_test.rego filename suffix
100%
100%
test_ function prefix
100%
100%
positive and negative test cases
100%
100%
tests pass
100%
100%
import rego.v1
100%
100%
default allow := false
100%
100%
Reads roles from JWT claims
100%
100%
Reads role grants from data
100%
100%
Nested iteration with some
100%
100%
Permission match on action and resource_type
100%
100%
Tests pass
100%
100%
import rego.v1
100%
100%
Partial set rule for violations
100%
100%
Iterates over conflicting pairs with array-of-arrays membership
85%
100%
Reads user roles from data
100%
100%
Tests pass
100%
86%
import rego.v1
100%
100%
default allow := false
100%
100%
JWT decoded with io.jwt.decode
100%
100%
Matches on input.method and input.path
100%
100%
Allow self and manager access
100%
100%
Tests pass
100%
100%
import rego.v1
100%
100%
Set subtraction to detect unknown fields
75%
100%
Checks for required fields
100%
100%
Tests pass
100%
100%
deny contains msg pattern
100%
100%
Checks input.request.kind.kind
100%
100%
Deny rule for privileged containers
100%
100%
Tests pass
83%
100%
violation contains msg pattern
100%
100%
Uses input.review.object
100%
100%
Uses input.parameters for required labels
100%
100%
Tests pass
100%
76%
package has METADATA block with title and description
0%
100%
package has authors or organizations
0%
100%
decision rules have METADATA with title and description
0%
100%
decision rules have entrypoint: true
0%
100%
rules have custom fields
0%
100%
Tests pass
0%
100%
import rego.v1
100%
100%
METADATA block with custom.severity
100%
100%
Uses rego.metadata.rule() at runtime
100%
100%
Violation is a structured object with severity
100%
100%
Tests pass
80%
80%
main response object
100%
100%
Uppercase action strings and CloudFormation input structure
100%
100%
Helper rules for conditions
0%
100%
Three deny rules covering AccessControl and both BlockPublic settings
100%
100%
Tests pass
100%
100%
import rego.v1
0%
100%
object.get input normalization
0%
100%
Tests pass
0%
100%
_test.rego filename suffix
100%
100%
mocks Terraform plan input with `with input as`
100%
100%
includes both positive and negative test cases
100%
100%
tests pass
100%
92%
Uses walk() built-in
100%
100%
Collects resources from all modules
60%
100%
Deny rule for HTTP in description
100%
100%
Tests pass
0%
80%
Provider region check via configuration path
100%
100%
EU data residency deny rule
100%
100%
has_replication helper with multiple function heads
85%
100%
Tests pass
100%
100%
action != delete exclusion pattern
21%
100%
supports_tags helper
58%
100%
Safe tag access with object.get
17%
100%
Deny for missing and empty tags
50%
100%
Tests pass
100%
100%
Deny on aws_s3_bucket without inline encryption
100%
100%
Deny on separate encryption resource with invalid algorithm
100%
100%
Helper function for algorithm validation
47%
100%
Tests pass
100%
100%
Checks create and update actions
100%
100%
Deny on aws_s3_bucket without versioning enabled
100%
100%
Deny on separate versioning resource with wrong status
58%
100%
Tests pass
80%
100%
import rego.v1
100%
100%
Default rule value for fallback limit
0%
100%
Per-tier limit lookup
100%
100%
Tests pass
0%
100%
Package-level metadata annotation
100%
100%
`allow` rule annotated with `entrypoint: true`
100%
100%
No blank lines between metadata and rule
100%
100%
Tests pass
80%
100%
Incremental violations set using `contains`
100%
100%
Boolean allow rule referencing violations
100%
100%
Checks for privileged and missing limits
100%
100%
Tests pass
80%
80%
Uses `in` for membership check (not `!=` in a loop)
100%
100%
sprintf argument count matches format string
100%
100%
Checks for restricted name and missing annotation
100%
100%
Tests pass
0%
92%
Uses `object.keys()` for provided tags
100%
100%
Set subtraction for missing tags
100%
100%
deny contains msg with sprintf
53%
100%
Tests pass
60%
88%
default declaration at the top
100%
100%
Conditional overrides for each tier
100%
100%
No else branches for fallback
100%
100%
Tests pass
100%
88%
Helper functions take explicit container argument
100%
100%
Separate helpers for privileged and resource limit checks
100%
100%
deny contains msg pattern with container name
100%
100%
Tests pass
92%
100%
Imports the package, not individual rules
100%
100%
No redundant aliases
100%
100%
All imports before rules
100%
100%
Tests pass
60%
100%
Uses `some ... in` for iteration
100%
100%
Checks each container image against approved registry
100%
100%
deny contains msg pattern
100%
100%
Tests pass
100%
100%
Uses `in` operator for membership check
100%
100%
Looks up allowed departments from data
100%
100%
import rego.v1 and default allow := false
100%
100%
Tests pass
100%
92%
snake_case for all identifiers
100%
100%
No get_ or list_ prefix on rule names
100%
100%
No package path repetition in rule names
100%
100%
Tests pass
100%
100%
Test file named `authz_test.rego` with `_test` package suffix
100%
100%
Policy package imported and rules referenced via alias
100%
100%
Unique descriptive test names
100%
100%
Tests pass
100%
100%
Table of Contents