[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HMBRD55CDDRM6TSNJ3MRZQ":3,"skill-same:01M6HMBRD55CDDRM6TSNJ3MRZQ":119},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":62,"commitSha":63,"skillDirectory":64,"forksCount":65,"repositoryHtmlUrl":66,"repositoryHomepageUrl":6,"ownerHtmlUrl":67,"ownerBlogUrl":6,"ownerDescription":68,"updatedAt":69,"install":70,"resources":83},"01M6HMBRD55CDDRM6TSNJ3MRZQ","implementing-secret-scanning-with-gitleaks",null,"This skill covers implementing Gitleaks for detecting and preventing hardcoded secrets in git repositories. It addresses configuring pre-commit hooks, CI\u002FCD pipeline integration, custom rule authoring for organization-specific secrets, baseline...","HenriqueMC17\u002Fagente-core","HenriqueMC17","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F206460478?v=4","01M6HB63HBBF18AC4H09XTB549","Henrique Monteiro Cardoso","01M6HB63NGSQXWKWCFWW2B20W0",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"implementing secret scanning with gitleaks","implementing","with","scanning","gitleaks","secret scanning","ci","pipeline","t1195","git","devsecops","secrets","secure","hooks","organization","authoring","CI\u002FCD","commit","detecting","cybersecurity","2026-11-10 10:12:30",false,"---\nname: implementing-secret-scanning-with-gitleaks\ndescription: This skill covers implementing Gitleaks for detecting and preventing hardcoded secrets in git repositories. It addresses configuring pre-commit hooks, CI\u002FCD pipeline integration, custom rule authoring for organization-specific secrets, baseline...\ndomain: cybersecurity\nsubdomain: devsecops\ntags:\n- devsecops\n- cicd\n- secret-scanning\n- gitleaks\n- pre-commit\n- secure-sdlc\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- GV.SC-07\n- ID.IM-04\n- PR.PS-04\nmitre_attack:\n- T1195\n- T1554\n- T1059.004\n- T1003\n- T1110\ncategory: implementing-secret-scanning-with-gitleaks\n---\n# Implementing-Secret-Scanning-With-Gitleaks\n\n## Overview\nThis skill covers implementing Gitleaks for detecting and preventing hardcoded secrets in git repositories. It addresses configuring pre-commit hooks, CI\u002FCD pipeline integration, custom rule authoring for organization-specific secrets, baseline management for existing repositories, and remediation workflows for exposed credentials.\n\n\n\n# Implementing Secret Scanning with Gitleaks\n\n## When to Use\n\n- When developers may accidentally commit API keys, passwords, tokens, or private keys to repositories\n- When establishing pre-commit gates that prevent secrets from entering the git history\n- When scanning existing repository history for previously committed secrets that need rotation\n- When compliance requirements mandate secret detection across all source code repositories\n- When migrating from manual secret audits to automated continuous scanning\n\n**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).\n\n## Prerequisites\n\n- Gitleaks v8.18+ installed via binary, Go install, or Docker\n- Pre-commit framework installed for local hook integration\n- Git repository with history to scan\n- CI\u002FCD platform access (GitHub Actions, GitLab CI, or equivalent)\n\n## Workflow\n\n### Step 1: Install and Run Initial Repository Scan\n\nPerform a baseline scan of the repository to identify all existing secrets in the git history.\n\n```bash\n# Install Gitleaks\nbrew install gitleaks  # macOS\n# or download binary from https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\u002Freleases\n\n# Scan entire git history for secrets\ngitleaks detect --source . --report-format json --report-path gitleaks-report.json -v\n\n# Scan only staged changes (for pre-commit)\ngitleaks protect --staged --report-format json --report-path gitleaks-staged.json\n\n# Scan specific commit range\ngitleaks detect --source . --log-opts=\"HEAD~10..HEAD\" --report-format json\n\n# Scan without git history (filesystem only)\ngitleaks detect --source . --no-git --report-format json\n```\n\n### Step 2: Configure Pre-Commit Hook\n\nSet up Gitleaks as a pre-commit hook to prevent secrets from being committed.\n\n```yaml\n# .pre-commit-config.yaml\nrepos:\n  - repo: https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\n    rev: v8.21.2\n    hooks:\n      - id: gitleaks\n        name: gitleaks\n        description: Detect hardcoded secrets using Gitleaks\n        entry: gitleaks protect --staged --verbose --redact\n        language: golang\n        pass_filenames: false\n```\n\n```bash\n# Install pre-commit framework\npip install pre-commit\n\n# Install hooks defined in .pre-commit-config.yaml\npre-commit install\n\n# Run against all files (not just staged)\npre-commit run gitleaks --all-files\n\n# Test the hook with a deliberate secret\necho 'AWS_SECRET_ACCESS_KEY=\"wJalrXUtnFEMI\u002FK7MDENG\u002FbPxRfiCYEXAMPLEKEY\"' >> test.txt\ngit add test.txt\ngit commit -m \"test\"  # Should be blocked by gitleaks\n```\n\n### Step 3: Integrate into GitHub Actions\n\n```yaml\n# .github\u002Fworkflows\u002Fsecret-scanning.yml\nname: Secret Scanning\n\non:\n  push:\n    branches: [main, develop]\n  pull_request:\n    branches: [main]\n\njobs:\n  gitleaks:\n    name: Gitleaks Secret Scan\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n        with:\n          fetch-depth: 0  # Full history for comprehensive scanning\n\n      - name: Run Gitleaks\n        uses: gitleaks\u002Fgitleaks-action@v2\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}  # Required for gitleaks-action v2\n\n      # Alternative: Run Gitleaks directly\n      - name: Install Gitleaks\n        run: |\n          wget -q https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\u002Freleases\u002Fdownload\u002Fv8.21.2\u002Fgitleaks_8.21.2_linux_x64.tar.gz\n          tar -xzf gitleaks_8.21.2_linux_x64.tar.gz\n          chmod +x gitleaks\n\n      - name: Scan for secrets\n        run: |\n          if [ \"${{ github.event_name }}\" == \"pull_request\" ]; then\n            .\u002Fgitleaks detect \\\n              --source . \\\n              --log-opts=\"${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}\" \\\n              --report-format sarif \\\n              --report-path gitleaks.sarif \\\n              --exit-code 1\n          else\n            .\u002Fgitleaks detect \\\n              --source . \\\n              --report-format sarif \\\n              --report-path gitleaks.sarif \\\n              --exit-code 1 \\\n              --baseline-path .gitleaks-baseline.json\n          fi\n\n      - name: Upload SARIF\n        if: always()\n        uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n        with:\n          sarif_file: gitleaks.sarif\n          category: gitleaks\n```\n\n### Step 4: Author Custom Detection Rules\n\nCreate organization-specific rules for internal secret patterns.\n\n```toml\n# .gitleaks.toml\ntitle = \"Organization Gitleaks Configuration\"\n\n[extend]\nuseDefault = true  # Include all default rules\n\n# Custom rule for internal API tokens\n[[rules]]\nid = \"internal-api-token\"\ndescription = \"Internal API token for service-to-service auth\"\nregex = '''(?i)x-internal-token[\"\\s:=]+[\"\\']?([a-zA-Z0-9_\\-]{40,})[\"\\']?'''\nentropy = 3.5\nkeywords = [\"x-internal-token\"]\ntags = [\"internal\", \"api\"]\n\n[[rules]]\nid = \"database-connection-string\"\ndescription = \"Database connection string with embedded credentials\"\nregex = '''(?i)(postgres|mysql|mongodb|redis):\u002F\u002F[^:]+:[^@]+@[^\u002F]+\u002F\\w+'''\nkeywords = [\"postgres:\u002F\u002F\", \"mysql:\u002F\u002F\", \"mongodb:\u002F\u002F\", \"redis:\u002F\u002F\"]\ntags = [\"database\", \"credentials\"]\n\n[[rules]]\nid = \"jwt-secret\"\ndescription = \"JWT signing secret\"\nregex = '''(?i)(jwt[_-]?secret|jwt[_-]?key)[\"\\s:=]+[\"\\']?([a-zA-Z0-9\u002F+_\\-]{32,})[\"\\']?'''\nentropy = 3.0\nkeywords = [\"jwt_secret\", \"jwt-secret\", \"jwt_key\", \"jwt-key\"]\n\n# Allowlist for test files and known safe patterns\n[allowlist]\ndescription = \"Global allowlist\"\npaths = [\n  '''(^|\u002F)test(s)?\u002F''',\n  '''(^|\u002F)spec\u002F''',\n  '''\\.test\\.(js|ts|py)$''',\n  '''\\.spec\\.(js|ts|py)$''',\n  '''__mocks__\u002F''',\n  '''fixtures\u002F''',\n  '''(^|\u002F)vendor\u002F''',\n  '''node_modules\u002F'''\n]\nregexes = [\n  '''EXAMPLE''',\n  '''example\\.com''',\n  '''test[-_]?(key|secret|token|password)''',\n  '''(?i)placeholder''',\n  '''000000+'''\n]\n```\n\n### Step 5: Manage Baselines for Existing Repositories\n\nCreate a baseline of known findings to avoid blocking development while historical secrets are being rotated.\n\n```bash\n# Generate baseline from current state\ngitleaks detect --source . --report-format json --report-path .gitleaks-baseline.json\n\n# Subsequent scans compare against baseline (only new findings trigger failures)\ngitleaks detect --source . --baseline-path .gitleaks-baseline.json --exit-code 1\n\n# Review baseline periodically and remove entries as secrets are rotated\ncat .gitleaks-baseline.json | python3 -m json.tool | head -50\n```\n\n### Step 6: Remediate Exposed Secrets\n\nWhen a secret is detected, follow the rotation and history cleanup procedure.\n\n```bash\n# 1. Immediately rotate the exposed credential\n#    - Revoke the old API key\u002Ftoken in the service provider\n#    - Generate a new credential\n#    - Store the new credential in a secrets manager\n\n# 2. Remove secret from git history using git-filter-repo\npip install git-filter-repo\n\n# Create expressions file for secrets to remove\ncat > \u002Ftmp\u002Fexpressions.txt \u003C\u003C 'EOF'\nregex:AKIA[0-9A-Z]{16}==>REDACTED_AWS_KEY\nregex:(?i)password\\s*=\\s*\"[^\"]*\"==>password=\"REDACTED\"\nEOF\n\ngit filter-repo --replace-text \u002Ftmp\u002Fexpressions.txt --force\n\n# 3. Force-push the cleaned history (coordinate with team)\n# git push --force --all  # WARNING: Requires team coordination\n\n# 4. Add the secret pattern to .gitleaks.toml rules\n# 5. Update the baseline file to remove the resolved finding\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Secret | Any credential, token, key, or sensitive string that should not appear in source code |\n| Pre-commit Hook | Git hook that runs before a commit is created, blocking commits containing detected secrets |\n| Entropy | Measure of randomness in a string; high-entropy strings are more likely to be secrets |\n| Baseline | Snapshot of existing findings used to differentiate new secrets from pre-existing ones |\n| Allowlist | Configuration specifying paths, patterns, or commits to exclude from detection |\n| SARIF | Static Analysis Results Interchange Format for uploading findings to security dashboards |\n| git-filter-repo | Tool for rewriting git history to remove sensitive data from all commits |\n\n## Tools & Systems\n\n- **Gitleaks**: Open-source secret detection tool supporting pre-commit hooks, CI\u002FCD, and historical scanning\n- **pre-commit**: Framework for managing and maintaining multi-language pre-commit hooks\n- **git-filter-repo**: History rewriting tool for removing secrets from git history\n- **TruffleHog**: Alternative secret scanner with verified secret detection capabilities\n- **GitHub Secret Scanning**: Native GitHub feature that detects secrets matching partner patterns\n\n## Common Scenarios\n\n### Scenario: Onboarding Secret Scanning on a Legacy Repository\n\n**Context**: A 5-year-old repository has never been scanned. The team needs to enable secret scanning without blocking all development while historical secrets are rotated.\n\n**Approach**:\n1. Run `gitleaks detect` against full history and generate a baseline JSON file\n2. Triage each finding: classify as active (needs rotation), inactive (already rotated), or false positive\n3. Immediately rotate all active secrets and update consuming services\n4. Commit the baseline file (excluding active secrets that have been fixed)\n5. Enable pre-commit hooks for new development immediately\n6. Add CI\u002FCD scanning with the baseline to catch only new secrets\n7. Progressively reduce the baseline as historical secrets are rotated\n\n**Pitfalls**: Generating a baseline without triaging means accepting risk on unrotated secrets. Never assume a historical secret is inactive without verifying with the service provider. Running git-filter-repo on a shared repository without coordination will cause rebase conflicts for all team members.\n\n## Output Format\n\n```\nGitleaks Secret Scanning Report\n=================================\nRepository: org\u002Fweb-application\nScan Type: Full History\nCommits Scanned: 4,523\nDate: 2026-02-23\n\nFINDINGS:\n  Total: 12\n  New (not in baseline): 3\n  Baseline (pre-existing): 9\n\nNEW FINDINGS (blocking):\n  [1] AWS Access Key ID\n      Rule: aws-access-key-id\n      File: src\u002Fconfig\u002Faws.py:23\n      Commit: a1b2c3d (2026-02-22, dev@company.com)\n      Secret: AKIA...REDACTED\n      Entropy: 3.8\n\n  [2] GitHub Personal Access Token\n      Rule: github-pat\n      File: scripts\u002Fdeploy.sh:15\n      Commit: d4e5f6g (2026-02-21, ops@company.com)\n      Secret: ghp_...REDACTED\n      Entropy: 4.2\n\n  [3] Internal API Token\n      Rule: internal-api-token\n      File: src\u002Fservices\u002Fauth.py:89\n      Commit: h7i8j9k (2026-02-20, dev@company.com)\n\nQUALITY GATE: FAILED (3 new findings)\nAction: Rotate exposed credentials immediately.\n```\n","# Implementing-Secret-Scanning-With-Gitleaks\n\n## Overview\nThis skill covers implementing Gitleaks for detecting and preventing hardcoded secrets in git repositories. It addresses configuring pre-commit hooks, CI\u002FCD pipeline integration, custom rule authoring for organization-specific secrets, baseline management for existing repositories, and remediation workflows for exposed credentials.\n\n\n\n# Implementing Secret Scanning with Gitleaks\n\n## When to Use\n\n- When developers may accidentally commit API keys, passwords, tokens, or private keys to repositories\n- When establishing pre-commit gates that prevent secrets from entering the git history\n- When scanning existing repository history for previously committed secrets that need rotation\n- When compliance requirements mandate secret detection across all source code repositories\n- When migrating from manual secret audits to automated continuous scanning\n\n**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).\n\n## Prerequisites\n\n- Gitleaks v8.18+ installed via binary, Go install, or Docker\n- Pre-commit framework installed for local hook integration\n- Git repository with history to scan\n- CI\u002FCD platform access (GitHub Actions, GitLab CI, or equivalent)\n\n## Workflow\n\n### Step 1: Install and Run Initial Repository Scan\n\nPerform a baseline scan of the repository to identify all existing secrets in the git history.\n\n```bash\n# Install Gitleaks\nbrew install gitleaks  # macOS\n# or download binary from https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\u002Freleases\n\n# Scan entire git history for secrets\ngitleaks detect --source . --report-format json --report-path gitleaks-report.json -v\n\n# Scan only staged changes (for pre-commit)\ngitleaks protect --staged --report-format json --report-path gitleaks-staged.json\n\n# Scan specific commit range\ngitleaks detect --source . --log-opts=\"HEAD~10..HEAD\" --report-format json\n\n# Scan without git history (filesystem only)\ngitleaks detect --source . --no-git --report-format json\n```\n\n### Step 2: Configure Pre-Commit Hook\n\nSet up Gitleaks as a pre-commit hook to prevent secrets from being committed.\n\n```yaml\n# .pre-commit-config.yaml\nrepos:\n  - repo: https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\n    rev: v8.21.2\n    hooks:\n      - id: gitleaks\n        name: gitleaks\n        description: Detect hardcoded secrets using Gitleaks\n        entry: gitleaks protect --staged --verbose --redact\n        language: golang\n        pass_filenames: false\n```\n\n```bash\n# Install pre-commit framework\npip install pre-commit\n\n# Install hooks defined in .pre-commit-config.yaml\npre-commit install\n\n# Run against all files (not just staged)\npre-commit run gitleaks --all-files\n\n# Test the hook with a deliberate secret\necho 'AWS_SECRET_ACCESS_KEY=\"wJalrXUtnFEMI\u002FK7MDENG\u002FbPxRfiCYEXAMPLEKEY\"' >> test.txt\ngit add test.txt\ngit commit -m \"test\"  # Should be blocked by gitleaks\n```\n\n### Step 3: Integrate into GitHub Actions\n\n```yaml\n# .github\u002Fworkflows\u002Fsecret-scanning.yml\nname: Secret Scanning\n\non:\n  push:\n    branches: [main, develop]\n  pull_request:\n    branches: [main]\n\njobs:\n  gitleaks:\n    name: Gitleaks Secret Scan\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n        with:\n          fetch-depth: 0  # Full history for comprehensive scanning\n\n      - name: Run Gitleaks\n        uses: gitleaks\u002Fgitleaks-action@v2\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}  # Required for gitleaks-action v2\n\n      # Alternative: Run Gitleaks directly\n      - name: Install Gitleaks\n        run: |\n          wget -q https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\u002Freleases\u002Fdownload\u002Fv8.21.2\u002Fgitleaks_8.21.2_linux_x64.tar.gz\n          tar -xzf gitleaks_8.21.2_linux_x64.tar.gz\n          chmod +x gitleaks\n\n      - name: Scan for secrets\n        run: |\n          if [ \"${{ github.event_name }}\" == \"pull_request\" ]; then\n            .\u002Fgitleaks detect \\\n              --source . \\\n              --log-opts=\"${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}\" \\\n              --report-format sarif \\\n              --report-path gitleaks.sarif \\\n              --exit-code 1\n          else\n            .\u002Fgitleaks detect \\\n              --source . \\\n              --report-format sarif \\\n              --report-path gitleaks.sarif \\\n              --exit-code 1 \\\n              --baseline-path .gitleaks-baseline.json\n          fi\n\n      - name: Upload SARIF\n        if: always()\n        uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n        with:\n          sarif_file: gitleaks.sarif\n          category: gitleaks\n```\n\n### Step 4: Author Custom Detection Rules\n\nCreate organization-specific rules for internal secret patterns.\n\n```toml\n# .gitleaks.toml\ntitle = \"Organization Gitleaks Configuration\"\n\n[extend]\nuseDefault = true  # Include all default rules\n\n# Custom rule for internal API tokens\n[[rules]]\nid = \"internal-api-token\"\ndescription = \"Internal API token for service-to-service auth\"\nregex = '''(?i)x-internal-token[\"\\s:=]+[\"\\']?([a-zA-Z0-9_\\-]{40,})[\"\\']?'''\nentropy = 3.5\nkeywords = [\"x-internal-token\"]\ntags = [\"internal\", \"api\"]\n\n[[rules]]\nid = \"database-connection-string\"\ndescription = \"Database connection string with embedded credentials\"\nregex = '''(?i)(postgres|mysql|mongodb|redis):\u002F\u002F[^:]+:[^@]+@[^\u002F]+\u002F\\w+'''\nkeywords = [\"postgres:\u002F\u002F\", \"mysql:\u002F\u002F\", \"mongodb:\u002F\u002F\", \"redis:\u002F\u002F\"]\ntags = [\"database\", \"credentials\"]\n\n[[rules]]\nid = \"jwt-secret\"\ndescription = \"JWT signing secret\"\nregex = '''(?i)(jwt[_-]?secret|jwt[_-]?key)[\"\\s:=]+[\"\\']?([a-zA-Z0-9\u002F+_\\-]{32,})[\"\\']?'''\nentropy = 3.0\nkeywords = [\"jwt_secret\", \"jwt-secret\", \"jwt_key\", \"jwt-key\"]\n\n# Allowlist for test files and known safe patterns\n[allowlist]\ndescription = \"Global allowlist\"\npaths = [\n  '''(^|\u002F)test(s)?\u002F''',\n  '''(^|\u002F)spec\u002F''',\n  '''\\.test\\.(js|ts|py)$''',\n  '''\\.spec\\.(js|ts|py)$''',\n  '''__mocks__\u002F''',\n  '''fixtures\u002F''',\n  '''(^|\u002F)vendor\u002F''',\n  '''node_modules\u002F'''\n]\nregexes = [\n  '''EXAMPLE''',\n  '''example\\.com''',\n  '''test[-_]?(key|secret|token|password)''',\n  '''(?i)placeholder''',\n  '''000000+'''\n]\n```\n\n### Step 5: Manage Baselines for Existing Repositories\n\nCreate a baseline of known findings to avoid blocking development while historical secrets are being rotated.\n\n```bash\n# Generate baseline from current state\ngitleaks detect --source . --report-format json --report-path .gitleaks-baseline.json\n\n# Subsequent scans compare against baseline (only new findings trigger failures)\ngitleaks detect --source . --baseline-path .gitleaks-baseline.json --exit-code 1\n\n# Review baseline periodically and remove entries as secrets are rotated\ncat .gitleaks-baseline.json | python3 -m json.tool | head -50\n```\n\n### Step 6: Remediate Exposed Secrets\n\nWhen a secret is detected, follow the rotation and history cleanup procedure.\n\n```bash\n# 1. Immediately rotate the exposed credential\n#    - Revoke the old API key\u002Ftoken in the service provider\n#    - Generate a new credential\n#    - Store the new credential in a secrets manager\n\n# 2. Remove secret from git history using git-filter-repo\npip install git-filter-repo\n\n# Create expressions file for secrets to remove\ncat > \u002Ftmp\u002Fexpressions.txt \u003C\u003C 'EOF'\nregex:AKIA[0-9A-Z]{16}==>REDACTED_AWS_KEY\nregex:(?i)password\\s*=\\s*\"[^\"]*\"==>password=\"REDACTED\"\nEOF\n\ngit filter-repo --replace-text \u002Ftmp\u002Fexpressions.txt --force\n\n# 3. Force-push the cleaned history (coordinate with team)\n# git push --force --all  # WARNING: Requires team coordination\n\n# 4. Add the secret pattern to .gitleaks.toml rules\n# 5. Update the baseline file to remove the resolved finding\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Secret | Any credential, token, key, or sensitive string that should not appear in source code |\n| Pre-commit Hook | Git hook that runs before a commit is created, blocking commits containing detected secrets |\n| Entropy | Measure of randomness in a string; high-entropy strings are more likely to be secrets |\n| Baseline | Snapshot of existing findings used to differentiate new secrets from pre-existing ones |\n| Allowlist | Configuration specifying paths, patterns, or commits to exclude from detection |\n| SARIF | Static Analysis Results Interchange Format for uploading findings to security dashboards |\n| git-filter-repo | Tool for rewriting git history to remove sensitive data from all commits |\n\n## Tools & Systems\n\n- **Gitleaks**: Open-source secret detection tool supporting pre-commit hooks, CI\u002FCD, and historical scanning\n- **pre-commit**: Framework for managing and maintaining multi-language pre-commit hooks\n- **git-filter-repo**: History rewriting tool for removing secrets from git history\n- **TruffleHog**: Alternative secret scanner with verified secret detection capabilities\n- **GitHub Secret Scanning**: Native GitHub feature that detects secrets matching partner patterns\n\n## Common Scenarios\n\n### Scenario: Onboarding Secret Scanning on a Legacy Repository\n\n**Context**: A 5-year-old repository has never been scanned. The team needs to enable secret scanning without blocking all development while historical secrets are rotated.\n\n**Approach**:\n1. Run `gitleaks detect` against full history and generate a baseline JSON file\n2. Triage each finding: classify as active (needs rotation), inactive (already rotated), or false positive\n3. Immediately rotate all active secrets and update consuming services\n4. Commit the baseline file (excluding active secrets that have been fixed)\n5. Enable pre-commit hooks for new development immediately\n6. Add CI\u002FCD scanning with the baseline to catch only new secrets\n7. Progressively reduce the baseline as historical secrets are rotated\n\n**Pitfalls**: Generating a baseline without triaging means accepting risk on unrotated secrets. Never assume a historical secret is inactive without verifying with the service provider. Running git-filter-repo on a shared repository without coordination will cause rebase conflicts for all team members.\n\n## Output Format\n\n```\nGitleaks Secret Scanning Report\n=================================\nRepository: org\u002Fweb-application\nScan Type: Full History\nCommits Scanned: 4,523\nDate: 2026-02-23\n\nFINDINGS:\n  Total: 12\n  New (not in baseline): 3\n  Baseline (pre-existing): 9\n\nNEW FINDINGS (blocking):\n  [1] AWS Access Key ID\n      Rule: aws-access-key-id\n      File: src\u002Fconfig\u002Faws.py:23\n      Commit: a1b2c3d (2026-02-22, dev@company.com)\n      Secret: AKIA...REDACTED\n      Entropy: 3.8\n\n  [2] GitHub Personal Access Token\n      Rule: github-pat\n      File: scripts\u002Fdeploy.sh:15\n      Commit: d4e5f6g (2026-02-21, ops@company.com)\n      Secret: ghp_...REDACTED\n      Entropy: 4.2\n\n  [3] Internal API Token\n      Rule: internal-api-token\n      File: src\u002Fservices\u002Fauth.py:89\n      Commit: h7i8j9k (2026-02-20, dev@company.com)\n\nQUALITY GATE: FAILED (3 new findings)\nAction: Rotate exposed credentials immediately.\n```\n",{"name":5,"tags":44,"author":49,"domain":38,"license":15,"version":50,"category":5,"nist_csf":51,"subdomain":29,"description":7,"mitre_attack":56},[29,45,46,23,47,48],"cicd","secret-scanning","pre-commit","secure-sdlc","mahipal","1.0.0",[52,53,54,55],"PR.PS-01","GV.SC-07","ID.IM-04","PR.PS-04",[57,58,59,60,61],"T1195","T1554","T1059.004","T1003","T1110","main","5eea5b3296f4673b5f481e8bcc1ba76281149f16","modules\u002Fimplementing-secret-scanning-with-gitleaks",0,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core","https:\u002F\u002Fgithub.com\u002FHenriqueMC17","Qualquer tecnologia suficientemente avançada é indistinguível da mágica.","2026-09-28 22:40:38",{"source":8,"skillName":5,"commands":71,"prompt":81,"zipAvailable":82},[72,75,78],{"tool":73,"command":74},"npx","npx skills add HenriqueMC17\u002Fagente-core --skill implementing-secret-scanning-with-gitleaks",{"tool":76,"command":77},"bunx","bunx skills add HenriqueMC17\u002Fagente-core --skill implementing-secret-scanning-with-gitleaks",{"tool":79,"command":80},"pnpm","pnpm dlx skills add HenriqueMC17\u002Fagente-core --skill implementing-secret-scanning-with-gitleaks","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002FSKILL.md",true,[84,90,95,101,105,109,115],{"path":85,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":88,"sourceHtmlUrl":89},"assets\u002Ftemplate.md","ASSET","资产文件",4781,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002Fassets\u002Ftemplate.md",{"path":91,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":93,"sourceHtmlUrl":94},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002FLICENSE",{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fapi-reference.md","REFERENCE","参考文档",4621,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002Freferences\u002Fapi-reference.md",{"path":102,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fstandards.md",2298,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002Freferences\u002Fstandards.md",{"path":106,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":107,"sourceHtmlUrl":108},"references\u002Fworkflows.md",5114,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002Freferences\u002Fworkflows.md",{"path":110,"resourceType":111,"resourceTypeDesc":112,"sizeBytes":113,"sourceHtmlUrl":114},"scripts\u002Fagent.py","SCRIPT","脚本",7420,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002Fscripts\u002Fagent.py",{"path":116,"resourceType":111,"resourceTypeDesc":112,"sizeBytes":117,"sourceHtmlUrl":118},"scripts\u002Fprocess.py",9999,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fimplementing-secret-scanning-with-gitleaks\u002Fscripts\u002Fprocess.py",[120,146,171,194,210,231],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":39},"01M6HPFF0RCN0X6WT5EBSV71GY","validating-backup-integrity-for-recovery","Validate backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to ensure backups are reliable for disaster recovery and ransomware response scenarios.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[],[127,128,129,130,131,132,38,133,134,135,136,137,138,139,140,141,142,143,144,145],"integrity","backup","recovery","validating backup integrity for recovery","for","testing","validate","verification","hash-verification","incident-response","ransomware","detection","t1078","t1490","disaster-recovery","restore","incident","disaster recovery","ransomware response",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":39},"01M6HPFAWJVFK25Q33K3T7WQ8G","triaging-vulnerabilities-with-ssvc-framework","Triage and prioritize vulnerabilities using CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree framework to produce actionable remediation priorities.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[],[153,154,155,156,21,38,157,158,159,160,161,162,163,164,165,166,167,168,169,170],"vulnerabilities","framework","ssvc","triaging vulnerabilities with ssvc framework","triage and prioritize","CISA","vulnerability-management","risk-management","cvss","remediation","vulnerability","prioritization","decision-tree","prioritize","decision","priorities","actionable","tree",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"publishedAt":39},"01M6HPF6JS9X72WP59094H3ASQ","triaging-security-incident","Performs initial triage of security incidents to determine severity, scope, and required response actions using the NIST SP 800-61r3 and SANS PICERL frameworks. Classifies incidents by type, assigns priority based on business impact, and routes...","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-incident\u002FSKILL.md",[],[178,179,143,38,180,181,182,139,140,183,184,185,186,187,188,189,190,191,192,193],"security","triaging security incident","actions","soc","NIST","analysis","severity-classification","incident-triage","SANS-PICERL","SOC-operations","picerl","conversion","isolation","scope","impact","consistency",{"skillNo":195,"name":196,"nameZh":6,"description":197,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":198,"categories":199,"keywords":200,"publishedAt":39},"01M6HPF2EX6ZYNYYHKBRJN7GEF","triaging-security-incident-with-ir-playbook","Classify and prioritize security incidents using structured IR playbooks to determine severity, assign response teams, and initiate appropriate response procedures.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-incident-with-ir-playbook\u002FSKILL.md",[],[178,201,202,179,143,21,38,203,181,136,204,205,139,140,206,184,166,207,208,209],"playbook","triaging security incident with ir playbook","teams","IR-playbook","severity","classification","classify","incidents","initiate",{"skillNo":211,"name":212,"nameZh":6,"description":213,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":214,"categories":215,"keywords":216,"publishedAt":39},"01M6HPEY9XPGE7X95AG4XJFQAW","triaging-security-alerts-in-splunk","Triages security alerts in Splunk Enterprise Security by classifying severity, investigating notable events, correlating related telemetry, and making escalation or closure decisions using SPL queries and the Incident Review dashboard. Use when...","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-alerts-in-splunk\u002FSKILL.md",[],[178,217,218,219,220,221,38,222,223,224,181,225,139,226,227,228,187,229,143,230],"security alerts","splunk","triaging security alerts in splunk","alerts","review","siem","dashboard","search","correlation-search","t1566","notable-events","incident-review","cm","de",{"skillNo":232,"name":233,"nameZh":6,"description":234,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":235,"categories":236,"keywords":237,"publishedAt":39},"01M6HPET6XGEPEJPN7V032JGZ0","tracking-threat-actor-infrastructure","Threat actor infrastructure tracking involves monitoring and mapping adversary-controlled assets including command-and-control (C2) servers, phishing domains, exploit kit hosts, bulletproof hosting, a","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftracking-threat-actor-infrastructure\u002FSKILL.md",[],[238,239,240,241,38,242,243,244,245,246,247,226,248,249,229,250,230,251,252,253],"infrastructure","tracking threat actor infrastructure","tracking","threat","monitoring","mitre-attack","threat-actor","threat-intelligence","command-and-control","dns","command","exploit","intelligence","domains","kit","hosts"]