CtrlK
BlogDocsLog inGet started
Tessl Logo

nicholasjackson/opa-rego-language

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

1.18x
Quality

94%

Does it follow best practices?

Impact

97%

1.18x

Average score across 32 eval scenarios

SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-10/

Access Control: Separation of Duty

Write a Rego policy that detects separation-of-duty (SOD) violations — users who hold two roles that must never be held simultaneously.

Data

data.user_roles maps users to their current role assignments:

{
  "alice": ["create-payment", "approver"],
  "bob": ["create-payment", "auditor"],
  "charlie": ["approve-payment", "auditor"]
}

The conflicting role pairs are:

[
  ["create-payment", "approve-payment"],
  ["create-vendor",  "pay-vendor"]
]

Expected behaviour

  • alice has a SOD violation (holds create-payment and approver — wait, approver isn't in the list, but approve-payment is — so alice is fine)
  • A user holding both create-payment and approve-payment is a violation
  • The policy must produce a set of violating users

README.md

rules.md

tile.json