Secure code scanning for developers

Catch secrets before the commit

SonarQube catches exposed secrets—like passwords and access tokens—the moment they are written. With actionable code intelligence, developers can remediate immediately, ensuring code security and code health are maintained at the speed of development.

Get startedContact sales
Secrets Detection

TRUSTED BY OVER 7M DEVELOPERS WORLDWIDE

Mercedes Benz
Nvidia
Santander

The risk of hardcoded secrets

Hardcoded secrets are high-value credentials that, when exposed, compromise your entire security posture and private data. SonarQube provides the "trust and verify" framework needed to identify these risks early—from API keys to database tokens. This proactive approach prevents the costly, complex remediation and developer toil associated with repository leaks, ensuring code security and code health stay prioritized throughout your workflow.

Why prevention is better than remediation

Once secrets are committed to a repository, they are compromised. Remediation requires rotating credentials and cleaning history—a process that creates significant developer toil and operational friction. Preventing secrets is more effective than post-commit remediation. SonarQube for IDE intercepts these risks as you write, providing  actionable intelligence needed to ensure code security and code health. This proactive approach protects your private data sources and eliminates the need for security fixes.

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

Image for SonarQube for IDE

SonarQube for IDE

Secrets detection is available within the developer flow for free. It highlights exposed passwords and API keys the moment they are written, ensuring sensitive credentials never leave your local environment or reach production. 

Image for SonarQube Cloud

SonarQube Cloud

For teams using cloud-powered DevOps, secrets detection is included in all tiers—including Free, Team, and Enterprise plans. It provides automated analysis during pull request reviews to catch leaks before they are merged.

Image for SonarQube Server

SonarQube Server

Included in Developer, Enterprise, and Data Center editions, this capability provides ultimate control. While public pattern detection is universal, SonarQube Server Enterprise Edition adds custom patterns for proprietary, company-specific credential formats.

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 450+ 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.

Additional resources

Datasheet

Developer-first secrets detection across your workflow with SonarQube

Stop credentials from ever reaching your repository. SonarQube for IDE catches hard-coded secrets—like database passwords and tokens—as you write code, while SonarQube Server and SonarQube Cloud provide automated checks in your PRs.

Download >

Blog post

Stop secrets before the commit

This blog post explains why secrets detection is critical and how Sonar’s integrated approach reduces noise. It also explains how the new SonarQube Secrets CLI helps teams catch secrets locally.

Learn more >

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.