-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
panic: query compiler should return error if input query is empty #3625
Labels
Comments
tsandall
added a commit
to tsandall/opa
that referenced
this issue
Jul 9, 2021
The compiler assumes that queries are non-empty, however, if the parser is fed only whitespace and comments then the parsed query will be empty. Since the compiler makes this assumption and many callers will make a similar assumption, just reject empty queries at the beginning. This issue is unlikely to affect most users unless they send arbitrary text selections into OPA (e.g., like `opa eval` does...) Fixes open-policy-agent#3625 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
tsandall
added a commit
that referenced
this issue
Jul 9, 2021
The compiler assumes that queries are non-empty, however, if the parser is fed only whitespace and comments then the parsed query will be empty. Since the compiler makes this assumption and many callers will make a similar assumption, just reject empty queries at the beginning. This issue is unlikely to affect most users unless they send arbitrary text selections into OPA (e.g., like `opa eval` does...) Fixes #3625 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
dolevf
pushed a commit
to dolevf/opa
that referenced
this issue
Nov 4, 2021
The compiler assumes that queries are non-empty, however, if the parser is fed only whitespace and comments then the parsed query will be empty. Since the compiler makes this assumption and many callers will make a similar assumption, just reject empty queries at the beginning. This issue is unlikely to affect most users unless they send arbitrary text selections into OPA (e.g., like `opa eval` does...) Fixes open-policy-agent#3625 Signed-off-by: Torin Sandall <torinsandall@gmail.com> Signed-off-by: Dolev Farhi <farhi.dolev@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the query compiler assumes the ast.Body provided as input is non-empty. This makes sense in most cases, however, if users accidentally supply a comment, the parsed body ends up being empty and this triggers a panic during compilation:
We should fix the query compiler to return a CompileErr in case the supplied body is empty.
The text was updated successfully, but these errors were encountered: