-
Notifications
You must be signed in to change notification settings - Fork 0
chore: Enhance DevSecOps pipeline #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+229
−658
Merged
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 8c039b1
add devsecops-pipeline workflow
meleksabit 6fe591f
Merge branch 'main' into dev
meleksabit d3e5daf
replace sonarqube with bandit
meleksabit bfc3f90
edit cron job
meleksabit 80ec32c
add comment for the cron job
meleksabit 4719684
Merge branch 'main' into dev
meleksabit b57b3ca
add Git Guardian workflow
meleksabit 6f43c71
Merge branch 'main' into dev
meleksabit 0e76968
edit Git Guardian workflow
meleksabit b96d528
edit Git Guardian workflow
meleksabit da6d3fd
edit Git Guardian workflow
meleksabit e436b3f
edit Git Guardian workflow
meleksabit caf63b1
edit Git Guardian workflow
meleksabit 54081f3
edit Git Guardian workflow
meleksabit 6a283a0
edit Git Guardian workflow
meleksabit 1392fd1
edit Git Guardian workflow
meleksabit 7b1f5a0
edit Git Guardian workflow
meleksabit b047d2f
edit README file
meleksabit 846feeb
Merge branch 'main' into dev
meleksabit aa79a35
edit DevSecOps pipeline
meleksabit 0bf5315
edit release badge
meleksabit 76cf414
Merge branch 'main' into dev
meleksabit a297c87
add .gitignore file
meleksabit ed02de5
Merge branch 'main' into dev
meleksabit 73401cd
add PR Title Linter
meleksabit 819522f
Merge branch 'main' into dev
meleksabit e95ba0b
add status badge for PR Linter
meleksabit e612e23
Merge branch 'main' into dev
meleksabit 0f06241
add SonarCloud implementation
meleksabit bfe67f2
edit sonar-project.properties
meleksabit 240ddca
Merge branch 'main' into dev
meleksabit eadc76d
add SonarCloud badge
meleksabit 144bce5
address suggestions from SonarCloud
meleksabit b062b91
Merge branch 'main' into dev
meleksabit d86fb9e
add secrets module in strong_passgen_for_prod.py
meleksabit fb607b9
edit strong_passgen_for_prod.py
meleksabit 22ee82d
edit strong_passgen_for_prod.py
meleksabit e2f3b42
edit strong_passgen_for_prod.py
meleksabit 74c22cd
edit strong_passgen_for_prod.py
meleksabit 560bfae
edit strong_passgen_for_prod.py
meleksabit e4dead0
edit strong_passgen_for_prod.py
meleksabit 4a27c24
edit strong_passgen_for_prod.py
meleksabit b6b5b70
edit strong_passgen_for_prod.py
meleksabit da0116d
edit crypto_passgen_for_prod.py script
meleksabit 4b323cc
docs: add Sonar Cloud status badges
meleksabit ed33e74
Merge branch 'main' into dev
meleksabit 4df6b37
docs: edit status badges
meleksabit 00e107b
docs: edit status badges
meleksabit 060f110
Merge branch 'main' into dev
meleksabit 3469a27
edit gitignore
meleksabit 8c125e9
Merge branch 'main' into dev
meleksabit 2687600
edit README
meleksabit c83920b
Merge branch 'main' into dev
meleksabit 468194b
update version of CodeQL Action (#60)
meleksabit 9ba55ed
Update codeql (#62)
meleksabit 6a8e9d7
Merge branch 'main' into dev
meleksabit f821f19
fix: Update sonarscan (#64)
meleksabit 15253e7
chore: Enhance DevSecOps pipeline (#65)
meleksabit 044cd58
Merge branch 'main' into dev
meleksabit 05a28fe
enhance DevSecOps pipeline
meleksabit 99fef66
bump trufflehog3
meleksabit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| 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, | ||
| 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() | ||
|
|
||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| bandit | ||
| ruff | ||
| pip-audit | ||
| safety | ||
| trufflehog | ||
| pylint | ||
| trufflehog3 | ||
| pylint |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.