forked from open-policy-agent/opa
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ast: Disqualify indexing if candidate found in nested comprehension
In v0.20. we added support for indexing and caching of comprehensions in certain cases. There was a bug in the index construction that allowed for comprehensions to be indexed and cached incorrectly. Specifically, if any of the candidate keys appear in nested comprehensions, indexing should not be performed because the evaluator does not close over variable bindings from the outer scope when evaluating the comprehension (because this would require cache invalidation if there were multiple assignments to the variables in the outer scope). This fix updates the compiler to check if the candidates appear inside of any nested comprehensions. If a match is found, no indexing is performed. Fixes open-policy-agent#2497 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
- Loading branch information
Showing
3 changed files
with
73 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters