Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b58cc9f
add devsecops_pipeline.py
meleksabit Aug 28, 2024
8c039b1
add devsecops-pipeline workflow
meleksabit Aug 29, 2024
6fe591f
Merge branch 'main' into dev
meleksabit Aug 29, 2024
d3e5daf
replace sonarqube with bandit
meleksabit Aug 29, 2024
bfc3f90
edit cron job
meleksabit Sep 5, 2024
80ec32c
add comment for the cron job
meleksabit Sep 8, 2024
4719684
Merge branch 'main' into dev
meleksabit Sep 8, 2024
b57b3ca
add Git Guardian workflow
meleksabit Sep 11, 2024
6f43c71
Merge branch 'main' into dev
meleksabit Sep 11, 2024
0e76968
edit Git Guardian workflow
meleksabit Sep 11, 2024
b96d528
edit Git Guardian workflow
meleksabit Sep 11, 2024
da6d3fd
edit Git Guardian workflow
meleksabit Sep 11, 2024
e436b3f
edit Git Guardian workflow
meleksabit Sep 11, 2024
caf63b1
edit Git Guardian workflow
meleksabit Sep 11, 2024
54081f3
edit Git Guardian workflow
meleksabit Sep 11, 2024
6a283a0
edit Git Guardian workflow
meleksabit Sep 11, 2024
1392fd1
edit Git Guardian workflow
meleksabit Sep 11, 2024
7b1f5a0
edit Git Guardian workflow
meleksabit Sep 11, 2024
b047d2f
edit README file
meleksabit Sep 14, 2024
846feeb
Merge branch 'main' into dev
meleksabit Sep 14, 2024
aa79a35
edit DevSecOps pipeline
meleksabit Sep 26, 2024
0bf5315
edit release badge
meleksabit Oct 7, 2024
76cf414
Merge branch 'main' into dev
meleksabit Oct 7, 2024
a297c87
add .gitignore file
meleksabit Oct 8, 2024
ed02de5
Merge branch 'main' into dev
meleksabit Oct 8, 2024
73401cd
add PR Title Linter
meleksabit Nov 17, 2024
819522f
Merge branch 'main' into dev
meleksabit Nov 17, 2024
e95ba0b
add status badge for PR Linter
meleksabit Nov 17, 2024
e612e23
Merge branch 'main' into dev
meleksabit Nov 17, 2024
0f06241
add SonarCloud implementation
meleksabit Nov 28, 2024
bfe67f2
edit sonar-project.properties
meleksabit Nov 28, 2024
240ddca
Merge branch 'main' into dev
meleksabit Nov 28, 2024
eadc76d
add SonarCloud badge
meleksabit Nov 28, 2024
144bce5
address suggestions from SonarCloud
meleksabit Nov 28, 2024
b062b91
Merge branch 'main' into dev
meleksabit Nov 28, 2024
d86fb9e
add secrets module in strong_passgen_for_prod.py
meleksabit Nov 28, 2024
fb607b9
edit strong_passgen_for_prod.py
meleksabit Nov 28, 2024
22ee82d
edit strong_passgen_for_prod.py
meleksabit Nov 28, 2024
e2f3b42
edit strong_passgen_for_prod.py
meleksabit Nov 28, 2024
74c22cd
edit strong_passgen_for_prod.py
meleksabit Nov 28, 2024
560bfae
edit strong_passgen_for_prod.py
meleksabit Nov 28, 2024
e4dead0
edit strong_passgen_for_prod.py
meleksabit Nov 29, 2024
4a27c24
edit strong_passgen_for_prod.py
meleksabit Nov 29, 2024
b6b5b70
edit strong_passgen_for_prod.py
meleksabit Nov 29, 2024
da0116d
edit crypto_passgen_for_prod.py script
meleksabit Nov 29, 2024
4b323cc
docs: add Sonar Cloud status badges
meleksabit Dec 17, 2024
ed33e74
Merge branch 'main' into dev
meleksabit Dec 17, 2024
4df6b37
docs: edit status badges
meleksabit Dec 17, 2024
00e107b
docs: edit status badges
meleksabit Dec 17, 2024
060f110
Merge branch 'main' into dev
meleksabit Dec 17, 2024
3469a27
edit gitignore
meleksabit Jan 21, 2025
8c125e9
Merge branch 'main' into dev
meleksabit Jan 21, 2025
2687600
edit README
meleksabit Jun 2, 2025
c83920b
Merge branch 'main' into dev
meleksabit Jun 2, 2025
468194b
update version of CodeQL Action (#60)
meleksabit Apr 5, 2026
9ba55ed
Update codeql (#62)
meleksabit Apr 5, 2026
6a8e9d7
Merge branch 'main' into dev
meleksabit Apr 5, 2026
f821f19
fix: Update sonarscan (#64)
meleksabit May 6, 2026
15253e7
chore: Enhance DevSecOps pipeline (#65)
meleksabit May 25, 2026
044cd58
Merge branch 'main' into dev
meleksabit May 25, 2026
05a28fe
enhance DevSecOps pipeline
meleksabit May 25, 2026
99fef66
bump trufflehog3
meleksabit Jul 21, 2026
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
65 changes: 53 additions & 12 deletions .github/workflows/devsecops-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main

pull_request:
branches:
- main
Expand All @@ -12,19 +13,59 @@ jobs:
security-checks:
runs-on: ubuntu-latest

permissions:
contents: read
security-events: write

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

- name: Set up Python
uses: actions/setup-python@28f2168f4d98ee0445e3c6321f6e6616c83dd5ec
with:
python-version: '3.13'

- name: Install Dependencies
run: |
pip install --require-hashes --only-binary :all: -r requirements.txt

# -------------------------
# Bandit (Python SAST)
# -------------------------
- name: Run Bandit
run: |
bandit -r .

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
# -------------------------
# pip-audit (Dependency Audit)
# -------------------------
- name: Run pip-audit
run: |
pip-audit

- name: Install Dependencies
run: |
python -m pip install pip==26.1.1
pip install --require-hashes --only-binary :all: -r requirements.txt
# -------------------------
# Ruff (Modern Linting)
# -------------------------
- name: Run Ruff
run: |
ruff check .

- name: Run DevSecOps Pipeline
run: python devsecops_pipeline.py
# -------------------------
# Trivy IaC Scan
# -------------------------
- name: Run Trivy IaC Scan
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25
with:
scan-type: 'config'
scan-ref: '.'

# -------------------------
# TruffleHog Secret Scan
# -------------------------
- name: TruffleHog Secret Scan
uses: trufflesecurity/trufflehog@37b77001d0174ebec2fcca2bd83ff83a6d45a3ab
with:
path: ./
base: main
head: HEAD
66 changes: 18 additions & 48 deletions devsecops_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,34 @@
import os
import subprocess
import sys

# Helper function to run shell commands
def run_command(command, cwd=None):
result = subprocess.run(command, shell=True, cwd=cwd, text=True, capture_output=True)
def run_command(command):
result = subprocess.run(
command,
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
shell=True,
text=True,
capture_output=True
)

if result.returncode != 0:
print(f"Error: Command '{command}' failed with exit code {result.returncode}")
print(f"FAILED: {command}")
print(result.stdout)
print(result.stderr)
sys.exit(result.returncode)
return result.stdout

# 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():
print("Running Safety for dependency checking...")
run_command("safety check --full-report")

# Secret Scanning (using TruffleHog)
def run_trufflehog(path):
print("Running TruffleHog for secret scanning...")
run_command(f"trufflehog {path}")
print(result.stdout)

# Infrastructure as Code Scanning (using Terraform and Snyk)
def run_terraform_scan(path):
print("Running Snyk for Terraform IaC scanning...")
run_command(f"snyk iac test {path}")

# Code Coverage and Linting (using Pylint)
def run_pylint(path):
print("Running Pylint for code linting...")
run_command(f"pylint {path}")

# Main function to orchestrate the DevSecOps pipeline
def main():
project_path = os.getcwd()
print("Running Bandit...")
run_command("bandit -r .")

print("Running pip-audit...")
run_command("pip-audit")

# Static Analysis
run_bandit(project_path)

# Dependency Checking
run_safety()

# Secret Scanning
run_trufflehog(project_path)

# Terraform IaC Scanning
terraform_path = os.path.join(project_path, 'terraform')
if os.path.exists(terraform_path):
run_terraform_scan(terraform_path)

# Linting
run_pylint(project_path)
print("Running Ruff...")
run_command("ruff check .")

print("DevSecOps pipeline completed successfully!")

if __name__ == "__main__":
main()

6 changes: 4 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
bandit
ruff
pip-audit
safety
trufflehog
pylint
trufflehog3
pylint
Loading
Loading