Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d710430a67 | ||
|
|
062f259268 | ||
|
|
1f6384b6ce |
@@ -1,7 +1,7 @@
|
|||||||
name: "build"
|
name: "build"
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
env:
|
env:
|
||||||
TRIVY_VERSION: 0.49.0
|
TRIVY_VERSION: 0.50.1
|
||||||
BATS_LIB_PATH: '/usr/lib/'
|
BATS_LIB_PATH: '/usr/lib/'
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM ghcr.io/aquasecurity/trivy:0.49.0
|
FROM ghcr.io/aquasecurity/trivy:0.50.1
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
RUN apk --no-cache add bash curl npm
|
RUN apk --no-cache add bash curl npm
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|||||||
@@ -337,6 +337,49 @@ jobs:
|
|||||||
github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT
|
github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When scanning images you may want to parse the actual output JSON as Github Dependency doesn't show all details like the file path of each dependency for instance.
|
||||||
|
|
||||||
|
You can upload the report as an artifact and download it, for instance using the [upload-artifact action](https://github.com/actions/upload-artifact):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
name: Pull Request
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
## GITHUB_TOKEN authentication, add only if you're not going to use a PAT
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Checks
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Scan image in a private registry
|
||||||
|
uses: aquasecurity/trivy-action@master
|
||||||
|
with:
|
||||||
|
image-ref: "private_image_registry/image_name:image_tag"
|
||||||
|
scan-type: image
|
||||||
|
format: 'github'
|
||||||
|
output: 'dependency-results.sbom.json'
|
||||||
|
github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT
|
||||||
|
severity: "MEDIUM,HIGH,CRITICAL"
|
||||||
|
scanners: "vuln"
|
||||||
|
env:
|
||||||
|
TRIVY_USERNAME: "image_registry_admin_username"
|
||||||
|
TRIVY_PASSWORD: "image_registry_admin_password"
|
||||||
|
|
||||||
|
- name: Upload trivy report as a Github artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: trivy-sbom-report
|
||||||
|
path: '${{ github.workspace }}/dependency-results.sbom.json'
|
||||||
|
retention-days: 20 # 90 is the default
|
||||||
|
```
|
||||||
|
|
||||||
### Using Trivy to scan your private registry
|
### Using Trivy to scan your private registry
|
||||||
It's also possible to scan your private registry with Trivy's built-in image scan. All you have to do is set ENV vars.
|
It's also possible to scan your private registry with Trivy's built-in image scan. All you have to do is set ENV vars.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -80,7 +80,7 @@ done
|
|||||||
|
|
||||||
scanType=$(echo $scanType | tr -d '\r')
|
scanType=$(echo $scanType | tr -d '\r')
|
||||||
export artifactRef="${imageRef}"
|
export artifactRef="${imageRef}"
|
||||||
if [ "${scanType}" = "repo" ] || [ "${scanType}" = "fs" ] || [ "${scanType}" = "filesystem" ] || [ "${scanType}" = "config" ] || [ "${scanType}" = "rootfs" ];then
|
if [ "${scanType}" = "repo" ] || [ "${scanType}" = "fs" ] || [ "${scanType}" = "filesystem" ] || [ "${scanType}" = "config" ] || [ "${scanType}" = "rootfs" ] || [ "${scanType}" = "sbom" ];then
|
||||||
artifactRef=$(echo $scanRef | tr -d '\r')
|
artifactRef=$(echo $scanRef | tr -d '\r')
|
||||||
fi
|
fi
|
||||||
input=$(echo $input | tr -d '\r')
|
input=$(echo $input | tr -d '\r')
|
||||||
|
|||||||
Reference in New Issue
Block a user