cedar-policy / cedar-go

Golang implementation of the Cedar Policy Language
Apache License 2.0
85 stars 9 forks source link

Policy eval Attribute is Private #3

Open tpaulus opened 8 months ago

tpaulus commented 8 months ago

In order to enforce constraint policies, a policy needs to be "inverted" from a Permit When, to a Forbid Unless. This is currently not possible with policy ast in cedar-go, as the policy evaluation condition in cedar.Policy is private. This also cannot be done at Parse time, as the evaler of a Policy cannot instantiated outside of the cedar module.

Ideally, the conditions (when or unless) are exposed as attributes of a cedar.Policy to enable simple policy mutations without needing to resort to string processing, which can be problematic.

philhassey commented 8 months ago

Right now the shape of our AST is not stable yet (which is why it is living inside the x/exp/parser parser package.)

Once we have a stabilized AST shape (likely when we work on supporting partial evaluation), we'll be able to expose the ability to change an AST and recompile it.

We'll leave this issue open and update it once we know more about the timeline for partial evaluation and a stable AST.