Container Security Scan #4
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: Container Security Scan | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'containers/**' | |
| - '.github/workflows/container-scan.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'containers/**' | |
| - '.github/workflows/container-scan.yml' | |
| schedule: | |
| # Run weekly on Sundays at 00:00 UTC | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| scan-agent: | |
| name: Scan Agent Container | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Build Agent image | |
| run: | | |
| docker build -t awf-agent:${{ github.sha }} ./containers/agent | |
| - name: Run Trivy vulnerability scanner (table output) | |
| uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 | |
| with: | |
| image-ref: 'awf-agent:${{ github.sha }}' | |
| format: 'table' | |
| severity: 'CRITICAL,HIGH' | |
| - name: Run Trivy vulnerability scanner (SARIF output) | |
| uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 | |
| with: | |
| image-ref: 'awf-agent:${{ github.sha }}' | |
| format: 'sarif' | |
| output: 'trivy-agent-results.sarif' | |
| severity: 'CRITICAL,HIGH' | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: 'trivy-agent-results.sarif' | |
| category: 'container-agent' | |
| scan-squid: | |
| name: Scan Squid Container | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Build Squid image | |
| run: | | |
| docker build -t awf-squid:${{ github.sha }} ./containers/squid | |
| - name: Run Trivy vulnerability scanner (table output) | |
| uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 | |
| with: | |
| image-ref: 'awf-squid:${{ github.sha }}' | |
| format: 'table' | |
| severity: 'CRITICAL,HIGH' | |
| - name: Run Trivy vulnerability scanner (SARIF output) | |
| uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0 | |
| with: | |
| image-ref: 'awf-squid:${{ github.sha }}' | |
| format: 'sarif' | |
| output: 'trivy-squid-results.sarif' | |
| severity: 'CRITICAL,HIGH' | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: 'trivy-squid-results.sarif' | |
| category: 'container-squid' |