replaces workflows #1
This file contains 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
# DevSecOps Workflow Definition | |
# This workflow is triggered on every push to the repository | |
name: DevSecOps Workflow | |
on: push | |
jobs: | |
# Secret scanning job to detect secrets in codebase | |
secret-scanning: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 # Check out the repository content to the runner | |
- name: Run Gitleaks Scan | |
# Running Gitleaks to scan the code for secrets | |
run: | | |
docker run --rm -v $(pwd):/code -u $(id -u):$(id -g) zricethezav/gitleaks:v8.18.1 -s /code detect -f sarif -r /code/gitleaks.sarif.json | |
- name: Upload sarif file | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: gitleaks.sarif.json | |
category: secret-scanning | |
# Software Composition Analysis (SCA) to find vulnerabilities in project dependencies | |
sca: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Trivy vulnerability scanner in fs mode | |
# Running Trivy to scan the filesystem for vulnerabilities | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: "fs" | |
scan-ref: "." | |
severity: "CRITICAL,HIGH" | |
format: "sarif" | |
output: "trivy-results.sarif" | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: "trivy-results.sarif" | |
category: "sca" | |
# Static Application Security Testing (SAST) to identify security vulnerabilities in source code | |
sast: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Semgrep | |
# Running Semgrep for static code analysis to identify security issues | |
uses: docker://returntocorp/semgrep | |
with: | |
args: semgrep scan /github/workspace --sarif -o /github/workspace/semgrep.sarif.json | |
- name: Upload sarif file | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: semgrep.sarif.json | |
category: sast |