Merge pull request #92 from trustyai-explainability/main #100
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: Security Scan | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| trivy-scan: | |
| name: Trivy Security Scan | |
| runs-on: ubuntu-latest | |
| container: | |
| image: registry.access.redhat.com/ubi9/python-312:latest | |
| options: --user root | |
| permissions: | |
| contents: read | |
| security-events: write | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install runtime deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --no-cache-dir \ | |
| -r requirements.txt | |
| python -m pip install --no-cache-dir --no-deps . | |
| - name: Run Trivy filesystem scan | |
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-fs-results.sarif' | |
| severity: 'CRITICAL,HIGH,MEDIUM,LOW' | |
| exit-code: '0' # Don't fail on this scan, we'll check results separately | |
| - name: Run Trivy dependency scan | |
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-deps-results.sarif' | |
| severity: 'CRITICAL,HIGH,MEDIUM,LOW' | |
| scanners: 'vuln' | |
| exit-code: '0' # Don't fail on this scan, we'll check results separately | |
| - name: Check for critical vulnerabilities | |
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'table' | |
| severity: 'CRITICAL' | |
| exit-code: '1' # Fail if critical vulnerabilities found | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() && github.event_name == 'pull_request' && github.base_ref == 'main' | |
| with: | |
| sarif_file: 'trivy-fs-results.sarif' | |
| category: 'trivy-filesystem' | |
| - name: Upload Trivy dependency scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() && github.event_name == 'pull_request' && github.base_ref == 'main' | |
| with: | |
| sarif_file: 'trivy-deps-results.sarif' | |
| category: 'trivy-dependencies' |