update horusec scan

This commit is contained in:
Graham McIntire 2025-06-15 19:37:40 -05:00
parent cb58946f71
commit 2206ac1965
No known key found for this signature in database
4 changed files with 33 additions and 30 deletions

View file

@ -2,8 +2,8 @@ name: System Dependency Updates
on:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday at midnight
workflow_dispatch: # Allow manual triggering
- cron: "0 0 * * 0" # Weekly on Sunday at midnight
workflow_dispatch: # Allow manual triggering
jobs:
update-dependencies:
@ -39,11 +39,11 @@ jobs:
scanners: "vuln"
- name: Upload Trivy scan results
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: 'trivy-results.sarif'
category: 'Dependency Update Scan'
sarif_file: "trivy-results.sarif"
category: "Dependency Update Scan"
- name: Generate vulnerability summary
if: always()
@ -59,7 +59,7 @@ jobs:
- name: Upload vulnerability summary
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dependency-update-report
path: dep-update-report.md
@ -88,7 +88,7 @@ jobs:
- name: Create PR for base image update
if: steps.check_base_image.outputs.outdated == 'true'
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update Debian base image to ${{ steps.check_base_image.outputs.latest_version }}"

View file

@ -56,7 +56,7 @@ jobs:
scanners: "vuln,config,secret"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: "trivy-results.sarif"
@ -81,7 +81,7 @@ jobs:
vuln-type: "library"
- name: Upload detailed vulnerability reports
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: vulnerability-reports
@ -100,7 +100,7 @@ jobs:
sarif-file: scout-results.sarif
- name: Upload Docker Scout results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: docker-scout-report
@ -125,7 +125,7 @@ jobs:
echo '```' >> security-summary.md
- name: Upload security summary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: security-summary

View file

@ -52,12 +52,12 @@ jobs:
# Step: Check out the code.
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
# Step: Define how to cache deps. Restores existing cache if present.
- name: Cache deps
id: cache-deps
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
@ -71,7 +71,7 @@ jobs:
# project's downloaded deps every run.
- name: Cache compiled build
id: cache-build
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-compiled-build
with:

View file

@ -20,28 +20,29 @@ jobs:
# Cache Horusec to speed up subsequent runs
- name: Cache Horusec
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.horusec
key: ${{ runner.os }}-horusec-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-horusec-
# Install Horusec CLI directly since the action isn't available
- name: Install Horusec CLI
run: |
curl -fsSL https://raw.githubusercontent.com/ZupIT/horusec/main/deployments/scripts/install.sh | bash -s latest
horusec version
- name: Running Horusec Security Scan
id: horusec
uses: horuszup/horusec-action@v1.0.0
with:
arguments: >
-p="./"
--config-file-path="./horusec-config.json"
--output-format="json"
--output="./horusec-report.json"
run: |
horusec start -p="./" --config-file-path="./horusec-config.json" --output-format="json" --output="./horusec-report.json" || echo "::warning::Vulnerabilities found"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload security scan results as an artifact
- name: Upload Horusec Report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: horusec-report
@ -58,7 +59,7 @@ jobs:
- name: Cache Elixir deps
if: always()
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
deps
@ -73,10 +74,10 @@ jobs:
- name: Run Sobelow (Elixir-specific security scan)
if: always()
run: mix sobelow --format=json --out=sobelow-report.json --exit
run: mix sobelow --format=json --out=sobelow-report.json --exit || echo "::warning::Sobelow detected vulnerabilities"
- name: Upload Sobelow Report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: sobelow-report
@ -85,8 +86,10 @@ jobs:
# Optional: Fail the workflow if critical vulnerabilities are found
- name: Check for critical vulnerabilities
if: ${{ steps.horusec.outputs.exit-code != '0' }}
if: always()
run: |
echo "Critical vulnerabilities found in the security scan!"
echo "Review the security reports in the workflow artifacts."
exit 1
if grep -q "CRITICAL" horusec-report.json; then
echo "Critical vulnerabilities found in the security scan!"
echo "Review the security reports in the workflow artifacts."
exit 1
fi