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 fetch DB: User cannot be authenticated with the token provided #2385

Closed
aleksandr-vin opened this issue Jun 22, 2022 · 9 comments
Closed
Labels
triage/support Indicates an issue that is a support question.

Comments

@aleksandr-vin
Copy link

Description

Vuln's DB is not downloaded.

What did you expect to happen?

image scan

What happened instead?

failed

Output of run with -debug:

docker run --rm aquasec/trivy:latest --debug image busybox
2022-06-22T12:07:18.725Z	DEBUG	Severities: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
2022-06-22T12:07:18.728Z	DEBUG	cache dir:  /root/.cache/trivy
2022-06-22T12:07:18.728Z	DEBUG	There is no valid metadata file: unable to open a file: open /root/.cache/trivy/db/metadata.json: no such file or directory
2022-06-22T12:07:18.728Z	INFO	Need to update DB
2022-06-22T12:07:18.728Z	INFO	DB Repository: ghcr.io/aquasecurity/trivy-db
2022-06-22T12:07:18.728Z	INFO	Downloading DB...
2022-06-22T12:07:18.728Z	DEBUG	no metadata file
2022-06-22T12:07:19.652Z	FATAL	DB error:
    github.com/aquasecurity/trivy/pkg/commands/artifact.runWithTimeout
        /home/runner/work/trivy/trivy/pkg/commands/artifact/run.go:87
  - failed to download vulnerability DB:
    github.com/aquasecurity/trivy/pkg/commands/operation.DownloadDB
        /home/runner/work/trivy/trivy/pkg/commands/operation/operation.go:111
  - database download error:
    github.com/aquasecurity/trivy/pkg/db.(*Client).Download
        /home/runner/work/trivy/trivy/pkg/db/db.go:155
  - failed to fetch the layer:
    github.com/aquasecurity/trivy/pkg/oci.Artifact.Download
        /home/runner/work/trivy/trivy/pkg/oci/artifact.go:94
  - GET https://ghcr.io/v2/aquasecurity/trivy-db/blobs/sha256:5affceed0f4ba4da7954daaba21e8e7e679f8ac2c6e4cbcd6a4b9d97ab55243e: UNAUTHORIZED: unauthenticated: User cannot be authenticated with the token provided.

Output of trivy -v:

Version: 0.29.2
Vulnerability DB:
  Version: 1
  UpdatedAt: 2022-01-19 12:44:54.97531659 +0000 UTC
  NextUpdate: 2022-01-19 18:44:54.97531629 +0000 UTC
  DownloadedAt: 2022-01-19 16:09:18.03537 +0000 UTC```

## Additional details (base image name, container registry info...):
@aleksandr-vin aleksandr-vin added the kind/bug Categorizes issue or PR as related to a bug. label Jun 22, 2022
@tecbird
Copy link

tecbird commented Jun 22, 2022

+1

2022-06-22T12:04:46.721Z INFO Need to update DB
2022-06-22T12:04:46.721Z INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-06-22T12:04:46.721Z INFO Downloading DB...
2022-06-22T12:04:47.680Z FATAL init error: DB error: failed to download vulnerability DB: database download error: failed to fetch the layer: GET https://ghcr.io/v2/aquasecurity/trivy-db/blobs/sha256:5affceed0f4ba4da7954daaba21e8e7e679f8ac2c6e4cbcd6a4b9d97ab55243e: UNAUTHORIZED: unauthenticated: User cannot be authenticated with the token provided.

@liad5h
Copy link

liad5h commented Jun 22, 2022

same here, I am using 0.25.3

@jajaislanina
Copy link

+1

Running in github action we get this error
error pulling image configuration: download failed after attempts=1: unauthorized: unauthenticated: User cannot be authenticated with the token provided. na Step 1/5 : FROM [ghcr.io/aquasecurity/trivy:0.29.0](http://ghcr.io/aquasecurity/trivy:0.29.0)

@knqyf263
Copy link
Collaborator

knqyf263 commented Jun 22, 2022

Trivy DB is hosted on GitHub Container Registry, but it is unstable nowadays. It sometimes returns an unauthorized error. I believe the error will be addressed in a minute. Please retry your job.

@knqyf263 knqyf263 added triage/support Indicates an issue that is a support question. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jun 22, 2022
@knqyf263
Copy link
Collaborator

See also Homebrew/brew#13460

@knqyf263 knqyf263 pinned this issue Jun 22, 2022
@knqyf263
Copy link
Collaborator

GitHub recognized the issue and updated the status.
image

https://www.githubstatus.com/

@knqyf263
Copy link
Collaborator

Looks like it is back to normal. Please let me close this issue.
image

https://www.githubstatus.com/incidents/10vm6ctn52gx

@maltemorgenstern
Copy link
Contributor

I can confirm that this is fixed - trivy has no longer issues downloading the database 🎉

INFO	Need to update DB
INFO	DB Repository: ghcr.io/aquasecurity/trivy-db
INFO	Downloading DB...
DEBUG	no metadata file
DEBUG	Updating database metadata...
DEBUG	DB Schema: 2, UpdatedAt: 2022-06-22 12:08:00.619245834 +0000 UTC, NextUpdate: 2022-06-22 18:08:00.619245434 +0000 UTC, DownloadedAt: 2022-06-22 13:10:03.207600357 +0000 UTC

@knqyf263
Copy link
Collaborator

Thanks for confirming👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/support Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

6 participants