Secrets Detection Patternsのロゴ

Secrets Detection Patterns

組織
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

概要

公開者RedHatProductSecurity
リポジトリprodsec-skills
スキル名secrets-detection-patterns
スター
56
フォーク
9
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    RedHatProductSecurityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Secrets Detection Patterns」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/secrets-detection-patterns
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSecrets Detection Patternsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSecrets Detection Patternsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Secrets Detection Patternsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

よくある質問

AIスキル「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.

TypingMindでSecrets Detection Patternsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Secrets Detection Patternsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSecrets Detection Patternsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/secrets-detection-patternsを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Secrets Detection Patternsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Secrets Detection Patternsで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSecrets Detection Patternsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Secrets Detection Patterns」は無料ですか?

はい。RedHatProductSecurityがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇