-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic on opa fmt when calling another rule #2430
Labels
Comments
Thanks for filing the issue! There is a PR that fixes this over at #2429 , I've just linked the commit to this issue to it (there wasn't an issue earlier) |
patrick-east
added a commit
to patrick-east/opa
that referenced
this issue
May 22, 2020
Instead of playing games with trying to format them nicely, we instead can just rewrite them right at the start to no longer be wildcards if they show up >1 time in the policy. This fixes a panic being caused if a ref had an array path segment, by making a new term we were passing along a nil Location. While we could correct this by just passing the original term from the ref we can avoid all this special handling altogether by rewriting the wildcards earlier. Fixes: open-policy-agent#2430 Signed-off-by: Patrick East <east.patrick@gmail.com>
patrick-east
added a commit
that referenced
this issue
May 22, 2020
Instead of playing games with trying to format them nicely, we instead can just rewrite them right at the start to no longer be wildcards if they show up >1 time in the policy. This fixes a panic being caused if a ref had an array path segment, by making a new term we were passing along a nil Location. While we could correct this by just passing the original term from the ref we can avoid all this special handling altogether by rewriting the wildcards earlier. Fixes: #2430 Signed-off-by: Patrick East <east.patrick@gmail.com>
patrick-east
added a commit
to patrick-east/opa
that referenced
this issue
May 22, 2020
Instead of playing games with trying to format them nicely, we instead can just rewrite them right at the start to no longer be wildcards if they show up >1 time in the policy. This fixes a panic being caused if a ref had an array path segment, by making a new term we were passing along a nil Location. While we could correct this by just passing the original term from the ref we can avoid all this special handling altogether by rewriting the wildcards earlier. Fixes: open-policy-agent#2430 Signed-off-by: Patrick East <east.patrick@gmail.com> (cherry picked from commit 68e57b1)
patrick-east
added a commit
that referenced
this issue
May 22, 2020
Instead of playing games with trying to format them nicely, we instead can just rewrite them right at the start to no longer be wildcards if they show up >1 time in the policy. This fixes a panic being caused if a ref had an array path segment, by making a new term we were passing along a nil Location. While we could correct this by just passing the original term from the ref we can avoid all this special handling altogether by rewriting the wildcards earlier. Fixes: #2430 Signed-off-by: Patrick East <east.patrick@gmail.com> (cherry picked from commit 68e57b1)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
Using
opa fmt
on the following policyActual Behavior
A panic is hit
Steps to Reproduce the Problem
Additional Info
The following policy does work and I believe would be functionally the same
I am also fairly new to rego, so if I am making some large mistake by calling the
general_violation
like this, please let me know.The text was updated successfully, but these errors were encountered: