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

Local variable assignment resolves incorrectly #1155

Closed
tim-styra opened this issue Jan 14, 2019 · 0 comments
Closed

Local variable assignment resolves incorrectly #1155

tim-styra opened this issue Jan 14, 2019 · 0 comments
Labels

Comments

@tim-styra
Copy link
Contributor

tim-styra commented Jan 14, 2019

Expected Behavior

A locally-defined dictionary should be able to hide a globally-imported dictionary, e.g. baz in the following package should be true.

package foo
import data.bar

baz {
    bar := {"qux": 7}
    bar.qux == 7
}

Actual Behavior

baz above is undefined because bar.qux is undefined. Presumably this happens because when the compiler resolves the symbol bar it does so with data.bar instead of the local variable bar. So the compiler sees the rule above as:

package foo

baz {
    bar := {"qux": 7}
    data.bar.qux == 7
}

Steps to Reproduce the Problem

Evaluate the policy above.

@tsandall tsandall added the bug label Jan 14, 2019
tsandall added a commit to tsandall/opa that referenced this issue Jan 14, 2019
When resolving vars inside references, the implementation was not
checking the ignore stack. As a result, vars were potentially resolved
to globals when they should not be.

Fixes open-policy-agent#1155

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants