Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)35k · #8115

implementing-secrets-scanning-in-ci-cd

Fungsinya

Alat ini membantu menemukan secrets (seperti kata sandi atau API key) yang tanpa sengaja dimasukkan ke dalam kode proyek Anda. Alat ini memeriksa kode sebelum dikirim ke produksi untuk mencegah kebocoran keamanan.

Kapan dipakai

  • ✓Saat menyiapkan keamanan proyek Anda.
  • ✓Sebelum merilis versi baru perangkat lunak Anda.
  • ✓Saat Anda perlu memastikan informasi sensitif tidak bocor.

Link skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-secrets-scanning-in-ci-cd/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-secrets-scanning-in-ci-cd/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Pindai kode saya untuk mencari secrets yang bocor sebelum dipublikasikan.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Alat ini menggunakan program lain (Gitleaks dan TruffleHog) untuk mencari pola secrets di dalam kode Anda. Jika menemukan sesuatu yang mencurigakan, alat ini akan memberi tahu Anda dan bahkan dapat menghentikan kode agar tidak dipublikasikan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Implementing Secrets Scanning in CI/CD

Overview

This skill covers implementing automated secrets scanning in CI/CD pipelines using gitleaks and trufflehog. It enables security teams to detect API keys, tokens, passwords, and other credentials that have been accidentally committed to source code repositories, providing a CI gate that blocks deployments containing high-severity findings.

Gitleaks scans git repositories and directories for hardcoded secrets using regex patterns and entropy analysis. TruffleHog performs filesystem and git history scans with optional secret verification against live services. Together they provide comprehensive coverage for secrets detection.

When to Use

  • When deploying or configuring implementing secrets scanning in ci cd capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Python 3.9 or later
  • gitleaks v8.x installed and available on PATH
  • trufflehog v3.x installed and available on PATH
  • A git repository or directory to scan
  • Access to CI/CD platform (GitHub Actions, GitLab CI, Jenkins)

Steps

  1. Install scanning tools: Install gitleaks via package manager or binary download. Install trufflehog via brew install trufflehog or download from GitHub releases.

  2. Configure gitleaks: Create a .gitleaks.toml configuration file in the repository root to define custom rules, allowlists, and path exclusions. Use --config flag to point to custom configs.

  3. Run gitleaks directory scan: Execute gitleaks dir --source . --report-format json --report-path gitleaks-report.json to scan the working directory and generate a JSON report.

  4. Run trufflehog filesystem scan: Execute trufflehog filesystem /path/to/repo --json > trufflehog-report.json to scan files and output JSON findings to a report file.

  5. Parse and filter findings: Use the agent script to parse both JSON reports, filter findings by severity (critical, high, medium, low), and determine whether the CI pipeline should pass or fail.

  6. Integrate into CI pipeline: Add the scanning step to your GitHub Actions workflow, GitLab CI config, or Jenkins pipeline as a pre-deployment gate. Use --exit-code flag in gitleaks to control pipeline behavior.

  7. Configure pre-commit hooks: Set up gitleaks as a pre-commit hook using gitleaks protect --staged to catch secrets before they are committed.

  8. Review and triage findings: Examine the JSON output for false positives, add legitimate entries to .gitleaksignore, and rotate any confirmed leaked credentials immediately.

Expected Output

The agent script produces a JSON report containing:

  • Total findings count from each scanner
  • Findings grouped by severity level
  • Individual finding details including file path, line number, rule ID, and redacted secret
  • A CI gate verdict (pass/fail) based on the configured severity threshold
  • Execution metadata including scan duration and tool versions
{
  "scan_summary": {
    "tool": "both",
    "total_findings": 3,
    "critical": 1,
    "high": 1,
    "medium": 1,
    "low": 0,
    "ci_gate": "FAIL",
    "fail_reason": "Found 1 critical and 1 high severity findings"
  },
  "findings": [...]
}
Pertanyaan umum

Apa itu 'secrets'?

Secrets adalah informasi sensitif seperti kata sandi, API key, access token, dan kredensial lainnya yang tidak boleh terekspos secara publik di dalam kode.

Apa itu CI/CD?

CI/CD adalah proses yang mengotomatiskan pembuatan, pengujian, dan pengiriman perangkat lunak. Alat ini masuk ke dalam proses tersebut untuk menambahkan lapisan keamanan.

Apa yang terjadi jika alat ini menemukan secret?

Alat ini dapat mencegah kode dipublikasikan dan membuat laporan rinci tentang apa yang ditemukan, sehingga Anda bisa memperbaiki masalahnya.

Detail

Deskripsi asli dari pembuat

Integrate gitleaks and trufflehog into CI/CD pipelines to detect leaked secrets before deployment

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularitas

Bintang GitHub
35k
Peringkat
#8115
Lisensi
Apache-2.0
Diperbarui
31/8/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa