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: Fix rule indexing when multiple glob.match mappers are required
Previously when glob.match statements were indexed, the index trie node would have a mapper function set on it. The problem was that if subsequent rules were added to the index and required a different mapper (or none at all in the case of equality statements), the original mapper would be overwritten. This would result in false-negatives when the index was queried (i.e., the rule that was indexed first would not be returned). This commit fixes the issue by storing multiple mappers on the trie node (one per delimiter in the case of glob.match). If multiple mappers are encountered during traversal, each one will be tested. Fixes open-policy-agent#2617 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
- Loading branch information
Showing
2 changed files
with
125 additions
and
19 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