Scan vulnerabilities #931
This file contains hidden or 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: Scan vulnerabilities | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| permissions: {} # Remove all permissions by default | |
| jobs: | |
| scan_filesystem: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read # For checkout | |
| security-events: write # For uploading SARIF results | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Run Grype vulnerability scanner in repo mode | |
| uses: anchore/scan-action@v7 | |
| id: fs_scan | |
| with: | |
| path: '.' | |
| only-fixed: true | |
| output-format: 'sarif' | |
| severity-cutoff: 'medium' | |
| - name: Upload Grype scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: ${{ steps.fs_scan.outputs.sarif }} | |
| timeout-minutes: 30 | |
| scan-release: | |
| name: Scan Current Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # For reading releases | |
| security-events: write # For uploading SARIF results | |
| steps: | |
| - name: Get latest release | |
| id: get_release | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const release = await github.rest.repos.getLatestRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| core.setOutput('tag_name', release.data.tag_name); | |
| - name: Run Grype vulnerability scanner | |
| uses: anchore/scan-action@v7 | |
| id: image_scan | |
| with: | |
| image: 'index.docker.io/replicated/replicated-sdk:${{ steps.get_release.outputs.tag_name }}' | |
| output-format: 'sarif' | |
| severity-cutoff: 'high' | |
| - name: Upload Grype scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: ${{ steps.image_scan.outputs.sarif }} | |
| category: 'release-cve-scan' | |
| timeout-minutes: 30 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true |