-
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
OCI with private Azure Container Registry: download of policies fails with HTTP 403 #6590
Comments
@rbinder-vg thanks for reporting this. Are you able to repro this even with the latest OPA release? @carabasdaniel @gitu any ideas what's happening here? |
@ashutosh-narkar same issue with latest release and with main. |
Hi @rbinder-vg, If you try a very basic docker pull using those credentials does that work ? |
Hi @carabasdaniel, I made a |
Hi @carabasdaniel @ashutosh-narkar , i found the cause for the bug: the ACR sends a redirect to an azure blob storage with a SAS token as query parameter and OPA is setting the |
Hi @rbinder-vg, This really seems linked to #6580 as it's the same behavior. I think this might be related to how the plugin authorizer works in the docker resolver here: https://github.com/open-policy-agent/opa/blob/main/download/oci_download.go#L346 Can you try to use a custom plugin as a work-around ? |
A little bit hacky, but this is working: func (p *Plugin) Prepare(req *http.Request) error {
if !strings.Contains(req.URL.Host,"azurecr.io") {
return nil
}
req.Header.Add("Authorization", p.config.Authz)
return nil
} |
I think there is an Azure and an AWS plugin for the REST client. With the latest changes in the OCI downloader the docker resolver gets a client from the plugins if I remember correctly (auth plugin used by default). @ashutosh-narkar would those plugins be usable for the OCI downloader as well ? |
Looking at this change, only the Azure one seems unavailable atm. |
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue. |
Short description
I want to use leverage OPAs OCI functionality to retrieve policies from a private Azure Container Registry.
There is a error (
403 Server failed to authenticate the request.
) when downloading the blobs.The download of the manifest seems ok.
If i use the the oras cli with the same service principal the download works as expected.
Steps To Reproduce
configuration.yml:
Start server with docker:
docker run --rm --volume "$(pwd):/wd" --workdir /wd -ti --entrypoint opa openpolicyagent/opa:0.60.0 run -c configuration.yml
Expected behavior
Opa policies successfully loaded.
Additional context
The text was updated successfully, but these errors were encountered: