devsecops-git-guardian
v1.4.0
Published
π‘οΈ Block secrets, misconfigurations, and vulnerabilities before they reach your repository. Real-time security scanning with inline diagnostics.
Maintainers
Readme
π‘οΈ DevSecOps Git Guardian
Autonomous Security Enforcement for Git Workflows & CI/CD Pipelines
Block insecure code before it reaches your repository. A comprehensive security scanning tool that prevents secrets, misconfigurations, and vulnerabilities from entering your codebase. Available as a VS Code Extension, npm Package, and Docker Image for seamless integration into any development workflow.
β¨ Features
π Multi-Scanner Security Engine
- Secret Scanner: Detects 50+ patterns (AWS keys, API tokens, database credentials, SSH keys)
- Docker Scanner: Finds security issues in Dockerfiles (root user, exposed ports, hardcoded secrets)
- Config Scanner: Scans YAML/JSON for misconfigurations (debug mode, insecure settings)
π‘οΈ Autonomous Enforcement
- Git Hook Integration: Blocks
git pushwhen violations found - CI/CD Pipeline Integration: Fails builds on security issues
- Policy Engine: Configurable severity thresholds (CRITICAL, HIGH, MEDIUM, LOW)
π Comprehensive Reporting
- HTML Reports with visual dashboard
- JSON/CSV exports for automation
- Real-time VS Code webview
- CI/CD artifact generation
π§ Auto-Remediation
- Automatically secures
.gitignorefiles - Prevents accidental secret commits
- Suggests fixes for violations
π Installation
Choose what you need:
Method 1: npm Package - CLI + Git Hooks
# Install globally
npm install -g devsecops-git-guardian
# Or use without installation
npx devsecops-git-guardianWhat you get:
- β CLI scanner with full reports
- β Git hooks (blocks insecure commits/pushes)
- β CI/CD integration
- β Works in any terminal/editor
Auto-setup:
- Git hooks install automatically if
.gitfolder exists - No VS Code required!
Method 2: VS Code Extension - Inline Diagnostics
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for "DevSecOps Git Guardian"
- Click Install
Or install from VS Code Marketplace
What you get:
- β Real-time inline warnings (red squiggly lines)
- β Hover to see security details
- β Auto-scan as you type
- β Quick fix suggestions
Note: Extension works standalone OR with npm package for git hooks
Method 3: Docker Container - Universal CI/CD
docker pull vijaydevsecops/git-guardian:latest
docker run -v $(pwd):/workspace vijaydevsecops/git-guardian:latestWhat you get:
- β Platform-independent scanning
- β Perfect for Jenkins, GitLab CI, Azure Pipelines
- β No Node.js required
π‘ Which Method Should I Use?
| Use Case | Recommended Method | |----------|-------------------| | Node.js developer | npm package (CLI + hooks) | | VS Code user | Extension only (or both!) | | Want git protection | npm package (for hooks) | | Want inline warnings | VS Code extension | | CI/CD pipeline | npm package OR Docker | | Full experience | npm package + VS Code extension |
π― Smart Auto-Setup (npm package only):
- Automatically installs git hooks if
.gitexists - Shows VS Code extension instructions if VS Code detected (optional)
- No forced installations - you choose what you want!
π― Quick Start
CLI Usage
# Scan current directory
devsecops-scan
# Only critical issues
# Scan specific path
devsecops-scan /path/to/your/project
# Only show critical issues
devsecops-scan --severity CRITICAL
# Generate HTML report
devsecops-scan --format html --output security-report.html
# Auto-fix .gitignore security issues
devsecops-scan --fixVS Code Extension
- Open your project in VS Code
- The extension automatically scans files as you edit
- View security issues inline with red squiggly lines
- Open Command Palette (
Ctrl+Shift+P) βDevSecOps: Scan Repository - Ignore specific issues with
// @devsecops-ignoreor@devsecops-ignore-file
Docker Usage
# Basic scan
docker run -v $(pwd):/workspace vijaydevsecops/git-guardian:latest
# With custom options
docker run -v $(pwd):/workspace vijaydevsecops/git-guardian:latest \
--severity MEDIUM --format json --output /workspace/report.jsonπ CI/CD Integration
GitHub Actions
name: Security Scan
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Security Scan
run: npx devsecops-scan --severity MEDIUMGitLab CI
security-scan:
image: vijaydevsecops/git-guardian:latest
script:
- scan $CI_PROJECT_DIR --severity MEDIUMJenkins
pipeline {
agent {
docker { image 'vijaydevsecops/git-guardian:latest' }
}
stages {
stage('Security') {
steps {
sh 'scan . --severity MEDIUM'
}
}
}
}π What It Detects
π Secrets & Credentials (50+ patterns)
- AWS Access Keys & Secret Keys
- GitHub/GitLab Personal Access Tokens
- API Keys (Stripe, Google Cloud, Twilio, SendGrid, etc.)
- Database Connection Strings
- SSH Private Keys & PEM files
- JWT Tokens & OAuth credentials
- Hardcoded passwords
π³ Docker Security Issues
- Running as root user
- Missing USER directive
- Exposed sensitive ports (SSH, MySQL, PostgreSQL, MongoDB, Redis)
- Using
latesttag instead of pinned versions - Missing HEALTHCHECK
- Hardcoded secrets in RUN commands
βοΈ Configuration Misconfigurations
- Hardcoded passwords in YAML/JSON
- Debug mode enabled in production
- SSL/HTTPS disabled
- Insecure default values
- API keys in config files
βοΈ Configuration
CLI Options
OPTIONS:
-p, --path <path> Path to scan (default: current directory)
-s, --severity <level> Minimum severity (LOW|MEDIUM|HIGH|CRITICAL)
-f, --format <format> Output format (text|json|html|csv)
-o, --output <file> Save report to file
--no-block Don't exit with error code on violations
-v, --verbose Verbose output
--fix Auto-fix .gitignore security issues
-h, --help Show help
--version Show versionVS Code Settings
{
"devsecops.autoInstallHooks": true,
"devsecops.blockOnViolation": true,
"devsecops.severityThreshold": "medium",
"devsecops.scanExclusions": [
"node_modules/**",
"dist/**",
"build/**"
]
}π Exit Codes
0- No security violations found β1- Security violations found (blocks CI/CD) β2- Scan error occurred β οΈ
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββ
β Security Scanner β
β (Orchestrator) β
ββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββΌβββββββββ
β β β
βΌ βΌ βΌ
ββββββββββ ββββββββββ ββββββββββ
βSecret β βDocker β βConfig β
βScanner β βScanner β βScanner β
ββββββ¬ββββ βββββ¬βββββ βββββ¬βββββ
β β β
βββββββββββΌβββββββββββ
βΌ
ββββββββββββββββββ
β Policy Engine β
β (BLOCK/ALLOW) β
ββββββββββ¬ββββββββ
βΌ
ββββββββββββββββββ
β Report β
β Generator β
ββββββββββββββββββπ Documentation
For detailed information, see:
- Installation Guide - Complete installation instructions
- CI/CD Integration - GitHub Actions, GitLab CI, Jenkins examples
- Configuration Options - Full CLI and VS Code settings reference
- Security Patterns - Complete list of 50+ detection patterns
π οΈ Development
# Clone repository
git clone https://github.com/vijay-devsecops/git-guardian.git
cd git-guardian
# Install dependencies
npm install
# Build VS Code extension
npm run package
# Build CLI for npm
npm run build:cli
# Build everything
npm run build:all
# Test locally
npm testπ€ Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code:
- Follows the existing code style
- Includes appropriate tests
- Updates documentation as needed
π License
MIT License - Free to use for personal and commercial projects.
π Support & Community
- Issues: GitHub Issues - Report bugs or request features
- Discussions: GitHub Discussions - Ask questions and share ideas
- Email: [email protected]
- npm: npm package
β Show Your Support
If DevSecOps Git Guardian helped secure your codebase, please consider:
- β Starring the repository on GitHub
- π¦ Sharing it with your team
- π Reporting bugs to help improve the tool
- π‘ Suggesting new features
π Security
This tool is designed to find security vulnerabilities, but no tool is perfect. If you discover a security issue in DevSecOps Git Guardian itself, please email [email protected] directly rather than opening a public issue.
Built with dedication for the DevSecOps community π‘οΈ
