secrets-scan

Detect hardcoded credentials and secrets in source code and commit histories.

5|1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/cmaenner/agent-security-playbook --skill secrets-scan-cmaenner
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secrets-scan
Source: https://github.com/cmaenner/agent-security-playbook/tree/main/skills/secrets-scan
Command: npx skills add https://github.com/cmaenner/agent-security-playbook --skill secrets-scan-cmaenner

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill prevents sensitive information like API keys, passwords, and tokens from being exposed in code repositories, mitigating the risk of unauthorized access and data breaches.

Core Features & Use Cases

  • Automated Scanning: Utilizes tools like TruffleHog and Gitleaks to scan code and commit history for secrets.
  • Manual Pattern Detection: Provides a list of common secret patterns for manual verification.
  • Contextual Analysis: Guides users to assess the impact and validity of detected secrets.
  • Preventive Controls: Checks for and recommends preventative measures like .gitignore and pre-commit hooks.
  • Use Case: Before merging a pull request, run this skill to ensure no hardcoded AWS keys or database credentials are accidentally included in the codebase.

Quick Start

Scan the current directory for hardcoded secrets using trufflehog.

Frequently Asked Questions about secrets-scan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan source code for hardcoded API keys and secrets?

To scan source code for hardcoded API keys and secrets, use automated tools like TruffleHog and Gitleaks to analyze your codebase and commit history for potential credential exposure. It also performs manual pattern analysis to identify risks.

What's the best way to prevent sensitive credentials from leaking in a git repository?

Preventing sensitive credentials from leaking in a git repository involves scanning codebases and commit histories for exposed secrets, followed by implementing preventive controls like pre-commit hooks, CI pipeline scanning, and proper .gitignore configurations.

Does TruffleHog detect secrets in previous commit histories?

Yes, TruffleHog can detect secrets in previous commit histories. It scans both current source code and historical commit logs to uncover hardcoded credentials, API keys, and tokens that may have been accidentally committed.

How do I verify if a detected secret in my configuration files is a valid credential?

To verify if a detected secret in configuration files is a valid credential, perform contextual analysis on the findings. This assesses the actual impact and validity of the detected secrets within your specific source code environment.

Can I check for pre-commit hooks and CI pipeline scanning before merging a pull request?

Yes, you can check for pre-commit hooks and CI pipeline scanning before merging a pull request. This verifies that preventive controls are active and ensures no hardcoded AWS keys or database credentials are accidentally included.

Why should I use automated code scanning instead of manually looking for exposed tokens?

Automated code scanning is preferred because tools like TruffleHog and Gitleaks thoroughly analyze large codebases and full commit histories, whereas manual pattern detection alone is prone to human error and may miss hidden credential exposure.