regal icon indicating copy to clipboard operation
regal copied to clipboard

Add functionality to allow tracking values of vars in scope

Open anderseknert opened this issue 1 year ago • 0 comments

While we obviously can't do this with values assigned from input or data, it is sometimes useful to be able to track the value of a var in scope of some violation. See the "Limitations" section of the non-raw-regex-pattern rule for an example:

package policy

import future.keywords.if

# Pattern assigned to variable
pattern := "[\\d]+"

# This won't trigger a violation
allow if regex.match(pattern, "12345")

For really simple cases like the one above, we could probably do this in just Rego. If we want to do something more advanced and track this in several steps (like if a var is assigned the value of another var, and so on) we'd probably need to introduce some Go helper.

anderseknert avatar Aug 08 '23 11:08 anderseknert