|
| 1 | +name: SDLE Scans |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - "feature/**" |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + # ----------------------------- |
| 13 | + # 1) Trivy Scan (container & code) |
| 14 | + # ----------------------------- |
| 15 | + trivy_scan: |
| 16 | + name: Trivy Vulnerability Scan |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Trivy |
| 23 | + run: | |
| 24 | + sudo apt-get update |
| 25 | + sudo apt-get install -y wget |
| 26 | + wget https://github.com/aquasecurity/trivy/releases/latest/download/trivy_$(uname -s)_$(uname -m).tar.gz |
| 27 | + tar zxvf trivy_*.tar.gz |
| 28 | + sudo mv trivy /usr/local/bin/ |
| 29 | +
|
| 30 | + - name: Run Trivy File System Scan |
| 31 | + run: trivy fs --security-checks vuln,config . --exit-code 1 || true |
| 32 | + |
| 33 | + - name: Trivy SBOM + Report |
| 34 | + run: trivy sbom . --output trivy-sbom.json |
| 35 | + |
| 36 | + # ----------------------------- |
| 37 | + # 2) Bandit Scan (Python SAST) |
| 38 | + # ----------------------------- |
| 39 | + bandit_scan: |
| 40 | + name: Bandit Python Static Scan |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - name: Checkout repository |
| 44 | + uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Setup Python |
| 47 | + uses: actions/setup-python@v4 |
| 48 | + with: |
| 49 | + python-version: "3.x" |
| 50 | + |
| 51 | + - name: Install Bandit |
| 52 | + run: pip install bandit |
| 53 | + |
| 54 | + - name: Run Bandit |
| 55 | + run: bandit -r . -f html -o bandit-report.html |
| 56 | + |
| 57 | + - name: Upload Bandit Report |
| 58 | + uses: actions/upload-artifact@v3 |
| 59 | + with: |
| 60 | + name: bandit-report |
| 61 | + path: bandit-report.html |
| 62 | + |
| 63 | + # ----------------------------- |
| 64 | + # 3) Coverity Scan |
| 65 | + # ----------------------------- |
| 66 | + coverity_scan: |
| 67 | + name: Coverity Static Analysis |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - name: Checkout repository |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Install Coverity Toolset |
| 74 | + run: | |
| 75 | + # Install or bootstrap Coverity CLI if available |
| 76 | + # (Replace with your specific Coverity setup instructions) |
| 77 | + echo "Installing Coverity…" |
| 78 | + sudo apt-get update |
| 79 | + sudo apt-get install -y flex bison build-essential |
| 80 | +
|
| 81 | + - name: Run Coverity Analysis |
| 82 | + run: | |
| 83 | + mkdir cov-out |
| 84 | + # Replace below with your Coverity tour of code commands |
| 85 | + cov-build --dir cov-out make |
| 86 | +
|
| 87 | + - name: Upload Coverity Output |
| 88 | + uses: actions/upload-artifact@v3 |
| 89 | + with: |
| 90 | + name: coverity-output |
| 91 | + path: cov-out |
| 92 | + |
| 93 | + # ----------------------------- |
| 94 | + # 4) ClamAV Malware Scan |
| 95 | + # ----------------------------- |
| 96 | + clamav_scan: |
| 97 | + name: ClamAV Malware Scan |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - name: Checkout repository |
| 101 | + uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Install ClamAV |
| 104 | + run: | |
| 105 | + sudo apt-get update |
| 106 | + sudo apt-get install -y clamav clamav-daemon |
| 107 | +
|
| 108 | + - name: Update ClamAV DB |
| 109 | + run: sudo freshclam |
| 110 | + |
| 111 | + - name: Run ClamAV Against Repo |
| 112 | + run: | |
| 113 | + clamscan -r . > clamav-results.txt || true |
| 114 | +
|
| 115 | + - name: Upload ClamAV Report |
| 116 | + uses: actions/upload-artifact@v3 |
| 117 | + with: |
| 118 | + name: clamav-report |
| 119 | + path: clamav-results.txt |
0 commit comments