[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EVE3BHV6VGWE2HGCTC3KEV":3,"skill-same:01M6EVE3BHV6VGWE2HGCTC3KEV":129},{"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":26,"publishedAt":47,"linkOnly":48,"markdownContent":49,"markdownBody":50,"frontMatter":51,"refName":72,"commitSha":73,"skillDirectory":74,"forksCount":14,"repositoryHtmlUrl":75,"repositoryHomepageUrl":76,"ownerHtmlUrl":77,"ownerBlogUrl":6,"ownerDescription":78,"updatedAt":79,"install":80,"resources":93},"01M6EVE3BHV6VGWE2HGCTC3KEV","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 management for existing repositories, and remediation workflows for exposed credentials.","henriquescastilho\u002Fmy-claude","henriquescastilho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F153296945?v=4","01M6ESH7EXPXTH9CVQ4K16SRG8","Henrique Scheer","01M6ESH7JHEK2PTNNH4HEH787Z",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"with","secret scanning","scanning","gitleaks","implementing secret scanning with gitleaks","detecting","cybersecurity","CI\u002FCD","organization","hooks","secrets","credentials","t1195","remediation","pipeline","ci","git","secure","commit","workflows","2026-11-10 10:12:30",false,"---\nname: implementing-secret-scanning-with-gitleaks\ndescription: 'This skill covers implementing Gitleaks for detecting and preventing\n  hardcoded secrets in git repositories. It addresses configuring pre-commit hooks,\n  CI\u002FCD pipeline integration, custom rule authoring for organization-specific secrets,\n  baseline management for existing repositories, and remediation workflows for exposed\n  credentials.\n\n  '\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\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## 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":52,"author":58,"domain":33,"license":15,"version":59,"nist_csf":60,"subdomain":53,"description":65,"mitre_attack":66},[53,54,55,30,56,57],"devsecops","cicd","secret-scanning","pre-commit","secure-sdlc","mahipal","1.0.0",[61,62,63,64],"PR.PS-01","GV.SC-07","ID.IM-04","PR.PS-04","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 management for existing repositories, and remediation workflows for exposed credentials.\n",[67,68,69,70,71],"T1195","T1554","T1059.004","T1003","T1110","main","7925716f065257435fdb12e97f7e52842147d5ad",".claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude","https:\u002F\u002Fclaude.com\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho","Software · Applied AI · Quantitative Modeling · Building with Claude.","2026-06-10 12:24:46",{"source":8,"skillName":5,"commands":81,"prompt":91,"zipAvailable":92},[82,85,88],{"tool":83,"command":84},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill implementing-secret-scanning-with-gitleaks",{"tool":86,"command":87},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill implementing-secret-scanning-with-gitleaks",{"tool":89,"command":90},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill implementing-secret-scanning-with-gitleaks","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002FSKILL.md",true,[94,100,105,111,115,119,125],{"path":95,"resourceType":96,"resourceTypeDesc":97,"sizeBytes":98,"sourceHtmlUrl":99},"assets\u002Ftemplate.md","ASSET","资产文件",4781,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002Fassets\u002Ftemplate.md",{"path":101,"resourceType":101,"resourceTypeDesc":102,"sizeBytes":103,"sourceHtmlUrl":104},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002FLICENSE",{"path":106,"resourceType":107,"resourceTypeDesc":108,"sizeBytes":109,"sourceHtmlUrl":110},"references\u002Fapi-reference.md","REFERENCE","参考文档",4621,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002Freferences\u002Fapi-reference.md",{"path":112,"resourceType":107,"resourceTypeDesc":108,"sizeBytes":113,"sourceHtmlUrl":114},"references\u002Fstandards.md",2298,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002Freferences\u002Fstandards.md",{"path":116,"resourceType":107,"resourceTypeDesc":108,"sizeBytes":117,"sourceHtmlUrl":118},"references\u002Fworkflows.md",5114,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002Freferences\u002Fworkflows.md",{"path":120,"resourceType":121,"resourceTypeDesc":122,"sizeBytes":123,"sourceHtmlUrl":124},"scripts\u002Fagent.py","SCRIPT","脚本",7420,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002Fscripts\u002Fagent.py",{"path":126,"resourceType":121,"resourceTypeDesc":122,"sizeBytes":127,"sourceHtmlUrl":128},"scripts\u002Fprocess.py",9999,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-secret-scanning-with-gitleaks\u002Fscripts\u002Fprocess.py",[130,170,179,188,210,236],{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":134,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":151,"publishedAt":47},"01M6F0B6XPQ65AX2X0DWK8KT3E","markitdown","Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.","MIT","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[137,140,143,146],{"categoryNo":138,"categoryName":139,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":141,"categoryName":142,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":144,"categoryName":145,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":147,"categoryName":148,"taxonomyType":149,"taxonomyTypeDesc":150},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[132,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,27],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube",{"skillNo":171,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":134,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":178,"publishedAt":47},"01M6F06SBHR9F0SDWE282Y8075","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fscientific_writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[174,175,176,177],{"categoryNo":138,"categoryName":139,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":141,"categoryName":142,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":144,"categoryName":145,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":147,"categoryName":148,"taxonomyType":149,"taxonomyTypeDesc":150},[132,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,27],{"skillNo":180,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":134,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":187,"publishedAt":47},"01M6F02D4R14EJAPBWVDF9J9VQ","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[183,184,185,186],{"categoryNo":138,"categoryName":139,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":141,"categoryName":142,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":144,"categoryName":145,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":147,"categoryName":148,"taxonomyType":149,"taxonomyTypeDesc":150},[132,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,27],{"skillNo":189,"name":190,"nameZh":6,"description":191,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":134,"licenseFileUrl":6,"sourceHtmlUrl":192,"categories":193,"keywords":194,"publishedAt":47},"01M6F000KS6YB4MKS774G4R8ND","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fzarr-python\u002FSKILL.md",[],[195,196,197,198,199,200,201,202,203,204,205,206,207,208,209],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"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":134,"licenseFileUrl":6,"sourceHtmlUrl":214,"categories":215,"keywords":217,"publishedAt":47},"01M6EZZJWFXM1GR78KTW6J0DN8","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fwhat-if-oracle\u002FSKILL.md",[216],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[218,219,220,221,222,223,224,225,226,227,228,163,164,229,230,231,232,233,234,235],"oracle","what if oracle","go","run","ux","futures","analysis","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":237,"name":238,"nameZh":6,"description":239,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":134,"licenseFileUrl":6,"sourceHtmlUrl":240,"categories":241,"keywords":252,"publishedAt":47},"01M6EZZCXAEB49RXGQCJX5E8GB","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fvenue-templates\u002FSKILL.md",[242,245,248,249],{"categoryNo":243,"categoryName":244,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":246,"categoryName":247,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":250,"categoryName":251,"taxonomyType":149,"taxonomyTypeDesc":150},"01JBSEEDCAT000000000000036","内容创作者",[253,254,255,256,257,258,259,260,160,261,163,164,165,262,263,264,265,266,209,267],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]