CrowdStrike / container-image-scan

Code to scan a container with CrowdStrike and return response codes indicating pass/fail status.
MIT License
35 stars 23 forks source link

podman.errors.exceptions.APIError: 400 Client Error: Bad Request #40

Closed Epoxboy closed 1 year ago

Epoxboy commented 2 years ago

We're using script for image scanning. It's executed on pipeline agent( RedHat 8.5 with podman 3.3.1) and got following error:

podman.errors.exceptions.APIError: 400 Client Error: Bad Request (error pushing image "container-upload.us-1.crowdstrike.com/docker.io/library/python:slim": trying to reuse blob sha256:fd95118eade99a75b949f634a0994e0f0732ff18c2573fabdfc8d4f95b092f0e at destination: unable to retrieve auth token: invalid username/password: unauthorized)

I've attached details in this txt file for your reference. 27.txt

I've had a quick look, it seems a missing "auth_config" parameter in your "container_push" method?? https://github.com/CrowdStrike/container-image-scan/blob/5258ea8b242173e47954bd723d6f7d1b71bda949/cs_scanimage.py#L89

podman-py lib ref: https://github.com/containers/podman-py/blob/a174c43ea07c960cc11af8444ad7143094749246/podman/domain/images_manager.py#L187

Thanks!

BTW: The client id and secret are available and have been verified.

redhatrises commented 2 years ago

Hello,

Thank you for reporting this. Can you provide the version of podman and python3-podman that you are using?

Epoxboy commented 2 years ago

RedHat 8.5 with podman 3.3.1 python3-podman: podman (3.2.0)

Epoxboy commented 2 years ago

And in order to rule out potential podman service configuration issue on above pipeline agent, I tested the script on an Ubuntu server and got same error. Versions info is as following: Ubuntu 20.04.4 LTS with podman 3.4.2 python3-podman: podman (4.0.0)

And in both above cases, podman login and podman push are working fine.

Epoxboy commented 2 years ago

I've had a look at podman-py latest release 4.0.0, seems like auth_config is not implemented yet... that should be the reason of causing this error, just my thought anyway, please check and confirm.

image
redhatrises commented 2 years ago

Hello,

Please make sure that both podman and python3-podman are at version 4.

redhatrises commented 1 year ago

Closing as there isn't any further information provided on this. Please re-open with more info around podman versioning.