Secure code scanning for developers

Developer-first secrets detection across your workflow

SonarQube's secrets detection catches exposed code secrets, like passwords and access tokens, the moment they are written in your IDE or introduced at the pipeline stage. With actionable, in-context guidance, developers can remediate immediately, ensuring security and code quality are maintained at the speed of development.

Get startedContact sales
Secrets Detection

TRUSTED BY OVER 7M DEVELOPERS AND 400K ORGANIZATIONS

Mercedes Benz
Nvidia
U.S. Army
Santander
Costco

What are secrets?

Secrets are high-value credentials, like passwords, API keys, and database tokens, hardcoded within your source code that, when exposed, will compromise a company's security. Exposed secrets can grant unauthorized access to systems and data, leading to breaches and compliance risks. Preventing exposure requires identifying and removing secrets early in development and ensuring they never reach source control.

Secrets consist of:

  • Passwords
  • API keys
  • Encryption keys
  • Tokens
  • Database credentials

Why are leaked secrets a critical business risk?

Leaked secrets are a severe security risk since they grant unauthorized access to secure systems and data. Attackers can pivot quickly, escalate privileges, and exfiltrate sensitive information using exposed tokens, keys, or credentials. Rapid detection and immediate rotation of affected secrets are critical to contain impact and restore a secure posture.

Secrets in your code repository:

  • Increases developer workload to find, fix, and push changes
  • Requires painful remediation by forcing rotation of keys, tokens, and passwords

How does secrets detection work?

SonarQube uses a powerful combination of Regular Expressions and Semantic Analysis to detect secrets in source code. We scan as you code in your IDE with SonarQube for IDE in a true shift left approach, unlike other secrets detection tools, which only detect secrets in Git repo. Because SonarQube can detect secrets in code while you write, secrets never enter your repository, eliminating leakage. This proactive coverage extends into the CI/CD pipeline with automated quality gates to prevent risky changes from merging.

What makes SonarQube’s secrets detection the best code scanning tool for you

lock

Powerful

SonarQube's comprehensive secret detection goes beyond typical solutions, with over 340 rules that identify more than 400 secret patterns across 248 cloud services and a thousand APIs. Signal‑focused analysis ensures precise, low‑noise outcomes for developers.

lightning

Fast

Running a detect secrets scan happens together with your regular code scan and has no noticeable impact on scan performance time. This parallelized approach keeps developers productive while maintaining continuous security coverage in the CI/CD pipeline.

devops

Comprehensive

SonarQube performs secret detection in the IDE using SonarQube for IDE, and in your repository and CI/CD Pipeline using SonarQube Server or SonarQube Cloud. This shift-left approach stops leaks before commit. CI/CD quality gates prevent risky merges while keeping developers fast.

sonar

Accurate

SonarQube’s secrets detection boasts a false positive rate of less than 5%, which is critical for ensuring accuracy and maintaining developer trust. Consistent, low-noise findings help teams act quickly, reduce alert fatigue, and keep CI/CD pipelines moving without unnecessary blockers.

heart

Reliable

SonarQube’s secrets detection engine avoids runaways or overflow with a built-in safeguard to quit when it is taking too long to finish. This stability-by-design keeps scans predictable, preserves CI/CD pipeline throughput, and ensures developers aren’t blocked by hung or excessive analyses.

oss

Open source

SonarQube’s secrets detection code and rules are publicly available as open source for community contributions. Transparent rule definitions enable faster improvements, broader coverage, and shared best practices that benefit developers and security teams. Learn how to contribute!

code merge

Integrated

Secrets detection comes with SonarQube for IDE for free and is included in SonarQube Server and SonarQube Cloud commercial editions at no additional cost. Enable developers quickly with no extra licensing, simplifying rollout across teams and CI/CD pipelines.

secure

Governance

Demonstrate preventive controls with exportable reports, historical trends, and traceable remediation activity. Provide auditors with clear evidence of CI/CD pipeline checks, consistent policies, and documented outcomes to simplify compliance reviews.

Keep your company-specific secrets from leaking in CI/CD

Publicly known secrets cover most of your secrets, but a good portion are company-specific secrets with a structure or format only your company knows. Create custom rules with SonarQube Server Enterprise Edition and Data Center Edition to detect your company’s private secret patterns and deliver the best secrets detection coverage, up to 100% of all your secrets.

pull request failed

Secrets detection: Comprehensive protection from IDE to CI/CD

SonarQube goes above and beyond by educating developers within‑IDE guidance and code scanning that pinpoints which code contains secrets in your CI/CD pipeline. Each secrets detection rule includes clear remediation content explaining why the found code segment is a secret and the security risk impact, supporting DevSecOps best practices and compliance. Now developers know how not to include secrets in their code with actionable, audit‑ready guidance and quality gates that prevent leaks before merge.

code report shows some issues with security and reliability

Build trust into every line of code

Ready to deliver better, secure code? Get started today with the SonarQube deployment that's right for you.

Image for rating

4.6 / 5

Secrets Detection FAQs

Secrets detection is the process of automatically identifying sensitive information—like passwords, API keys, and tokens—embedded within source code. Even a small oversight, such as committing a credential to a public repository, can create significant security risks or regulatory challenges for organizations. By implementing robust secrets detection within development workflows, teams can prevent accidental exposure and quickly remediate issues before they reach production environments, safeguarding their codebase from potential exploits.


Prioritizing secrets detection directly improves the overall quality of code by ensuring that sensitive information is consistently protected and compliance requirements are met. Rather than relying on manual review, integrating automated secrets detection helps developers maintain secure practices without sacrificing development speed. This proactive approach addresses both technical and organizational priorities, making it a critical component of any strategy focused on producing quality code.

  • Follow SonarSource on Twitter
  • Follow SonarSource on Linkedin
language switcher
English

© 2025 SonarSource Sàrl. All rights reserved.