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.

99

1.19x

Quality

Pending

Does it follow best practices?

Impact

99%

1.19x

Average score across 31 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-27/

Regal: Import Conventions — JWT Authorization with Helper Library

Write two Rego files:

  1. lib/jwt.rego — package lib.jwt with a decode_claims(token) function that splits a JWT by ., base64-decodes the second part, and JSON-parses it to return the claims object.

  2. authz.rego — package api.authz that:

    • Imports the helper package with import data.lib.jwt (not individual functions)
    • Uses jwt.decode_claims(input.token) to get claims
    • Allows access when the role claim is "admin" or "editor"
    • All imports appear before any rules
    • No redundant aliases (don't alias jwt as jwt)

Input

{"token": "<jwt-string>"}

Expected behaviour

  • Token with role: "admin" → allow
  • Token with role: "editor" → allow
  • Token with role: "viewer" → deny
  • Invalid/missing token → deny

README.md

rules.md

tile.json