fix: respect GITHUB_TOKEN to download artifacts from GHCR (#7580)

Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Teppei Fukuda
2024-12-04 17:02:26 +09:00
committed by GitHub
parent 71391a5850
commit 21b68e1818
3 changed files with 23 additions and 10 deletions

View File

@@ -79,21 +79,25 @@ $ TRIVY_INSECURE=true trivy image [YOUR_IMAGE]
```
### GitHub Rate limiting
Trivy uses GitHub API for [VEX repositories](../supply-chain/vex/repo.md).
!!! error
``` bash
$ trivy image ...
$ trivy image --vex repo ...
...
API rate limit exceeded for xxx.xxx.xxx.xxx.
```
Specify GITHUB_TOKEN for authentication
https://developer.github.com/v3/#rate-limiting
Specify GITHUB_TOKEN for [authentication](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28)
```
$ GITHUB_TOKEN=XXXXXXXXXX trivy alpine:3.10
$ GITHUB_TOKEN=XXXXXXXXXX trivy image --vex repo [YOUR_IMAGE]
```
!!! note
`GITHUB_TOKEN` doesn't help with the rate limit for the vulnerability database and other assets.
See https://github.com/aquasecurity/trivy/discussions/8009
### Unable to open JAR files
!!! error
@@ -217,6 +221,11 @@ Please remove the token and try downloading the DB again.
docker logout ghcr.io
```
or
```shell
unset GITHUB_TOKEN
```
## Homebrew
### Scope error