open-policy-agent / opa

Open Policy Agent (OPA) is an open source, general-purpose policy engine.
https://www.openpolicyagent.org
Apache License 2.0
9.5k stars 1.32k forks source link

Investigate new "dot" operator with error-on-undefined behavior #2095

Open tsandall opened 4 years ago

tsandall commented 4 years ago

In Rego the "dot" operator selects fields in arrays, objects, and sets. If the field is missing, the variable assignments in the evaluation context do not produce a result, i.e., the expression/query is undefined. In some cases it would be nice to have a stricter version of the operator that throws an error if the selected field is missing.

I'm filing this issue so that we can start tracking discussion and design around a new kind of dot operator. Off the top of my head, there are a few things to consider:

pciazynski commented 3 years ago

That would be a perfect match for writing deny rules for Kubernetes. Cause if for (whatever reason) some path is not existing, then the rule do nothing and simply allow things, which can be very insecure... We encountered that problem just recently.

stale[bot] commented 1 year ago

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.