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.
Report safety errors for generated vars
Originally this looked like a type checking bug, but in fact it was related to the safety check. Previously, we filtered out safety errors for generated vars because they are meaningless to the user. This led to unsafe queries being allowed in some edge cases. For example: sum() > 1 would be expanded to sum(__local0__); __local0__ > 1. The first expression is unsafe but this would not be reported. This change ensures that the compiler reports an error in all cases. With this change, safety errors for generated vars are turned into error messages indicating the expression is unsafe. Above, there would be a single error indicating the expression "sum() > 1" is unsafe. Fixes open-policy-agent#661 Signed-off-by: Torin Sandall <[email protected]>
- Loading branch information
Showing
2 changed files
with
65 additions
and
17 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