Comprehensive security assessment tool for AWS Infrastructure-as-Code
SDLC Code Scanner is a Docker-based security scanning platform that orchestrates multiple industry-leading security tools to provide comprehensive analysis of your AWS infrastructure code. It implements a multi-layered security scanning approach covering linting, security policies, dependency vulnerabilities, and secrets detection.
Available as a GitHub Action for seamless CI/CD integration!
- 10+ Security Tools integrated in a single container
- Automated Detection of IaC frameworks (Terraform, CloudFormation, npm, Python)
- Parallel Execution for faster scan times
- Finding Deduplication across multiple tools
- Rule Exclusions for customizable scanning policies
- Path Exclusions to skip test directories and fixtures
terraform fmt/validate- Code formatting and syntax validationTFLint- Terraform linting and best practicestfsec- Security scanning for AWS, Azure, GCP resourcesCheckov- Policy-as-code and compliance scanningTrivy- Vulnerability and misconfiguration detection
cfn-lint- Template validation and best practicescfn-nag- Security-focused template analysisCheckov- Policy and compliance checking
Bandit- Python code security analysis (SQL injection, weak crypto, etc.)Safety- Dependency vulnerability detection (CVE scanning)Pylint- Code quality and error detection
Gitleaks- Secrets and credentials detectionnpm audit- JavaScript/TypeScript dependency vulnerabilitiesSnyk- Advanced dependency and license scanning
- JSON - Structured data for CI/CD integration
- HTML - Interactive dashboard with color-coded severity levels
- Markdown - Documentation-ready format
- SARIF - GitHub Code Scanning integration (CodeQL compatible)
- Severity-based Exit Codes - Fail builds on critical/high findings
The easiest way to use SDLC Code Scanner is as a GitHub Action:
name: Security Scan
on: [push, pull_request]
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run SDLC Code Scanner
uses: crofton-cloud/sdlc-code-scanner@v1
with:
scan-path: '.'
fail-on-severity: 'HIGH'See GitHub Action Usage for full documentation.
- Docker installed and running (for local usage)
docker build -t sdlc-code-scanner:latest .Or use the pre-built image (if available):
docker pull croftoncloud/sdlc-code-scanner:latestScan a local repository:
docker run --rm \
-v /path/to/your/repo:/repo:ro \
-v $(pwd)/reports:/app/reports \
sdlc-code-scanner:latest \
scan-local --repo-path /repoUsing the helper script:
./scripts/run-local-scan.sh /path/to/your/repoScan your IaC code for security issues:
docker run --rm \
-v /path/to/repo:/repo:ro \
-v $(pwd)/reports:/app/reports \
sdlc-code-scanner:latest \
scan-local \
--repo-path /repo \
--output-dir /app/reports \
--format json \
--format html \
--format markdownHelper Script:
./scripts/run-local-scan.sh /path/to/repo [output-dir] [config-file]docker run --rm sdlc-code-scanner:latest list-toolsdocker run --rm \
-v $(pwd)/config:/app/config:ro \
sdlc-code-scanner:latest \
validate-configNote: Full validation is planned for a future release.
The tool is configured via config/config.yaml. Key configuration sections:
tools:
terraform:
enabled: true
terraform_fmt: true
tflint: true
tfsec: true
checkov: true
trivy: true
cloudformation:
enabled: true
cfn_lint: true
cfn_nag: true
checkov: true
python:
enabled: true
bandit: true # Python code security
safety: true # Dependency vulnerabilities
pylint: true # Code quality
npm:
enabled: true
npm_audit: true
snyk: true
secrets:
enabled: true
gitleaks: trueExclude specific rules from reporting (false positives, known exceptions):
tools:
terraform:
exclude_rules:
tflint: []
tfsec: []
checkov: []
trivy: ["DS026"] # Example: Skip HEALTHCHECK for CLI tools
cloudformation:
exclude_rules:
cfn_nag: ["W89"] # Example: Lambda VPC requirement
cfn_lint: []
checkov: []
python:
exclude_rules:
bandit: ["B404", "B603"] # subprocess usage - safe in scanner tool
safety: []Exclude directories from scanning:
repository:
excluded_paths:
- "tests"
- "test"
- "**/fixtures"
- "node_modules"
- ".terraform"severity:
fail_on: "HIGH" # Exit with error if findings at this level or above
report_minimum: "LOW" # Only report findings at this level or aboveoutput:
directory: "/app/reports"
formats:
- json
- html
- markdown
verbose: falseexecution:
parallel: true # Run scanners in parallel
max_workers: 4 # Number of parallel workers
timeout_per_scanner: 600 # Timeout in secondsCONFIG_PATH- Path to config.yaml (default: /app/config/config.yaml)LOG_LEVEL- Logging verbosity (DEBUG, INFO, WARNING, ERROR, CRITICAL)REPO_PATH- Repository path overrideREPORTS_PATH- Reports output path override
Structured data suitable for CI/CD pipelines and programmatic processing:
{
"scan_timestamp": "2025-11-17T01:10:55.945707",
"summary": {
"total_findings": 47,
"by_severity": {
"CRITICAL": 2,
"HIGH": 16,
"MEDIUM": 5,
"LOW": 6,
"INFO": 18
},
"by_tool": {
"tfsec": 13,
"checkov": 18,
"trivy": 13
}
},
"findings": [...]
}Interactive dashboard with:
- Summary statistics and metrics
- Color-coded severity badges
- Grouped findings by severity
- Detailed remediation guidance
- Responsive design
Documentation-ready format with:
- Scan summary and statistics
- Findings organized by severity
- Code locations and line numbers
- Remediation recommendations
SDLC Code Scanner is available as a GitHub Action for seamless CI/CD integration with GitHub Code Scanning support.
name: Security Scan
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run SDLC Code Scanner
uses: crofton-cloud/sdlc-code-scanner@v1
with:
scan-path: '.'
fail-on-severity: 'HIGH'| Input | Description | Default |
|---|---|---|
scan-path |
Path to scan (relative to repository root) | . |
config-path |
Path to custom config.yaml file | '' |
output-formats |
Comma-separated formats: json, html, markdown, sarif | json,sarif |
fail-on-severity |
Fail if findings at this level or above (CRITICAL,HIGH,MEDIUM,LOW,INFO,NONE) | HIGH |
snyk-token |
Snyk API token for enhanced scanning | '' |
upload-sarif |
Upload SARIF results to GitHub Code Scanning | true |
verbose |
Enable verbose output | false |
| Output | Description |
|---|---|
findings-count |
Total number of security findings |
critical-count |
Number of CRITICAL severity findings |
high-count |
Number of HIGH severity findings |
medium-count |
Number of MEDIUM severity findings |
low-count |
Number of LOW severity findings |
report-path |
Path to the generated report directory |
sarif-path |
Path to the SARIF report file |
scan-status |
Scan result status (passed/failed/error) |
name: Security Scan
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
security-events: write
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run SDLC Code Scanner
id: scan
uses: crofton-cloud/sdlc-code-scanner@v1
with:
scan-path: '.'
output-formats: 'json,html,sarif'
fail-on-severity: 'HIGH'
snyk-token: ${{ secrets.SNYK_TOKEN }}
- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: ${{ steps.scan.outputs.sarif-path }}
- name: Upload reports as artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: security-reports
path: .sdlc-code-scanner-reports/
retention-days: 30
- name: Check scan results
run: |
echo "Total findings: ${{ steps.scan.outputs.findings-count }}"
echo "Critical: ${{ steps.scan.outputs.critical-count }}"
echo "High: ${{ steps.scan.outputs.high-count }}"- name: Scan only infrastructure directory
uses: crofton-cloud/sdlc-code-scanner@v1
with:
scan-path: 'infrastructure/terraform'
fail-on-severity: 'MEDIUM'- name: Scan with custom config
uses: crofton-cloud/sdlc-code-scanner@v1
with:
config-path: '.github/sdlc-code-scanner-config.yaml'- name: Scan without failing
uses: crofton-cloud/sdlc-code-scanner@v1
with:
fail-on-severity: 'NONE'security-scan:
image: docker:latest
services:
- docker:dind
script:
- docker run --rm
-v $CI_PROJECT_DIR:/repo:ro
-v $CI_PROJECT_DIR/reports:/app/reports
sdlc-code-scanner:latest
scan-local --repo-path /repo --format json
artifacts:
paths:
- reports/
when: always# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: sdlc-code-scanner
name: SDLC Code Scanner
entry: ./scripts/run-local-scan.sh
language: script
pass_filenames: false0- Scan completed successfully, no issues at or above fail threshold1- Scan failed due to error2- Scan completed, findings at or above fail threshold detected
| Level | Description | Typical Issues |
|---|---|---|
| CRITICAL | Immediate security risk | Exposed secrets, publicly accessible resources |
| HIGH | Serious security concern | Missing encryption, overly permissive access |
| MEDIUM | Security best practice violation | Disabled logging, weak configurations |
| LOW | Minor security improvement | Outdated patterns, optimization opportunities |
| INFO | Informational | Code style, documentation |
CRITICAL:
- Hardcoded secrets (API keys, passwords)
- Security groups open to 0.0.0.0/0
- Public S3 buckets
HIGH:
- Unencrypted storage (S3, EBS, RDS)
- Missing IMDSv2 on EC2 instances
- Disabled CloudTrail logging
- IAM policies with wildcards
MEDIUM:
- Missing tags
- Disabled versioning
- Insecure protocols (HTTP, TLS 1.0)
┌─────────────────────────────────────────────────────────────┐
│ SDLC Code Scanner │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌─────────────────────────┐ │
│ │ CLI │─────→│ Repository Detector │ │
│ └──────────────┘ └─────────────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Scanner Orchestrator │ │
│ ├──────────────────────────────────────────────┤ │
│ │ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ Terraform │ │ CloudFormation│ │ │
│ │ │ Scanner │ │ Scanner │ │ │
│ │ └──────────────┘ └──────────────┘ │ │
│ │ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ Python │ │ Secrets │ │ │
│ │ │ Scanner │ │ Scanner │ │ │
│ │ └──────────────┘ └──────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Report Aggregator │ │
│ │ • Deduplication │ │
│ │ • Normalization │ │
│ │ • Severity Analysis │ │
│ └──────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────┬─────────────┬──────────────┐ │
│ │ JSON │ HTML │ Markdown │ │
│ │ Formatter │ Formatter │ Formatter │ │
│ └────────────┴─────────────┴──────────────┘ │
│ │
└──────────────────────────────────────────────────────────────┘
sdlc-code-scanner/
├── .github/
│ └── workflows/
│ ├── ci.yml # CI workflow for this repo
│ └── example-usage.yml # Example workflow for users
├── config/
│ └── config.yaml # Main configuration file
├── src/
│ ├── scanner_base.py # Base scanner class
│ ├── config_loader.py # Configuration management
│ ├── repo_detector.py # Repository type detection
│ ├── report_aggregator.py # Finding aggregation
│ ├── main.py # CLI entry point
│ ├── scanners/
│ │ ├── terraform_scanner.py
│ │ ├── cloudformation_scanner.py
│ │ ├── python_scanner.py
│ │ └── secrets_scanner.py
│ └── formatters/
│ ├── json_formatter.py
│ ├── html_formatter.py
│ ├── markdown_formatter.py
│ └── sarif_formatter.py # GitHub Code Scanning format
├── scripts/
│ └── run-local-scan.sh # Helper script for local scans
├── tests/
│ └── fixtures/ # Test data
├── action.yml # GitHub Action definition
├── entrypoint.sh # GitHub Action entrypoint
├── Dockerfile # Multi-stage Docker build
├── requirements.txt # Python dependencies
└── README.md # This file
"No findings detected" but I know there are issues:
- Check if the scanner is enabled in config.yaml
- Verify the repository path is correct
- Ensure files have proper extensions (.tf, .yaml, etc.)
"Permission denied" errors:
- Ensure Docker has access to mounted volumes
- Check file permissions on repository and output directories
Scanners timing out:
- Increase
timeout_per_scannerin config.yaml - Run scanners individually to identify slow tools
- Consider disabling optional scanners
High memory usage:
- Reduce
max_workersin config.yaml - Disable
parallelexecution - Scan smaller directory subsets
- Create scanner class in
src/scanners/:
from src.scanner_base import ScannerBase, Finding, Severity
class MyScanner(ScannerBase):
def is_applicable(self, path: str) -> bool:
# Return True if scanner should run
pass
def run(self, path: str) -> List[Finding]:
# Execute scanner and return findings
pass
def parse_output(self, output: str, stderr: str, return_code: int) -> List[Finding]:
# Parse scanner output
pass- Add tool installation to Dockerfile
- Update
src/main.pyto include new scanner - Add configuration options to
config/config.yaml - Update tests
# Unit tests
pytest tests/
# Integration tests
pytest tests/integration/
# With coverage
pytest --cov=src --cov-report=html- Terraform scanning (fmt, validate, TFLint, tfsec, Checkov, Trivy)
- CloudFormation scanning (cfn-lint, cfn-nag, Checkov)
- Python scanning (Bandit, Safety, Pylint)
- npm/Node.js scanning (npm audit, Snyk)
- Secrets detection (Gitleaks)
- Multi-format reporting (JSON, HTML, Markdown, SARIF)
- Rule exclusions
- Path exclusions
- GitHub Action
- SARIF output format (GitHub Code Scanning)
- CDK scanning
- Config validation command
- Custom policy definitions
- Baseline/suppression files
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the terms specified in LICENSE.
- Issues: Report bugs or request features via GitHub Issues
- Documentation: See docs/ for detailed guides
- CLAUDE.md: For development with Claude Code
This tool integrates and orchestrates the following open-source security tools:
Terraform: Terraform, TFLint, tfsec, Trivy, Checkov
CloudFormation: cfn-lint, cfn-nag, Checkov
Python: Bandit, Safety, Pylint
Secrets: Gitleaks