Skip to content

Gurkirxt/devops-project

Repository files navigation

DevSecOps CVE Prevention Feasibility Assessment

Research Project: Assessing the effectiveness of open-source DevOps security tools across the entire SDLC by testing their ability to detect/prevent real-world CVEs.

🎯 Project Objective

To answer the critical question: Can security tools effectively catch bugs at different SDLC stages before they become CVEs in production?

This project tests 25+ open-source security tools against 30+ real-world CVEs to determine:

  • βœ… Which tools provide the best CVE prevention coverage
  • βœ… At which SDLC stage vulnerabilities are most effectively caught
  • βœ… What's the optimal minimal viable toolset for different organization sizes
  • βœ… What vulnerability classes still require human review or custom policies

πŸ“Š Project Structure

devops_rp/
β”œβ”€β”€ tools/                      # Tool organization by SDLC stage
β”‚   β”œβ”€β”€ development/           # IDE plugins, linters
β”‚   β”œβ”€β”€ pre-commit/           # Git hooks, fast scanners
β”‚   β”œβ”€β”€ ci-cd/                # Pipeline integration
β”‚   β”œβ”€β”€ pre-deploy/           # Admission control, policies
β”‚   β”œβ”€β”€ runtime/              # Runtime security
β”‚   └── supporting/           # SBOM, secrets, licenses
β”‚
β”œβ”€β”€ vulnerable-configs/        # Recreated CVE configurations
β”‚   β”œβ”€β”€ kubernetes/           # K8s CVE configs
β”‚   β”œβ”€β”€ terraform/            # IaC CVE configs
β”‚   β”œβ”€β”€ ansible/              # Config management CVEs
β”‚   β”œβ”€β”€ docker/               # Container CVEs
β”‚   β”œβ”€β”€ github-actions/       # CI/CD pipeline CVEs
β”‚   └── source-code/          # Application code CVEs
β”‚
β”œβ”€β”€ policies/                  # Custom OPA/Rego policies
β”‚   β”œβ”€β”€ kubernetes/           # K8s custom policies
β”‚   β”œβ”€β”€ terraform/            # Terraform policies
β”‚   β”œβ”€β”€ ansible/              # Ansible policies
β”‚   └── ci-cd/                # CI/CD security policies
β”‚
β”œβ”€β”€ scripts/                   # Automated testing scripts
β”‚   β”œβ”€β”€ run_development_scan.sh    # Development stage
β”‚   β”œβ”€β”€ run_precommit_scan.sh      # Pre-commit stage
β”‚   β”œβ”€β”€ run_cicd_scan.sh           # CI/CD stage
β”‚   β”œβ”€β”€ run_predeploy_scan.sh      # Pre-deploy stage
β”‚   β”œβ”€β”€ run_all_stages.sh          # Master orchestration
β”‚   └── verify_tools.sh            # Tool verification
β”‚
β”œβ”€β”€ results/                   # Scan outputs by stage
β”‚   β”œβ”€β”€ development/
β”‚   β”œβ”€β”€ pre-commit/
β”‚   β”œβ”€β”€ ci-cd/
β”‚   β”œβ”€β”€ pre-deploy/
β”‚   └── aggregated/
β”‚
β”œβ”€β”€ cve_tracking.csv          # Main prevention tracking matrix
β”œβ”€β”€ tools_catalog.csv         # Tool metadata & feasibility scores
└── README.md                 # This file

πŸ› οΈ Tool Catalog (25+ Tools)

Development Stage (Shift-Left)

  • Semgrep - SAST for custom patterns & logic flaws
  • Bandit - Python security scanning
  • gosec - Go security analysis
  • ESLint - JavaScript/TypeScript linting
  • ShellCheck - Shell script analysis
  • ansible-lint - Ansible best practices

Pre-Commit Stage (Fast Feedback)

  • Checkov - IaC security (Terraform, K8s, Docker)
  • Trivy - Multi-scanner (containers, IaC, secrets)
  • tfsec - Terraform-specific security
  • Hadolint - Dockerfile best practices
  • Gitleaks - Secret detection
  • detect-secrets - Secret baseline scanning
  • yamllint - YAML validation

CI/CD Build Stage (Comprehensive)

  • KICS - Multi-IaC scanning (50+ platforms)
  • Terrascan - OPA-based IaC policies
  • Grype - Vulnerability scanning
  • Syft - SBOM generation
  • OSV-Scanner - Open Source Vulnerabilities DB
  • TruffleHog - Deep secret scanning
  • Kubescape - K8s security posture
  • Kubesec - K8s manifest scoring
  • Polaris - K8s best practices validation

Pre-Deploy Stage (Policy Enforcement)

  • OPA/Conftest - Policy-as-code engine
  • Datree - K8s policy enforcement
  • Kyverno - K8s-native policies

Runtime Stage (Production Monitoring)

  • Falco - Runtime threat detection
  • OWASP ZAP - Dynamic application security
  • Nuclei - Template-based vulnerability scanning

πŸš€ Quick Start

Option A: Docker (Recommended - Zero Installation!)

All 25+ tools pre-packaged in a single container!

# 1. Build the container (one-time, ~5-10 minutes)
./docker-quickstart.sh
# Choose option 1: Build the container image

# 2. Run interactive scanner shell
./docker-quickstart.sh
# Choose option 2: Run interactive shell

# Inside container, run any scan:
./scripts/run_precommit_scan.sh
./scripts/run_all_stages.sh

Or using docker-compose directly:

# Build the image
docker-compose build

# Run interactive shell
docker-compose run --rm devsecops-scanner

# Run all scans (non-interactive)
docker-compose run --rm devsecops-scanner /workspace/scripts/run_all_stages.sh

Benefits:

  • βœ… Zero manual tool installation
  • βœ… Consistent environment across all systems
  • βœ… Reproducible results
  • βœ… No dependency conflicts
  • βœ… Easy to share and distribute

Image Details:

  • Base: Ubuntu 22.04
  • Size: ~2-3GB (includes all tools)
  • Tools: 25+ pre-installed and verified
  • Mount points: vulnerable-configs/, results/, policies/

Option B: Manual Installation (Native)

If you prefer to install tools directly on your system:

1. Verify Tool Installation

# Check which tools are installed
./scripts/verify_tools.sh

2. Install Missing Tools

Python-based tools:

pip install checkov bandit semgrep ansible-lint detect-secrets yamllint

Binary tools (macOS/Linux via Homebrew):

brew install trivy tfsec hadolint gitleaks shellcheck
brew install kubescape terrascan

Go tools:

go install github.com/securego/gosec/v2/cmd/gosec@latest
go install github.com/trufflesecurity/trufflehog/v3@latest

Container-based tools:

# KICS, Kubesec, etc. run via Docker
docker pull checkmarx/kics

Additional tools:

# Grype & Syft
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh

# OSV-Scanner
go install github.com/google/osv-scanner/cmd/osv-scanner@latest

3. Run Scans

Single stage:

# Development stage (fast, IDE-accessible)
./scripts/run_development_scan.sh

# Pre-commit stage (<30s target)
./scripts/run_precommit_scan.sh

# CI/CD stage (comprehensive, 2-5 min)
./scripts/run_cicd_scan.sh

# Pre-deploy stage (policy enforcement)
./scripts/run_predeploy_scan.sh

All stages:

# Run complete multi-stage analysis
./scripts/run_all_stages.sh

4. Analyze Results

Results are organized by SDLC stage in results/ directory:

# View development stage results
ls -lh results/development/

# View CI/CD stage results
ls -lh results/ci-cd/

# Check aggregated findings
cat results/aggregated/summary.txt

πŸ“‹ CVE Test Cases

The project includes real-world vulnerable configurations for CVEs including:

High-Priority CVEs (Sample)

CVE ID Tool/Project Type SDLC Catch Stage
CVE-2025-1974 ingress-nginx K8s Admission Exposure Pre-Commit, CI/CD, Pre-Deploy
CVE-2024-8775 Ansible Secret Exposure Pre-Commit, CI/CD
CVE-2025-13357 Vault TF Provider LDAP Auth Bypass Pre-Commit, CI/CD
CVE-2025-49013 GitHub Actions Script Injection Pre-Commit, CI/CD
CVE-2024-23652 BuildKit Path Traversal Pre-Commit, CI/CD
CVE-2024-21626 runc Container Escape CI/CD (scanning), Runtime
CVE-2024-6385 GitLab Pipeline Execution Pre-Commit, CI/CD

Full list: See cve_tracking.csv for 30+ CVEs with metadata.


πŸ”¬ Testing Methodology

Phase 1: Setup

  1. Install all 25+ security tools across SDLC stages
  2. Create comprehensive CVE catalog with vulnerable versions
  3. Recreate vulnerable configurations for each testable CVE

Phase 2: Execution

  1. Run stage-specific scans (Development β†’ Pre-Commit β†’ CI/CD β†’ Pre-Deploy)
  2. Document detection results for each tool-CVE combination
  3. Measure feasibility metrics (scan time, false positives, complexity)

Phase 3: Analysis

  1. Calculate CVE prevention effectiveness by stage
  2. Identify tool coverage gaps
  3. Create custom policies for undetected CVEs
  4. Generate ROI-based tool recommendations

Phase 4: Reporting

  1. Populate cve_tracking.csv with complete prevention data
  2. Document tool feasibility scores in tools_catalog.csv
  3. Create final feasibility assessment report
  4. Generate implementation roadmap

πŸ“Š Expected Deliverables

  1. cve_tracking.csv - Complete prevention effectiveness matrix

    • CVE detection by tool and SDLC stage
    • Prevention confidence scores
    • Integration complexity ratings
  2. tools_catalog.csv - Tool feasibility assessment

    • Integration complexity (1-5 scale)
    • Scan speed metrics
    • False positive rates
    • Developer friction scores
    • CVE detection coverage percentages
  3. Custom Policies (policies/)

    • OPA/Rego policies for tool gaps
    • CVE-specific detection rules
    • Best practice enforcement
  4. Scan Results (results/)

    • Raw tool outputs by SDLC stage
    • Aggregated findings
    • Performance metrics
  5. Feasibility Report

    • Overall CVE prevention statistics
    • SDLC stage effectiveness analysis
    • Tool ROI rankings
    • Recommended minimal viable toolset
    • Implementation roadmap by organization size

🎯 Key Research Questions

1. CVE Prevention Coverage

  • Q: What percentage of CVEs would be caught by standard tools?
  • Measure: Detection rate across 30+ CVEs

2. SDLC Stage Effectiveness

  • Q: Which stage catches the most CVEs earliest?
  • Measure: Prevention by stage (Development, Pre-Commit, CI/CD, Pre-Deploy, Runtime)

3. Tool ROI Analysis

  • Q: Which tools provide best value (coverage vs. complexity)?
  • Measure: Detection coverage / (Integration complexity + False positive rate)

4. Gap Identification

  • Q: What vulnerability classes require custom policies?
  • Measure: CVEs undetected by any standard tool

5. Practical Adoption

  • Q: What's the minimal viable toolset?
  • Measure: Smallest tool combination achieving 80%+ coverage

πŸ“ˆ Sample Scan Output

$ ./scripts/run_all_stages.sh

=========================================
DevSecOps CVE Prevention Assessment
Multi-Stage Security Scanning
=========================================

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stage 1/4: Development Stage            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
[1/7] Running Semgrep (SAST)...
[2/7] Running Bandit (Python)...
...
βœ… Development stage scanning complete

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stage 2/4: Pre-Commit Stage             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
[1/7] Running Checkov...
[2/7] Running Trivy...
...
βœ… Pre-commit stage scanning complete
⏱️  Scan time: 24s

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stage 3/4: CI/CD Build Stage            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
[1/15] Running Checkov...
[2/15] Running Trivy Config Scanner...
...
βœ… CI/CD stage scanning complete
⏱️  Scan time: 3m 42s

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stage 4/4: Pre-Deploy Stage             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
[1/6] Running Conftest (K8s policies)...
...
βœ… Pre-deploy stage scanning complete

=========================================
βœ… All stages complete!
=========================================
⏱️  Total scan time: 5m 12s
πŸ“ Results: results/
πŸ“Š CSV Tracking: cve_tracking.csv
=========================================

πŸ” Custom Policy Examples

CVE-2025-1974: Ingress NGINX Admission Exposure

# policies/kubernetes/cve-2025-1974-admission-exposure.rego
package kubernetes.admission.cve_2025_1974

deny[msg] {
    input.kind == "Service"
    contains(lower(input.metadata.name), "admission")
    input.spec.type == "LoadBalancer"
    
    msg := "CVE-2025-1974: Admission controller must not be LoadBalancer type"
}

CVE-2024-8775: Ansible Secret Exposure

# policies/ansible/cve-2024-8775-no-log.rego
package ansible.security.cve_2024_8775

deny[msg] {
    task := input.tasks[_]
    task.include_vars
    not task.no_log == true
    
    msg := "CVE-2024-8775: include_vars without no_log may expose vault secrets"
}

🀝 Contributing

This is a research project. To contribute:

  1. Add new CVE test cases to vulnerable-configs/
  2. Create corresponding OPA policies in policies/
  3. Update cve_tracking.csv with new CVE metadata
  4. Document findings and update feasibility scores

πŸ“š References


πŸ“ License

This project is for research and educational purposes. All CVE data is sourced from public databases (NVD, GitHub Security Advisories, vendor disclosures).


🏁 Next Steps

For Docker Users (Recommended)

  1. βœ… Setup Complete - Project structure ready
  2. πŸ”„ Build Container - Run ./docker-quickstart.sh (option 1)
  3. πŸ”„ Add More CVEs - Expand vulnerable-configs with remaining 25+ CVEs
  4. πŸ”„ Run Tests - Use ./docker-quickstart.sh (option 3) or run scans interactively
  5. πŸ”„ Analyze Results - Populate cve_tracking.csv with findings
  6. πŸ”„ Final Report - Generate feasibility assessment and recommendations

For Manual Installation Users

  1. βœ… Setup Complete - Project structure and initial tools configured
  2. πŸ”„ Install Tools - Run ./scripts/verify_tools.sh and install missing tools
  3. πŸ”„ Add More CVEs - Expand vulnerable-configs with remaining 25+ CVEs
  4. πŸ”„ Run Tests - Execute ./scripts/run_all_stages.sh
  5. πŸ”„ Analyze Results - Populate cve_tracking.csv with findings
  6. πŸ”„ Final Report - Generate feasibility assessment and recommendations

Project Status: πŸ—οΈ Initial framework complete. Ready for tool installation and CVE expansion.

Last Updated: 2026-01-30

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors