Secrets Scanner Simulator

Scan code and config for leaked API keys, tokens, private keys, and database credentials with 51 patterns. 100% in-browser - nothing is ever uploaded.

Advertisement

Free Secrets Scanner — Find Exposed API Keys in Your Own Code

This is a defensive tool. Its job is to help you find credentials you have accidentally committed, pasted, or left in a config file — before someone else finds them. Paste code, a configuration file, a log excerpt, or an environment file, and it scans against 51 built-in detection patterns covering cloud provider keys, payment and messaging API tokens, private keys, bearer and OAuth tokens, and database connection strings. Every finding comes back with a line and column number, the surrounding line for context, a severity rating, and step-by-step remediation guidance for that specific credential type.

The scan runs entirely in your browser. Your code is never uploaded, never logged, and never leaves your device — which is the only sane design for a tool whose entire input is, by definition, secrets. You can also drop in a file; the file is read locally by your browser and never transmitted.

A Leaked Credential Must Be Rotated, Not Deleted

This is the single most important thing on this page, and the mistake nearly everyone makes the first time.

When you discover a key committed to a repository, the instinct is to delete the line and push a fix. That accomplishes almost nothing. The key is still in your git history, retrievable by anyone with clone access via git log -p, git show, or a reflog entry. If the repository was ever public, ever mirrored, ever forked, or ever cloned into a CI runner, the key exists in copies you do not control and cannot reach. Even rewriting history with filter-repo or BFG does not help: forks retain their own objects, GitHub caches unreachable objects that stay accessible by commit SHA, and any clone taken before the rewrite is untouched.

Worse, exposure is usually not hypothetical. Automated scanners crawl public repositories continuously and pull new credentials within minutes of a push. Published research and provider incident reports consistently show credentials being used by third parties within a very short window of a public commit. By the time you notice, assume it has been harvested.

So the correct response, in order:

  1. Rotate or revoke first. Issue a new credential and invalidate the old one at the provider. This is the only step that actually ends the exposure. Do it before cleaning up the code.
  2. Check for use. Review provider logs — CloudTrail, Azure sign-in and activity logs, GCP audit logs, the Stripe dashboard, GitHub security log — for anything unexpected between the moment of exposure and the moment of revocation.
  3. Then remove it from the code and move it to a secrets manager or an environment variable that is not committed.
  4. Consider history rewriting a cleanup step, not a remediation. Useful for hygiene and for stopping the next person copying it. Not a substitute for rotation.
  5. Close the hole. Add the file to .gitignore, add a pre-commit scanning hook, and check whether the same credential was reused elsewhere.

The remediation text attached to each finding in this tool follows that order deliberately — rotate at the provider, audit for unauthorised use, move to managed secret storage, then tighten scope and enable rotation policies.

How to Use the Scanner

  1. Provide the text. Paste it, or upload a file — source, .env, YAML, JSON, Terraform, a log excerpt, a CI configuration.
  2. Read the findings. Results are sorted critical first, then by line number. Each shows the pattern that matched, the category, the line and column, the surrounding line, and the remediation steps.
  3. Filter. Narrow by category (Cloud, API Keys, Private Keys, Tokens, Database, Other), by severity, or by free-text search across findings.
  4. Control masking. Matched values are masked by default — first four characters, then asterisks, then last four — so you can screenshot results without leaking the credential. Toggle it off when you need the full value to identify which key it is.
  5. Triage false positives. Mark any finding as a false positive; it stays visible but is set aside from the count.
  6. Export. Save the findings as TXT, CSV, or JSON for a ticket or an audit record.

You can also add custom patterns: give a name, a JavaScript regular expression, a category, a severity, a description, and remediation text. The regex is validated before it is accepted, so a malformed pattern reports an error instead of silently matching nothing. Custom patterns are useful for internal token formats that no generic scanner knows about — an internal service key with a company-specific prefix, for instance.

What the 51 Patterns Cover

CategoryExamples detectedTypical severity
CloudAWS access key IDs (AKIA/ASIA/AROA and related prefixes), AWS secret access keys, GCP API keys, GCP service account JSON, Azure storage account keys, Azure client secretsCritical
API KeysStripe live and test keys, Twilio API keys and account SIDs, SendGrid, GitHub personal access / OAuth / app tokens, GitLab PATs, Slack bot, user and webhook tokens, Discord bot tokens and webhooks, Mailchimp, Heroku, Firebase, Square, Shopify, Telegram, Facebook, TwitterCritical to medium
Private KeysRSA, DSA, EC, OpenSSH, PGP, and generic PEM private key blocks, including encrypted onesCritical
TokensJSON Web Tokens, bearer tokens, OAuth access and refresh tokensHigh
DatabaseConnection strings and embedded credentialsHigh to critical
OtherBasic auth headers, generic API key assignmentsVaries

Severity reflects blast radius rather than string length. An AWS access key pair is critical because it can provision infrastructure and read every bucket in the account. A Stripe test key is rated low — it moves no real money — but is still worth flagging, because its presence usually means the live key is handled the same way somewhere else. A Twilio account SID is medium: not a secret by itself, but a strong hint that the auth token is nearby.

Limits You Should Understand

This is a regex-based scanner over text you paste. That has real boundaries, and knowing them keeps you from over-trusting a clean result.

  • It scans what you give it, not your repository. It does not walk git history. A clean scan of your current working file says nothing about what is in commit 400 from last year. For history, use a repository scanner such as gitleaks or trufflehog.
  • High-entropy secrets with no distinctive format may be missed. Providers that issue random strings without a recognisable prefix are hard to detect by pattern alone.
  • False positives happen. Test fixtures, documentation examples, and placeholder values match the same shapes as real keys. That is why triage and the false-positive toggle exist.
  • A match is not proof the credential is live. Verify at the provider — but if you cannot immediately prove it is dead, rotate anyway. Rotation is cheap; an unrotated live key is not.

The durable fix is to stop secrets reaching version control in the first place: keep them in a secrets manager, inject them at runtime as environment variables, list the files in .gitignore before the first commit, and run a scanner as a pre-commit hook and in CI.

Frequently Asked Questions

Is my code uploaded when I scan it?

No. All 51 patterns are evaluated in your browser using JavaScript. Nothing is transmitted, stored, or logged. Uploaded files are read locally by the browser’s file reader and never sent anywhere.

I removed the key and pushed a fix. Am I safe?

No. The credential is still in git history and in every clone, fork, mirror, and CI cache that pulled the repository. Deleting the line stops nothing. Rotate the credential at the provider first — that is the only action that ends the exposure.

Does rewriting git history fix it?

Not by itself. Forks keep their own objects, hosting platforms can retain unreachable objects addressable by commit SHA, and any clone taken before the rewrite is unaffected. Treat history rewriting as cleanup after rotation, never instead of it.

How fast do exposed keys get abused?

Fast. Automated scanners monitor public repositories continuously and act on new credentials within minutes. Assume any key that reached a public repository has been harvested, and prioritise rotation over investigation.

What if the finding is a false positive?

Mark it as one. Test fixtures and documentation placeholders routinely match real key formats. If you are genuinely unsure whether a value is live, rotating it costs far less than being wrong.

Can I add patterns for our internal token format?

Yes. Add a custom pattern with your own regular expression, category, severity, and remediation text. The regex is validated when you add it, so an invalid pattern surfaces an error rather than silently matching nothing.

Why are matched values masked by default?

So the results page is safe to screenshot and share with a colleague or attach to a ticket. Masking shows the first four and last four characters, which is enough to identify which key it is without reproducing it. Toggle it off when you need the full value.

Does this replace gitleaks, trufflehog, or GitHub secret scanning?

No. Those walk full repository history and run automatically in CI; this is an interactive scanner for a file or snippet in front of you, useful for a quick check before committing, reviewing a pull request diff, or auditing a config someone sent you. Run both.

What should I do after a clean scan?

Add pre-commit scanning so the check happens automatically, generate a proper .env file for local configuration, and keep it out of version control with a .gitignore. Detection is a backstop; the goal is that secrets never enter the repository at all.

What Is Secrets Scanning

Secrets scanning detects sensitive credentials — API keys, passwords, tokens, certificates, and connection strings — that have been accidentally committed to source code repositories, configuration files, or documentation. Hardcoded secrets are one of the most common and easily exploitable security vulnerabilities, providing attackers with direct access to databases, cloud services, APIs, and internal systems.

Research consistently shows that thousands of new secrets are exposed in public repositories daily. GitHub reports detecting and revoking millions of secrets per year through its push protection feature. Private repositories are also at risk — leaked or stolen repositories expose every secret ever committed.

Common Secret Types

Secret TypePattern ExampleRisk if Exposed
AWS Access KeyAKIA[0-9A-Z]{16}Full AWS account access
GitHub Tokenghp_[a-zA-Z0-9]{36}Repository and organization access
Slack Webhookhttps://hooks.slack.com/services/T.../B.../...Post messages to Slack channels
Database URLpostgres://user:pass@host/dbDirect database access
JWT SecretArbitrary string in JWT_SECRET=Forge authentication tokens
Private Key-----BEGIN RSA PRIVATE KEY-----Impersonate servers, decrypt data
Stripe Keysk_live_[a-zA-Z0-9]{24}Process payments, access customer data

Common Use Cases

  • Pre-commit scanning: Block commits containing secrets before they reach the repository, preventing the secret from entering git history
  • Repository auditing: Scan existing repositories (including full git history) for previously committed secrets that need rotation
  • CI/CD pipeline scanning: Automatically scan code during pull requests and builds to catch secrets that bypass pre-commit hooks
  • Incident response: When a repository is compromised, scan for all secrets that may have been exposed to determine the scope of required credential rotation
  • Compliance requirements: Meet SOC 2, PCI DSS, and other requirements for protecting authentication credentials

Best Practices

  1. Scan git history, not just current files — A secret committed and later deleted still exists in git history. Scan the full commit history and treat exposed secrets as compromised regardless of whether they are in the current codebase.
  2. Rotate exposed secrets immediately — Finding a secret in code means assuming it is compromised. Rotate (generate a new key) and update all systems using the old secret.
  3. Use environment variables and secret managers — Never hardcode secrets. Use environment variables for local development and services like AWS Secrets Manager, HashiCorp Vault, or Azure Key Vault for production.
  4. Enable pre-commit hooks — Git pre-commit hooks (using tools like detect-secrets, gitleaks, or trufflehog) prevent secrets from being committed in the first place.
  5. Enable GitHub push protection — If using GitHub, enable push protection to block pushes containing detected secrets. This provides a safety net beyond local pre-commit hooks.

Frequently Asked Questions

What types of secrets can this tool detect?+

The tool detects over 50 types of secrets including AWS access keys, API keys for services like GitHub, Stripe, SendGrid, and Slack, database connection strings, private keys (RSA, SSH, PGP), JWT tokens, and hardcoded passwords. It uses pattern matching to identify credentials from major cloud providers and popular services.

Is it safe to scan my code with this tool?+

Yes, the secrets scanner operates 100% client-side in your browser. Your code and any detected secrets are never transmitted to any server. This makes it safe for scanning sensitive production configurations and proprietary code without any privacy concerns.

What should I do if a secret is detected?+

Each finding includes specific remediation steps for that type of secret. Generally, you should immediately rotate or revoke the exposed credential, review access logs for unauthorized usage, update your code to use environment variables or a secrets manager, and add the file to your gitignore if appropriate.

How do I handle false positives?+

The tool allows you to mark any finding as a false positive, which removes it from the active results. This is useful for test credentials, placeholder values, or strings that match patterns but are not actual secrets. You can filter the results view to show or hide false positives.

Can I add custom patterns to detect organization-specific secrets?+

Yes, the tool supports custom patterns. You can define your own regex patterns to detect organization-specific API keys, internal tokens, or any credential format unique to your environment. Custom patterns can be assigned a severity level and remediation instructions.

How can I export the scan results?+

Scan results can be exported in multiple formats including JSON, CSV, and plain text reports. The exports include all findings with their severity, location, remediation steps, and context. You can use these reports for security audits, documentation, or integration with other tools.

What do the severity levels mean?+

Critical severity indicates high-value credentials like production API keys or private keys that could cause significant damage if compromised. High severity covers access tokens and service credentials. Medium severity includes webhook URLs and less sensitive tokens. Low severity is for test keys or informational findings.

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.