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

Aktivere trivy-action #44

Open
arnfinn opened this issue Feb 2, 2024 · 0 comments
Open

Aktivere trivy-action #44

arnfinn opened this issue Feb 2, 2024 · 0 comments

Comments

@arnfinn
Copy link
Contributor

arnfinn commented Feb 2, 2024

For å finne sårbarheter.

Følgende ble brukt på base-r:

name: Vulnerability by trivy
on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
  schedule:
    - cron: '0 21 * * 1' # run every Monday at 21

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    env:
      IMAGE_NAME: ${{ github.repository }}
    steps:
    - name: Downcase repository name for image
      run: |
        echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
    
    - name: Checkout code
      uses: actions/checkout@v3
    
    - name: Build image from Dockerfile
      run: |
        docker build -t ${IMAGE_NAME}:${{ github.sha }} --build-arg GH_PAT=${{ secrets.GITHUB_TOKEN}} .
    
    - name: Run Trivy vulnerability scanner
      uses: aquasecurity/trivy-action@master
      with:
        image-ref: ${{ env.IMAGE_NAME }}:${{ github.sha }}
        format: 'sarif'
        output: 'trivy-results.sarif'
        exit-code: '1'
        ignore-unfixed: false
        vuln-type: 'os,library'
        security-checks: 'vuln'
        severity: 'CRITICAL'

    - name: Upload Trivy scan results to GitHub Security tab
      uses: github/codeql-action/upload-sarif@v2
      if: always()
      with:
        sarif_file: 'trivy-results.sarif'
        category: Trivy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant