GitHub SecOps: DevSecOps Pipeline
name: DevSecOps Pipeline
on:
push:
branches:
- main
jobs:
security:
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout code
uses: actions/checkout@v4
# Secret scanning (GitGuardian or truffleHog recommended)
- name: Secret Scan (truffleHog)
uses: trufflesecurity/trufflehog@v3
with:
scan: true
# Static Application Security Testing (SAST) with SonarCloud
- name: SAST (SonarCloud)
uses: SonarSource/sonarcloud-github-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectKey: ${{ secrets.SONAR_PROJECT_KEY }}
# Software Composition Analysis (SCA) with OWASP Dependency-Check
- name: SCA (OWASP Dependency-Check)
uses: dependency-check/Dependency-Check_Action@v3
with:
project: my-app
format: 'HTML'
out: 'reports'
# Container image scanning with Trivy
- name: Container Scan (Trivy)
uses: aquasecurity/trivy-action@v0.14.0
with:
image-ref: 'myorg/myimage:latest'
# Dynamic Application Security Testing (DAST) with OWASP ZAP
- name: DAST (OWASP ZAP)
uses: zaproxy/action-full-scan@v0.7.0
with:
target: 'https://your-app-url.com'
# System Security Audit (Lynis)
- name: System Security Audit (Lynis)
uses: docker://cisagov/lynis
with:
args: audit system
# Optional: Bug tracking integration (e.g., Jira, GitHub Issues)
# - name: Create Issue on Failure
# uses: actions/github-script@v7
# if: failure()
# with:
# script: |
# // Create an issue or notify on failureBest Practices
References
Last updated