How shigosag/gitshield works
GitShield is a developer-facing security CLI. Its main workflow scans repository files (or staged changes), checks contents for secrets and lockfiles for vulnerable dependencies, then reports findings and applies a configurable failure threshold. It also installs Git hooks that invoke scans before commits and pushes. The graph includes README-documented secret heuristics and CI use; source for the secret implementation and workflow was not excerpted, so those internal links are unverified or omitted.
Main entry points: main.go CLI Commands · runner.go Scan Orchestrator · secret_scanner.go Secret Detection · installer.go Hook Installer
Components 17
CLI and Configuration
- CLI Commands
cmd/gitshield/main.go - Scan Configuration
internal/config/config.go
Security Scanning
- Scan Orchestrator
internal/scanner/runner.go - Secret Detection
internal/scanner/secret_scanner.go - Secret Rules
internal/scanner/secret_rules.go - Entropy Heuristics
internal/scanner/secret_scanner.go - Lockfile Parsing
internal/scanner/dependency_scanner.go - Dependency Audit
internal/scanner/dependency_scanner.go - OSV API Client
internal/scanner/osv_client.go
Git Protection
- Hook Installer
internal/githooks/installer.go - Pre-commit and Push Hooks
internal/githooks/installer.go
Findings and Output
- Scan Findings
internal/scanner/runner.go - Terminal Report
internal/output/terminal.go
Other components
- Developer
- Git Repository
- GitHub Actions
- OSV Advisory Service
Connections 20
- Developer → CLI Commands: runs commands
README.md - CLI Commands → Scan Configuration: loads settings
cmd/gitshield/main.go - CLI Commands → Scan Orchestrator: starts scan
cmd/gitshield/main.go - Scan Configuration → Scan Orchestrator: sets threshold
- Scan Orchestrator → Secret Detection: scans content
internal/scanner/runner.go - Scan Orchestrator → Lockfile Parsing: parses lockfiles
internal/scanner/runner.go - Scan Orchestrator → Dependency Audit: audits packages
internal/scanner/runner.go - Dependency Audit → OSV API Client: queries advisories
internal/scanner/dependency_scanner.go - OSV API Client → OSV Advisory Service: posts batch query
internal/scanner/osv_client.go - Secret Detection → Secret Rules: uses patterns
- Secret Detection → Entropy Heuristics: checks entropy
- Scan Orchestrator → Git Repository: reads files
internal/scanner/runner.go - Scan Orchestrator → Scan Findings: aggregates findings
internal/scanner/runner.go - CLI Commands → Terminal Report: prints results
cmd/gitshield/main.go - CLI Commands → Scan Findings: encodes JSON
cmd/gitshield/main.go - Developer → Hook Installer: installs hooks
README.md - CLI Commands → Hook Installer: runs init
cmd/gitshield/main.go - Hook Installer → Git Repository: writes hooks
internal/githooks/installer.go - Pre-commit and Push Hooks → CLI Commands: invokes staged scan
internal/githooks/installer.go - GitHub Actions → CLI Commands: runs security checks
README.md