Detecting Secrets logo

Detecting Secrets

Organization
bitwarden
detecting-secrets

This skill should be used when the user asks to "find hardcoded secrets", "audit for credential leaks", "check for API keys in code", "review secret scanning alerts", "rotate a leaked secret", or needs to detect hardcoded credentials, review secret handling patterns, or remediate exposed secrets.

Overview

Publisherbitwarden
Repositoryai-plugins
Skill namedetecting-secrets
Stars
149
Forks
19
Bundled files
Instructions only
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 bitwarden on GitHub. Read the source before you install it.

Installation

Install the Detecting Secrets 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.
  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/bitwarden/ai-plugins.git /tmp/ai-plugins
mkdir -p .claude/skills
cp -r /tmp/ai-plugins/plugins/bitwarden-security-engineer/skills/detecting-secrets .claude/skills/detecting-secrets
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Detecting Secrets 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 Detecting Secrets 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 Detecting Secrets 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.

Secret Patterns

Look for these categories of hardcoded secrets in code:

High-Confidence Patterns

TypeExample Patterns
API KeysAKIA[0-9A-Z]{16} (AWS), AIza[0-9A-Za-z_-]{35} (Google), strings assigned to variables named *apiKey*, *api_key*
Connection StringsServer=...;Password=..., mongodb://user:pass@host, postgres://user:pass@host
Private Keys-----BEGIN RSA PRIVATE KEY-----, -----BEGIN OPENSSH PRIVATE KEY-----
Tokensghp_[A-Za-z0-9]{36} (GitHub PAT), xoxb- (Slack bot), sk- (OpenAI)
PasswordsValues assigned to variables named *password*, *passwd*, *secret*, *credential*
CertificatesPFX/P12 files with embedded passwords, PEM files with private keys

Lower-Confidence Patterns (Require Context)

  • Base64-encoded strings in configuration (may be encrypted or may be cleartext secrets)
  • JWT tokens (may be test tokens or production tokens)
  • Hex strings of 32+ characters (may be encryption keys or hashes)
  • URLs with embedded credentials (https://user:pass@host)

Context-Aware Detection

Distinguish real secrets from false positives. Not every pattern match indicates an actual secret — consider context:

Test Fixtures and Mock Data

csharp
// NOT a real secret — test fixture with obvious fake value
var testApiKey = "test-api-key-not-real-12345";
var mockPassword = "P@ssword123"; // Used only in unit tests

// REAL secret — production-looking value in non-test code
var apiKey = "sk-proj-abc123def456ghi789jkl012mno345pqr678stu901vwx";

Decision criteria:

  • Is it in a test directory (**/test/**, **/tests/**, **/*.Test/**)?
  • Does the value contain obvious placeholder text ("test", "fake", "mock", "example", "placeholder")?
  • Is the value used in assertions or mock setups?

Example and Placeholder Values

json
// NOT a real secret — documented example
{
  "apiKey": "YOUR_API_KEY_HERE"
}

// REAL secret — actual value in config
{
  "apiKey": "sk-proj-abc123def456ghi789jkl012mno345pqr678stu901vwx"
}

Encrypted or Hashed Values

  • Hashed passwords (bcrypt $2b$, argon2 $argon2id$) are NOT secrets — they're properly stored
  • Encrypted values with proper key management are NOT secrets in the same way
  • But the encryption KEY itself, if hardcoded, IS a secret

Common Hiding Spots

Search these locations when auditing for secrets:

LocationWhat to Look For
appsettings.json / appsettings.Development.jsonConnection strings, API keys, service credentials
.env / .env.localEnvironment variable definitions with real values
web.config / app.configMachine keys, connection strings
docker-compose.yml / DockerfileENV directives with credentials, build args with secrets
CI/CD files (.github/workflows/*.yml)Inline secrets instead of ${{ secrets.* }} references
Test seed scripts / migration filesDatabase passwords, service account credentials
Comments and TODO notes"Temporary" credentials left in comments
Default parameter valuesfunction connect(password = "admin123")
Constants filesCentralized credential definitions

GitHub Secret Scanning Integration

bash
# List all secret scanning alerts
gh api /repos/{owner}/{repo}/secret-scanning/alerts --jq '.[] | {number, state, secret_type, secret_type_display_name, created_at, push_protection_bypassed}'

# Get details for a specific alert
gh api /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}

# List alerts that bypassed push protection
gh api "/repos/{owner}/{repo}/secret-scanning/alerts?state=open" --jq '.[] | select(.push_protection_bypassed == true)'

Push protection prevents commits containing detected secrets from being pushed. When someone bypasses push protection, the alert is flagged — review these with extra scrutiny.

Remediation Workflow

When a secret is found in code, follow this sequence:

1. Rotate Immediately

Assume any committed secret is compromised. Even if the repo is private, the secret may have been cached, logged, or accessed by CI/CD systems.

  • Revoke the existing credential
  • Generate a new credential
  • Update the credential wherever it's used (services, deployments)

2. Remove from Code

Replace the hardcoded secret with a secure reference:

csharp
// WRONG — hardcoded secret
var connectionString = "Server=prod.db;Password=s3cr3t!";

// CORRECT — environment variable
var connectionString = Environment.GetEnvironmentVariable("DB_CONNECTION_STRING");

// CORRECT — Azure Key Vault (Bitwarden's approach)
var connectionString = await keyVaultClient.GetSecretAsync("db-connection-string");

3. Remove from Git History (If Needed)

If the secret was committed to a public repo or a repo that will become public:

bash
# Using git filter-repo (preferred over filter-branch)
git filter-repo --path-glob '*.json' --replace-text expressions.txt

# expressions.txt format:
# literal:the-secret-value==>REDACTED

Warning: Rewriting git history is destructive and affects all collaborators. Only do this when the secret was exposed in a public or soon-to-be-public repository.

4. Prevent Recurrence

  • Add patterns to .gitignore for files that should never be committed (.env, *.pfx, appsettings.Development.json)
  • Enable GitHub push protection for the repository
  • Use secret scanning custom patterns for organization-specific secret formats

Secure Alternatives

Bitwarden uses Azure Key Vault for secrets management, provisioned by the BRE team:

Instead OfUse
Hardcoded connection stringsAzure Key Vault secrets
API keys in config filesEnvironment variables set at deployment
Certificates in sourceAzure Key Vault certificates
Shared team credentials in codeManaged identities (Azure)
Secrets in CI/CD workflow filesGitHub Actions secrets (${{ secrets.NAME }})

For local development, use user-secrets or .env files that are .gitignored — never commit them.

Critical Rules

  • Assume any committed secret is compromised. Always rotate, even if the repo is private. No exceptions.
  • Never suppress secret scanning alerts without rotation. Dismissing an alert doesn't make the exposure go away.
  • Validation, not just detection. When a potential secret is found, verify it's real before raising an alarm. Check if it's a test value, placeholder, or encrypted content.
  • Check the full commit history. A secret removed in the latest commit may still exist in git history. Use git log -p -S "secret-pattern" to search history.
  • Bitwarden uses Azure Key Vault for secrets management. If a new secret needs to be stored, work with BRE to provision vault access for the repository.

Frequently asked questions

What does the Detecting Secrets AI skill do?

This skill should be used when the user asks to "find hardcoded secrets", "audit for credential leaks", "check for API keys in code", "review secret scanning alerts", "rotate a leaked secret", or needs to detect hardcoded credentials, review secret handling patterns, or remediate exposed secrets.

Why use Detecting Secrets on TypingMind?

Because you install it once and use it with any model. Detecting Secrets 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 Detecting Secrets in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/bitwarden/ai-plugins/tree/main/plugins/bitwarden-security-engineer/skills/detecting-secrets. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Detecting Secrets?

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 Detecting Secrets?

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

Is the Detecting Secrets AI skill free?

It is published on GitHub by bitwarden. Check the repository for licensing terms. 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 👇