Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/devsecops-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: DevSecOps Pipeline

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
security-checks:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install bandit safety truffleHog pylint

- name: Run DevSecOps Pipeline
run: python devsecops_pipeline.py
14 changes: 7 additions & 7 deletions devsecops_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def run_command(command, cwd=None):
sys.exit(result.returncode)
return result.stdout

# Static Code Analysis and Code Coverage (using SonarQube)
def run_sonarqube_analysis(path):
print("Running SonarQube for static code analysis and code coverage...")
run_command(f"sonar-scanner -Dsonar.projectBaseDir={path}")
# Static Code Analysis (using Bandit)
def run_bandit(path):
print("Running Bandit for static code analysis...")
run_command(f"bandit -r {path}")

# Dependency Checking (using Safety)
def run_safety():
Expand All @@ -41,8 +41,8 @@ def run_pylint(path):
def main():
project_path = os.getcwd()

# Static Analysis and Code Coverage with SonarQube
run_sonarqube_analysis(project_path)
# Static Analysis
run_bandit(project_path)

# Dependency Checking
run_safety()
Expand All @@ -54,7 +54,7 @@ def main():
terraform_path = os.path.join(project_path, 'terraform')
if os.path.exists(terraform_path):
run_terraform_scan(terraform_path)

# Linting
run_pylint(project_path)

Expand Down