trivy action #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: trivy action | |
on: | |
workflow_dispatch | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: docker.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: pietrodematteis/helloworld-demo-node | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'docker.io/pietrodematteis/helloworld-demo-node:main' | |
format: 'json' | |
output: 'trivy-report.json' | |
exit-code: '0' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
#- name: Upload MobSF Analysis JSON Result | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: trivy-report.json | |
# path: trivy-report.json | |
# - name: Get values from the package.json | |
# id: packageJson | |
# uses: RadovanPelka/github-action-json@main | |
# with: | |
# path: trivy-report.json # default value | |
# - run: echo "name - ${{ steps.packageJson.outputs.ImageID }}" | |
- name: get properties | |
id: json_properties | |
uses: ActionsTools/read-json-action@main | |
with: | |
file_path: "trivy-report.json" | |
- run: | | |
echo ${{steps.json_properties.outputs.ArtifactName}} | |
echo ${{steps.json_properties.outputs.Metadata.OS.Family}} | |
echo ${{steps.json_properties.outputs.Metadata.OS.Name}} |