Secrets Detection Patterns logo

Secrets Detection Patterns

Organization
RedHatProductSecurity
secrets-detection-patterns

Detect hardcoded secrets in source code using pattern-based scanning for API keys, tokens, passwords, private keys, and connection strings. Use before committing, during code review, or for post-incident history scanning. Self-contained — no external tools required.

Overview

PublisherRedHatProductSecurity
Repositoryprodsec-skills
Skill namesecrets-detection-patterns
Stars
56
Forks
9
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by RedHatProductSecurity on GitHub. Read the source before you install it.

Installation

Install the Secrets Detection Patterns AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/secrets-detection-patterns
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RedHatProductSecurity/prodsec-skills.git /tmp/prodsec-skills
mkdir -p .claude/skills
cp -r /tmp/prodsec-skills/ge-core/secrets-detection-patterns .claude/skills/secrets-detection-patterns
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Secrets Detection Patterns in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Secrets Detection Patterns on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Secrets Detection Patterns is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Secrets Detection Patterns

Overview

Pattern-based secrets detection for source code. This skill provides regex patterns, false positive filtering criteria, and remediation guidance for detecting hardcoded secrets. It is self-contained — no external tools (trufflehog, gitleaks) are required, though they are recommended as complementary tooling.

Zero Tolerance Policy

Any confirmed secret in code results in a BLOCKED verdict. There is no passing threshold — secrets in code are a critical finding. A secret is either present or it is not.

Redaction Rule

Reports must NEVER include actual secret values. Report secret type, file path, and line number only. Pattern matches are redacted to show type and location: e.g., "AWS Access Key at src/config.js:42".

Scan Scope Options

  • Staged — scan git staged files only (pre-commit gate)
  • All — scan entire working directory
  • History — scan git commit history (post-incident review)

Detection Patterns

Pattern 1: AWS Access Keys

Format: AKIA followed by 16 alphanumeric characters.

AKIA[0-9A-Z]{16}

Pattern 2: AWS Secret Access Keys

40-character base64-like strings after a known label.

(aws_secret_access_key|aws_secret_key)\s*[=:]\s*[A-Za-z0-9/+=]{40}

Pattern 3: GitHub Personal Access Tokens

Prefixes: ghp_, gho_, ghu_, ghs_, ghr_.

(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9_]{36}

Pattern 4: Private Key Material

RSA, EC, DSA, and OpenSSH private key headers.

-----BEGIN (RSA |EC |DSA |OPENSSH |PRIVATE )PRIVATE KEY-----

Pattern 5: Generic Passwords (Labeled)

High-confidence labeled password assignments with values >= 8 characters.

(password|passwd|pwd|secret|api_key|apikey|api_secret|client_secret|auth_token|access_token)\s*[=:]\s*['"][^'"]{8,}['"]

Pattern 6: Database Connection Strings

Connection strings with embedded credentials.

(mysql|postgresql|postgres|mongodb|redis|amqp|jdbc)://[^@\s]+:[^@\s]+@

Pattern 7: JWT Tokens

Three-part base64url segments separated by dots, starting with eyJ.

eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}

Pattern 8: Slack Tokens

Prefix: xox[bpaso]-.

xox[bpaso]-[A-Za-z0-9-]{10,}

Pattern 9: Google API Keys

Prefix: AIza.

AIza[0-9A-Za-z_-]{35}

Pattern 10: Stripe API Keys

Prefixes: sk_live_, pk_live_, rk_live_, sk_test_.

(sk_live_|pk_live_|rk_live_|sk_test_)[0-9a-zA-Z]{24,}

False Positive Filtering

Classify a match as FALSE POSITIVE if:

  • The match is in a test fixture file (path contains: test/, tests/, spec/, fixtures/, __tests__/, testdata/)
  • The match is in a documentation file (.md, .rst, .txt, .adoc) showing an example format
  • The match is in a comment explaining what a secret looks like (e.g., # example: AKIA...)
  • The match is an obvious placeholder (e.g., AKIAIOSFODNN7… — AWS's documented sample key — your-secret-here, <YOUR_API_KEY>, xxx...xxx)
  • The match is in a .env.example, .env.sample, or .env.template file
  • The match is in a README or CONTRIBUTING file describing configuration
  • The value is clearly a test/dummy value (e.g., password: 'test' in test files)
  • The match is in a mock or stub (file path contains mock, stub, fake)

Classify a match as CONFIRMED if:

  • The match appears in a source code file that would be executed
  • The match appears in a configuration file that is NOT an example/template
  • The match appears in a script file or Dockerfile
  • The value appears to be a real credential format (not a placeholder)
  • The match appears in a git diff as an added line (staged scope)

Remediation Guidance

When secrets are detected:

  1. Remove the secret and rotate the credential (strongly recommended)
  2. Add the file to .gitignore if it must not be committed
  3. Use environment variables or a secrets manager instead of hardcoded values
  4. If this is a test fixture or example, rename the file to include example or fixture and use obviously fake values

If secrets have been committed to git history, consider:

  • Rotating the credential immediately (the secret is compromised regardless of git cleanup)
  • Using git filter-branch or BFG Repo-Cleaner to remove from history
  • Scanning with trufflehog or gitleaks for comprehensive history review

Complementary Tooling

For production use, consider also deploying:

  • trufflehog — entropy-based scanning for unstructured secrets
  • gitleaks — pre-commit hook integration with configurable rules
  • A secrets manager (HashiCorp Vault, AWS Secrets Manager, etc.) to eliminate secrets from code entirely

Note: The patterns in this skill use regex-based detection only. Entropy-based detection (for unstructured high-entropy strings) requires external tooling.

Frequently asked questions

What does the Secrets Detection Patterns AI skill do?

Detect hardcoded secrets in source code using pattern-based scanning for API keys, tokens, passwords, private keys, and connection strings. Use before committing, during code review, or for post-incident history scanning. Self-contained — no external tools required.

Why use Secrets Detection Patterns on TypingMind?

Because you install it once and use it with any model. Secrets Detection Patterns is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Secrets Detection Patterns in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/secrets-detection-patterns. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Secrets Detection Patterns?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Secrets Detection Patterns?

As many as you like. As long as a model supports skills, you can use Secrets Detection Patterns with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Secrets Detection Patterns AI skill free?

Yes. It is published on GitHub by RedHatProductSecurity under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇