implementing-secrets-scanning-in-ci-cd
Has your agent integrate secret detection tools into CI/CD pipelines to find leaks before deployment.
What it does
This tool helps find secrets (like passwords or API keys) that were accidentally put into your project's code. It checks your code before it goes to production to prevent security leaks.
When to use it
- ✓When setting up your project's security.
- ✓Before releasing a new version of your software.
- ✓When you need to ensure sensitive information hasn't leaked.
Example of what to ask your AI
“Scan my code for leaked secrets before publishing.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool uses other programs (Gitleaks and TruffleHog) to look for secret patterns in your code. If it finds anything suspicious, it alerts you and can even stop the code from being published.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill implementing-secrets-scanning-in-ci-cdOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/implementing-secrets-scanning-in-ci-cd/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from 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
Install scanning tools: Install gitleaks via package manager or binary download. Install trufflehog via
brew install trufflehogor download from GitHub releases.Configure gitleaks: Create a
.gitleaks.tomlconfiguration file in the repository root to define custom rules, allowlists, and path exclusions. Use--configflag to point to custom configs.Run gitleaks directory scan: Execute
gitleaks dir --source . --report-format json --report-path gitleaks-report.jsonto scan the working directory and generate a JSON report.Run trufflehog filesystem scan: Execute
trufflehog filesystem /path/to/repo --json > trufflehog-report.jsonto scan files and output JSON findings to a report file.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.
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-codeflag in gitleaks to control pipeline behavior.Configure pre-commit hooks: Set up gitleaks as a pre-commit hook using
gitleaks protect --stagedto catch secrets before they are committed.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": [...]
}
FAQ
What are 'secrets'?
Secrets are sensitive information like passwords, API keys, access tokens, and other credentials that should not be publicly exposed in the code.
What is CI/CD?
CI/CD is a process that automates the building, testing, and delivery of software. This tool fits into that process to add a security layer.
What happens if the tool finds a secret?
It can prevent the code from being published and generate a detailed report about what was found, allowing you to fix the issue.
Details
Original description by the author
Integrate gitleaks and trufflehog into CI/CD pipelines to detect leaked secrets before deployment
Popularity
- GitHub stars
- 35k
- Ranking position
- #5952
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
bun-runtime
Has your agent use Bun to run, organize, and test code. It helps choose Bun over other tools and migrate existing projects.
affaan-m/ECC
database-migrations
Helps your agent make safe changes to databases. It ensures changes can be undone and minimizes downtime.
affaan-m/ECC
deployment-patterns
Sets up deployment and CI/CD workflows, containerization, and rollback strategies to ensure safe releases.
affaan-m/ECC