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

Failed to trigger scan with Trivy #5

Closed
steven-zou opened this issue Aug 13, 2019 · 2 comments
Closed

Failed to trigger scan with Trivy #5

steven-zou opened this issue Aug 13, 2019 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@steven-zou
Copy link
Collaborator

Send request:

{"registry_url":"10.16*.*.*","registry_token":"<MY-TOKEN>","repository":"scanners/mongo","tag":"3.4-xenial","digest":"sha256:762277c0de87e5499e418c40cfe7352f7f976802b019e7ac0948d39e5f4a7413"}

The following error occurred:

2019/08/13 11:27:57 Starting harbor-scanner-trivy with config &{:8080     }
2019/08/13 11:29:46 RegistryURL: http://10.16*.*.*
2019/08/13 11:29:46 Repository: scanners/mongo
2019/08/13 11:29:46 Tag: 3.4-xenial
2019/08/13 11:29:46 Digest: sha256:762277c0de87e5499e418c40cfe7352f7f976802b019e7ac0948d39e5f4a7413
2019/08/13 11:29:46 Scan request: 46b3e41a-b096-44ad-b8c0-c014e10eb8c0
2019/08/13 11:29:46 Started scanning http://10.16*.*.*/scanners/mongo:3.4-xenial ...
2019-08-13T11:29:46.612Z        DEBUG   cache dir:  /root/.cache/trivy
2019-08-13T11:29:46.613Z        DEBUG   db path: /root/.cache/trivy/db/trivy.db
2019-08-13T11:29:46.623Z        INFO    Updating vulnerability database...
2019-08-13T11:29:46.623Z        DEBUG   git pull
2019-08-13T11:29:47.444Z        DEBUG   total updated files: 1
2019-08-13T11:29:47.475Z        FATAL   invalid image:
    github.com/knqyf263/trivy/pkg.Run
        /root/project/pkg/run.go:153
  - parsing image "http://10.16*.*.*/scanners/mongo:3.4-xenial" failed: invalid reference format
2019/08/13 11:29:47 ERROR: running trivy: exit status 1
@danielpacak danielpacak added the bug Something isn't working label Aug 23, 2019
@danielpacak danielpacak self-assigned this Sep 4, 2019
@danielpacak danielpacak added this to the v0.1.0 milestone Sep 4, 2019
@danielpacak
Copy link
Contributor

danielpacak commented Sep 4, 2019

This is most likely related to the way we concatenate registry URL with repository and artifact digest to create a docker image reference which is then passed as a command line arg to Trivy executable.

https://github.com/aquasecurity/harbor-scanner-trivy/blob/master/pkg/image/trivy/scanner.go#L32

We should parse the registry URL and extract just host:port part, so instead of http://10.16*.*.*/scanners/mongo:3.4-xenial it should be 10.16*.*.*/scanners/mongo:3.4-xenial.

@danielpacak
Copy link
Contributor

Resolved in #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants