deepfence / ThreatMapper

Open Source Cloud Native Application Protection Platform (CNAPP)
https://deepfence.io
Apache License 2.0
4.84k stars 584 forks source link

ACR Integration not working due to basic-auth authentication #2325

Open b-abderrahmane opened 1 month ago

b-abderrahmane commented 1 month ago

Describe the bug Authenticating to ACR is not working, see the logs below. very likely due to attempting to authenticate to acr directly through basic-auth instead implementing an oauth2 authentication flow.

│ Tue, 01 Oct 2024 19:52:40 +0000 ERR acr/client.go:144 invalid character '<' looking for beginning of value                                                                        │
│ Tue, 01 Oct 2024 19:52:40 +0000 ERR acr/client.go:48 invalid character '<' looking for beginning of value                                                                         │
│ Tue, 01 Oct 2024 19:52:40 +0000 ERR cronjobs/registry.go:89 (skipping) unable to sync registry: azure_container_registry (registry): invalid character '<' looking for beginn │
│ 

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Registries'
  2. Click on 'Add registry'
  3. Add an ACR registry with a valid ACR account
  4. Try to sync and scan the registry
  5. See error above

Expected behavior It should succeed and be able to authenticate and scan the repositories. And even in case of a failure, I would expect something to appear on the front-end.

Screenshots If applicable, add screenshots to help explain your problem.

Components/Services affected

Additional context The acr/client.go client should implement the following flow

ramanan-ravi commented 1 month ago

Hello @b-abderrahmane, is the registry URL configured in ThreatMapper in this format? https://<registry-name>.azurecr.io

b-abderrahmane commented 1 month ago

Hi @ramanan-ravi, Yes it is.