Advanced Security Policy Compliance & Infrastructure Scanning
The Enhanced DevSecOps Policy Scanner is a comprehensive security compliance tool that scans infrastructure configurations, CI/CD settings, and repositories to enforce security policies as code before deployment. Built with advanced features for enterprise-grade security scanning.
- Multi-framework support: CIS, OWASP, NIST, custom policies
- Severity-based filtering: Critical, High, Medium, Low, Info
- Category-based organization: Authentication, Encryption, Network, etc.
- Dynamic policy loading and validation
- Risk scoring and prioritization
- Kubernetes: Pod security, RBAC, network policies
- Docker: Container security, image vulnerabilities
- Terraform: Infrastructure as Code security
- Python/JavaScript: Code security analysis
- General: Secret detection, configuration validation
- Rich terminal output with colors and formatting
- Progress indicators for long scans
- Interactive mode for policy configuration
- Multiple output formats: Text, JSON, HTML, CSV
- Comprehensive reporting with visualizations
- GitHub Actions integration with multi-stage scanning
- Automated PR comments with security insights
- Security issue creation for violations
- Weekly scheduled scans for continuous monitoring
- Artifact management for detailed reports
- Python 3.8+ with modern async support
- Rich & Typer for beautiful CLI interfaces
- PyYAML & JSON for policy definitions
- Security tools: Bandit, Safety, Semgrep, Checkov, Trivy
- Infrastructure: Kubernetes, Docker, Terraform support
- CI/CD: GitHub Actions, GitLab CI, Azure DevOps
# Clone the repository
git clone https://github.com/akintunero/devsecops-policy-scanner.git
cd devsecops-policy-scanner
# Install dependencies
pip install -r requirements.txt
# Install development dependencies (optional)
pip install -r requirements-dev.txt
# Scan current directory
python src/enhanced_cli.py scan .
# Scan with specific severity
python src/enhanced_cli.py scan . --severity critical
# Scan with framework filter
python src/enhanced_cli.py scan . --framework CIS
# Generate HTML report
python src/enhanced_cli.py scan . --format html --output report
# List all available policies
python src/enhanced_cli.py list-policies
# Show policy summary
python src/enhanced_cli.py summary
# Export policies to JSON
python src/enhanced_cli.py export --format json
# Scan with verbose output
python src/enhanced_cli.py scan . --verbose
- Control plane security policies
- Worker node configurations
- Pod security standards
- Network policy enforcement
- RBAC and authentication
- Broken Access Control (A01)
- Cryptographic Failures (A02)
- Injection vulnerabilities (A03)
- Insecure Design (A04)
- Security Misconfiguration (A05)
- Vulnerable Components (A06)
- Authentication Failures (A07)
- Software Integrity (A08)
- Logging Failures (A09)
- SSRF Protection (A10)
- Organization-specific security requirements
- Industry compliance standards
- Best practice enforcement
- Risk-based policy management
Policies are defined in YAML format with advanced features:
- key: enforce_2fa
value: true
description: "Two-Factor Authentication must be enabled"
severity: "high"
category: "authentication"
framework: "CIS"
control_id: "1.1.1"
remediation: "Enable 2FA for all repository admins"
tags: ["auth", "compliance"]
# config.yaml
scan_settings:
severity_filter: ["critical", "high"]
category_filter: ["authentication", "encryption"]
framework_filter: ["CIS", "OWASP"]
output_format: "html"
verbose: true
reporting:
include_remediation: true
risk_scoring: true
trend_analysis: true
π Scan Configuration
π Path: ./kubernetes-manifests
π― Severity Filter: All
π·οΈ Category Filter: All
π Framework Filter: All
π Scan Results Summary
β
Compliant: 15/20 (75.0%)
β Non-Compliant: 5/20 (25.0%)
π― Total Risk Score: 25.5
{
"scan_results": [
{
"policy_key": "enforce_2fa",
"compliant": false,
"actual_value": false,
"message": "β Two-Factor Authentication must be enabled",
"risk_score": 7.5,
"severity": "high",
"category": "authentication"
}
],
"summary": {
"total_policies": 20,
"compliant": 15,
"non_compliant": 5,
"total_risk_score": 25.5
}
}
- Interactive dashboard with charts
- Detailed policy violation reports
- Remediation guidance
- Export capabilities
The scanner includes comprehensive GitHub Actions workflows:
# .github/workflows/enhanced_policy_scan.yml
name: Enhanced Policy Compliance Scan
on:
pull_request:
branches: [main, develop]
push:
branches: [main]
schedule:
- cron: '0 2 * * 1' # Weekly scans
Features:
- Multi-stage scanning (Security, Dependencies, Infrastructure)
- Automated PR comments with security insights
- Security issue creation for violations
- Comprehensive artifact management
- Weekly scheduled scans
# GitLab CI
python src/enhanced_cli.py scan . --format json --output gitlab-report
# Azure DevOps
python src/enhanced_cli.py scan . --format html --output azure-report
# Jenkins
python src/enhanced_cli.py scan . --format csv --output jenkins-report
# Kubernetes manifests
python src/enhanced_cli.py scan ./k8s-manifests --framework CIS
# Docker configurations
python src/enhanced_cli.py scan ./docker --category container_security
# Terraform code
python src/enhanced_cli.py scan ./terraform --framework infrastructure
# Python code
python src/enhanced_cli.py scan ./src --category code_security
# JavaScript/Node.js
python src/enhanced_cli.py scan ./frontend --category injection
# Mixed codebase
python src/enhanced_cli.py scan . --verbose --output comprehensive-report
- Live scan progress indicators
- Real-time policy compliance tracking
- Instant violation notifications
- Risk score calculations
- Executive dashboards
- Trend analysis over time
- Compliance percentage tracking
- Remediation progress monitoring
- Prometheus metrics export
- Grafana dashboard templates
- Slack/Teams notifications
- Email alerting system
- Hardcoded credentials scanning
- API key detection
- Token validation
- Environment variable checking
- Dependency vulnerability scanning
- CVE database integration
- Risk-based prioritization
- Remediation recommendations
- Industry standard compliance
- Regulatory requirement checking
- Audit trail generation
- Compliance reporting
- Parallel processing for large codebases
- Incremental scanning capabilities
- Caching mechanisms for repeated scans
- Resource usage optimization
- Multi-tenant support
- Role-based access control
- Centralized policy management
- Audit logging and compliance
We welcome contributions! Please see our Contributing Guide for details.
# Clone and setup
git clone https://github.com/akintunero/devsecops-policy-scanner.git
cd devsecops-policy-scanner
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
# Format code
black src/
flake8 src/
- Create a new YAML file in
policies/
- Define policies with proper metadata
- Add tests in
tests/
- Update documentation
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Security Policy
- CIS for Kubernetes benchmarks
- OWASP for security guidelines
- Open source security tools community
- Contributors and maintainers
π Secure your infrastructure with confidence!