Skip to content
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 discovery raises a panic error when a signed policy bundle is used #4656

Closed
humbertoc-silva opened this issue May 3, 2022 · 2 comments · Fixed by #4764
Closed

OPA discovery raises a panic error when a signed policy bundle is used #4656

humbertoc-silva opened this issue May 3, 2022 · 2 comments · Fixed by #4764
Assignees
Labels

Comments

@humbertoc-silva
Copy link
Contributor

Short description

I am testing the OPA discovery feature. In my case, I am using an unsigned discovery bundle with a config that points to a signed policy bundle. When I start the OPA server the discovery bundle is downloaded but a panic error is raised when OPA tries to load the signed policy bundle.

Steps To Reproduce

I have a repo that could be used to reproduce the error.
https://github.com/humbertoc-silva/opa-discovery-issue

Expected behavior

OPA should download the discovered signed policy bundle, validate it with the public key, and load it correctly.

@ashutosh-narkar
Copy link
Member

Initially reported here.

@humbertoc-silva
Copy link
Contributor Author

I found another problem related to Discovery API. Environment variable substitution does not work on the discovered configuration as noticed in the logs below:

{"headers":{"Prefer":["modes=snapshot,delta"],"User-Agent":["Open Policy Agent/0.40.0 (linux, amd64)"]},"level":"debug","method":"GET","msg":"Sending request.","time":"2022-05-13T18:56:41Z","url":"http://bundle_server/bundles/${UNSIGNED_BUNDLE_NAME}"}
{"headers":{"Connection":["keep-alive"],"Content-Length":["153"],"Content-Type":["text/html"],"Date":["Fri, 13 May 2022 18:56:41 GMT"],"Server":["nginx/1.21.6"]},"level":"debug","method":"GET","msg":"Received response.","status":"404 Not Found","time":"2022-05-13T18:56:41Z","url":"http://bundle_server/bundles/${UNSIGNED_BUNDLE_NAME}"}
{"level":"error","msg":"Bundle load failed: server replied with Not Found","name":"unsigned_policy_bundle","plugin":"bundle","time":"2022-05-13T18:56:41Z"}

@ashutosh-narkar ashutosh-narkar added this to Backlog in Open Policy Agent via automation Jun 1, 2022
@ashutosh-narkar ashutosh-narkar self-assigned this Jun 1, 2022
@ashutosh-narkar ashutosh-narkar moved this from Backlog to In Progress in Open Policy Agent Jun 9, 2022
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Jun 9, 2022
Currently OPA allows users to use unsigned discovery
bundles that themselves point to signed service bundles.
The discovery plugin checks if the keys in the service bundle
do not update those in the boot config. It's possible that
the signing config in the discovery object be a nil pointer.
This is change adds a check for that.

Fixes: open-policy-agent#4656

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Open Policy Agent automation moved this from In Progress to Done Jun 9, 2022
ashutosh-narkar added a commit that referenced this issue Jun 9, 2022
Currently OPA allows users to use unsigned discovery
bundles that themselves point to signed service bundles.
The discovery plugin checks if the keys in the service bundle
do not update those in the boot config. It's possible that
the signing config in the discovery object be a nil pointer.
This is change adds a check for that.

Fixes: #4656

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants