Merge pull request #800 from Bhenzdizma/adance #384
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 Scanning | |
| on: | |
| push: | |
| branches: [main, develop] | |
| paths: | |
| - "**.rs" | |
| - "**.yaml" | |
| - "**.yml" | |
| - "charts/**" | |
| - "Dockerfile*" | |
| - "Makefile" | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: security-scan-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| trivy-fs-scan: | |
| name: Trivy Filesystem Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Trivy filesystem scan | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| scan-type: fs | |
| scan-ref: . | |
| format: sarif | |
| output: trivy-fs-results.sarif | |
| severity: CRITICAL,HIGH | |
| - name: Upload Trivy FS results | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: trivy-fs-results.sarif | |
| docker-trivy: | |
| name: Trivy Container Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build -t stellar-operator:scan . | |
| - name: Run Trivy on Docker image | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| image-ref: stellar-operator:scan | |
| format: sarif | |
| output: trivy-docker.sarif | |
| severity: CRITICAL,HIGH | |
| - name: Upload Trivy Docker scan | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: trivy-docker.sarif | |
| iac-checkov: | |
| name: IaC Security Scan (Helm/K8s manifests) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Checkov IaC scan | |
| uses: bridgecrewio/checkov-action@v12 | |
| with: | |
| directory: charts/ | |
| framework: kubernetes | |
| output_format: sarif | |
| output_file_path: checkov-results.sarif | |
| continue-on-error: true | |
| - name: Upload Checkov results | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: checkov-results.sarif | |
| security-matrix: | |
| name: Security Dashboard | |
| runs-on: ubuntu-latest | |
| needs: [trivy-fs-scan, docker-trivy, iac-checkov] | |
| if: always() | |
| steps: | |
| - name: Security Status Summary | |
| run: | | |
| { | |
| echo "## Security Scan Results" | |
| echo "" | |
| echo "| Job | Status |" | |
| echo "|-----|--------|" | |
| echo "| trivy-fs-scan | ${{ needs.trivy-fs-scan.result }} |" | |
| echo "| docker-trivy | ${{ needs.docker-trivy.result }} |" | |
| echo "| iac-checkov | ${{ needs.iac-checkov.result }} |" | |
| } >> "$GITHUB_STEP_SUMMARY" |