Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)35k · #8115

implementing-secrets-scanning-in-ci-cd

Skill này làm gì

Công cụ này giúp tìm các bí mật (như mật khẩu hoặc API key) đã vô tình được đưa vào mã dự án của bạn. Nó kiểm tra mã trước khi mã được đưa lên môi trường thực tế để ngăn rò rỉ bảo mật.

Khi nào nên dùng

  • ✓Khi thiết lập bảo mật cho dự án của bạn.
  • ✓Trước khi phát hành một phiên bản phần mềm mới.
  • ✓Khi bạn cần bảo đảm thông tin nhạy cảm không bị rò rỉ.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-secrets-scanning-in-ci-cd/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy quét mã của tôi xem có bí mật bị rò rỉ trước khi công bố không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng các chương trình khác (Gitleaks và TruffleHog) để tìm mẫu bí mật trong mã của bạn. Nếu phát hiện điều đáng ngờ, nó sẽ cảnh báo bạn và thậm chí có thể dừng việc công bố mã.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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": [...]
}
Câu hỏi thường gặp

“Secrets” là gì?

Secrets là thông tin nhạy cảm như mật khẩu, API key, token truy cập và các thông tin xác thực khác không nên bị công khai trong mã.

CI/CD là gì?

CI/CD là quy trình tự động hóa việc xây dựng, kiểm thử và phân phối phần mềm. Công cụ này được đưa vào quy trình đó để thêm một lớp bảo mật.

Điều gì xảy ra nếu công cụ tìm thấy bí mật?

Nó có thể ngăn mã được công bố và tạo báo cáo chi tiết về những gì đã phát hiện, giúp bạn sửa lỗi.

Chi tiết

Mô tả gốc của tác giả

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

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#8115
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự