implementing-secret-scanning-with-gitleaks

Featured

This skill covers implementing Gitleaks for detecting and preventing hardcoded secrets in git repositories. It addresses configuring pre-commit hooks, CI/CD pipeline integration, custom rule authoring for organization-specific secrets, baseline management for existing repositories, and remediation workflows for exposed credentials.

AI & Automation 36,355 stars 4443 forks Updated 2 months ago Apache-2.0

Install

View on GitHub

Quality Score: 94/100

Stars 20%
100
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Implementing Secret Scanning with Gitleaks ## When to Use - When developers may accidentally commit API keys, passwords, tokens, or private keys to repositories - When establishing pre-commit gates that prevent secrets from entering the git history - When scanning existing repository history for previously committed secrets that need rotation - When compliance requirements mandate secret detection across all source code repositories - When migrating from manual secret audits to automated continuous scanning **Do not use** for detecting secrets in running applications or memory (use runtime secret detection), for managing secrets after detection (use Vault or AWS Secrets Manager), or for scanning container images (use Trivy or Grype). ## Prerequisites - Gitleaks v8.18+ installed via binary, Go install, or Docker - Pre-commit framework installed for local hook integration - Git repository with history to scan - CI/CD platform access (GitHub Actions, GitLab CI, or equivalent) ## Workflow ### Step 1: Install and Run Initial Repository Scan Perform a baseline scan of the repository to identify all existing secrets in the git history. ```bash # Install Gitleaks brew install gitleaks # macOS # or download binary from https://github.com/gitleaks/gitleaks/releases # Scan entire git history for secrets gitleaks detect --source . --report-format json --report-path gitleaks-report.json -v # Scan only staged changes (for pre-commit) gitleaks protect --staged --report-format ...

Details

Author
mukul975
Repository
mukul975/Anthropic-Cybersecurity-Skills
Created
8 months ago
Last Updated
2 months ago
Language
Python
License
Apache-2.0

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category