Skip to content
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

Reference to virtual doc defined by complete rule saved with incorrect binding list #2368

Closed
tsandall opened this issue Apr 30, 2020 · 0 comments · Fixed by #2371
Closed
Assignees

Comments

@tsandall
Copy link
Member

Given the following rules:

p { x = "abcd"; r[x] }
r = input

The query p = true should generate:

input["abcd"]

However the current output is input[x2]. The problem is that the binding list being saved for the expression r[x] is not correct in this case.

@tsandall tsandall self-assigned this Apr 30, 2020
tsandall added a commit to tsandall/opa that referenced this issue May 1, 2020
In dda04ef we fixed a bug in PE that
caused unknown terms to get evaluated when they should have been
saved. However, the fix itself contained a bug inside evalTerm whereby
the evaluator would save the binding list from the query that produced
the unknown as opposed to the binding list for the reference suffix
that was being saved. This issue manifests in PE output with
references containing free variables instead of plugged values.

This commit fixes the issue by unifying the unknown value with a
generated variable associated with the reference suffix's binding
list. The reference to be saved is then constructed from the generated
variable. This ensures that all of the terms in the reference to be
saved are associated with the same, correct binding list.

Fixes open-policy-agent#2368

Signed-off-by: Torin Sandall <[email protected]>
patrick-east pushed a commit that referenced this issue May 4, 2020
In dda04ef we fixed a bug in PE that
caused unknown terms to get evaluated when they should have been
saved. However, the fix itself contained a bug inside evalTerm whereby
the evaluator would save the binding list from the query that produced
the unknown as opposed to the binding list for the reference suffix
that was being saved. This issue manifests in PE output with
references containing free variables instead of plugged values.

This commit fixes the issue by unifying the unknown value with a
generated variable associated with the reference suffix's binding
list. The reference to be saved is then constructed from the generated
variable. This ensures that all of the terms in the reference to be
saved are associated with the same, correct binding list.

Fixes #2368

Signed-off-by: Torin Sandall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant