Logo: Secrets Detection Patterns

Secrets Detection Patterns

Organisatioun
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.

Add to TypingMind

Iwwersiicht

EditeurRedHatProductSecurity
Repositoryprodsec-skills
Skill-Nummsecrets-detection-patterns
Stären
56
Forks
9
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    RedHatProductSecurity huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Secrets Detection Patterns an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/secrets-detection-patterns
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Secrets Detection Patterns an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Secrets Detection Patterns automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Secrets Detection Patterns net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Secrets Detection Patterns op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Secrets Detection Patterns besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Secrets Detection Patterns an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/secrets-detection-patterns an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Secrets Detection Patterns benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Secrets Detection Patterns benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Secrets Detection Patterns domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Secrets Detection Patterns gratis?

Jo. RedHatProductSecurity huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇