runner icon indicating copy to clipboard operation
runner copied to clipboard

Add Common Expression Language (CEL)

Open DonaldKellett opened this issue 1 year ago • 4 comments

Motivation

Qualified customers can leverage CEL support for interview challenges tailored to DevOps and platform engineering roles.

Common Expression Language (CEL) is a domain-specific language with bounded execution time optimized for defining authorization policies, validating API requests and transforming data.

CEL was initially developed by Google and widely adopted within Kubernetes and the wider cloud-native ecosystem, e.g.:

Introducing CEL support on Codewars opens the doors to a new class of policy authoring and data validation challenges tailored to cloud infrastructure and DevOps engineers who may not necessarily be well-versed in programming and software development. Furthermore, Qualified customers can leverage CEL support for interview challenges tailored to DevOps and platform engineering roles.

Required information

Please complete the following information about the language:

  • Name: Common Expression Language (CEL)
  • Website: https://cel.dev/
  • Language Version: v0.19.1 or any sufficiently recent version of CEL

The following are optional, but will help us add the language:

  • Test Frameworks:

    1. Evaluate CEL expressions in Go using the Undistro CEL playground evaluator: undistro/cel-playground
    2. Define assertions for unit testing: onsi/ginkgo
    3. BDD: onsi/gomega
  • How to install: use an official Go base image and import the required Go packages in the runtime setup and test fixture:

    1. github.com/undistro/cel-playground/eval
    2. github.com/onsi/ginkgo/v2
    3. github.com/onsi/gomega
  • How to compile/run: like any other Go project, e.g. with ginkgo

  • Any comments: see "Motivation" above


  • [x] Building
  • [x] Executing
  • [x] Testing
  • [ ] CodeMirror mode
  • [x] Icon

:+1: reaction might help to get this request prioritized.

DonaldKellett avatar Dec 28 '24 10:12 DonaldKellett

@kazk would an example setup similar to codewars/riscv speed up the process of adding CEL support to Codewars? If so, I might work on one in the coming weeks subject to availability, minus the following deliverables:

  1. Conversion to Codewars test output format - we can probably refer to the Codewars Go setup afterwards
  2. CodeMirror syntax highlighting - not too familiar with it

DonaldKellett avatar Dec 28 '24 11:12 DonaldKellett

@kazk An example setup is now available at DonaldKellett/codewars-cel and I've invited you as a collaborator to the repository; feel free to take a look and reach out in case of any suggestions or outstanding issues :smile:

The example setup demonstrates 3 cases based on rejecting Pods with gitRepo volumes using CEL expressions, motivated by the recent CVE-2024-10220 vulnerability:

  1. Passing tests
  2. Failing tests
  3. Syntax error

DonaldKellett avatar Dec 31 '24 14:12 DonaldKellett

Just realized that the current Codewars Go setup uses Ginkgo+Gomega for unit testing, I've migrated the examples over from Testify to Ginkgo+Gomega

DonaldKellett avatar Jan 01 '25 07:01 DonaldKellett

The official CEL SVG logo taken from cel.dev:

lockup

Perhaps we can use a variant thereof for our Codewars CEL logo?

DonaldKellett avatar Jan 05 '25 11:01 DonaldKellett