-
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
opa inspect
failure on custom funcs in policies
#6457
Comments
opa inspect
failure on custom funcs in policies
Thanks for reporting this @simar7. We'll look into it. |
…nspected Fixes: open-policy-agent#6457 Signed-off-by: Johan Fylling <johan.dev@fylling.se>
@simar7 it would be helpful if you could provide a simple policy that fails inspect. Just having a custom function in a policy should not fail inspect. So if you help with a simple repro case that would be good. |
Any bundle with a policy that has a custom function fails it. Here's an example as done in the PR https://github.com/open-policy-agent/opa/pull/6462/files#diff-29da7cb39323409b7f0e930998e9da29487fdc6c3f8c52d838efa9b48827f7d2R571-R577 Keep in mind this custom function is loaded via the Go SDK later on during runtime. During inspect, there's no such setup. |
…nspected Fixes: open-policy-agent#6457 Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Thanks for the context. So if you try to build a bundle with that policy it will fail too. This is true for pre-OPA 0.59.0. I imagine you're not using OPA tooling to build the bundle. You mention this was working pre-OPA 0.59.0. Is this correct? |
Hi @johanfylling @ashutosh-narkar package play
import data.x.y as y
default r := false
r {
y(1) == true
} Tried this on
The error complains of an unsafe expression Unlike the author of this post, my dependency is coming from another bundle, which is loaded at runtime in OPA. However, I can't run the inspect command. It was working before |
Thank you for reporting this @HarshPathakhp! I've created a separate bug report for tracking this issue: #6591. |
Short description
Since version v0.59.0, any bundles that include custom functions in their policies have now started to fail as
undefined function
.Steps To Reproduce
opa inspect
on the bundlerego_type_error: undefined function custom.func.name.here
Expected behavior
While the error seems correct, there also doesn't seem to be a way to define and load a custom function used in policies either to enable
opa inspect
to not throw any errors.Additional context
These custom functions are defined loaded via the Go SDK during OPA initialization. They work just fine when done so, but during
opa inspect
they fail as the OPA cli has no way to know about the definitions of these custom functions.This error has started since v0.59.0. Prior versions are unaffected.
The text was updated successfully, but these errors were encountered: