This product is not supported for your selected
Datadog site. (
).
Find Generic Secrets in Your Code
Generic Secret Scanning is in Preview. It looks for internal tokens and passwords that do not match a provider pattern.
Request AccessDatadog Secret Scanning scans code to find exposed secrets. Datadog also attempts to validate secrets and surface their status (valid, invalid) to help you prioritize secrets remediation.
Set up Secret Scanning
Scans can run in your CI/CD pipelines or directly in Datadog with hosted scanning (supported for GitHub, Azure DevOps, and GitLab). To get started, go to the Code Security Setup and click Activate scanning for your repositories or learn how to set up Secret Scanning using GitHub actions or with other CI providers.
Secret Scanning rules
Datadog Secret Scanning is powered by Sensitive Data Scanner (SDS) and includes all of the rules in the
Secrets and credentials category of SDS. For a subset of detections, Secret Scanning automatically checks if detected keys are live with third-party active validation.
How it works
Secret Scanning integrates directly with your repositories to continuously detect leaked secrets in your code. Built on Datadog’s static analyzer, it scans every commit across all branches of each configured repository. Findings are surfaced with repository, branch, and file path context so your team can identify, prioritize, and remediate exposed secrets at the source.
Each scan analyzes the full contents of every file in scope at the scanned commit, not only the lines or files that the commit changed. When Datadog scans a repository for the first time with hosted scanning, it also scans the full Git history of the repository. See Detect secrets in Git history.
Diff-aware scanning, which is available for Static Code Analysis, is not supported for Secret Scanning.
Key capabilities
Detect secrets in Git history
Deleting a secret from a file does not remove it from the repository. The secret remains in earlier commits, where anyone with access to the repository can recover it.
When a repository is first scanned with hosted scanning, Datadog scans its full Git history across all branches, in addition to the latest commit. Secrets that are no longer present at the latest commit of the default branch are reported as history-only findings.
History-only findings are labeled Detected in Git History in the findings list. To review them:
The finding details panel shows where the secret is in the repository history:
- Introduced in: The commit that added the secret, and the author of that commit.
- Removed in: The commit that removed the secret. If the secret is still present on an unmerged branch or tag, this shows Not removed.
Git history is scanned once, when a repository is first scanned with hosted scanning. A secret that is still present on an unmerged branch or tag, but not on the default branch, is reported as a history-only finding. CI scans analyze only the scanned commit.
History-only findings are not closed automatically by later scans, and rewriting Git history does not close them. Rotate or revoke the exposed credential, then
mute the finding.
Review exposed secrets in pull requests
When a pull request introduces a leaked secret, Datadog automatically adds inline comments to flag the exposure. You can also open a new pull request from Datadog to remediate the finding directly. For more information, see Pull Request Comments.
Automatically block leaks with PR Gates
Use PR Gates to prevent leaked secrets from being merged into your main branch. Datadog scans each pull request for exposed secrets and reports a pass or fail status directly to GitHub, Azure DevOps, or GitLab (in preview).
By default, checks are informational, but you can make them blocking to prevent merging when secrets are detected. For setup instructions, see Set up PR Gate Rules.
Inline exclusions
You can add inline exclusions to prevent certain findings from appearing in scan results. Comment no-dd-secrets to ignore secrets detected on the next line.
View and filter findings
After setting up Secret Scanning, each commit to a scanned repository triggers a scan. Findings are summarized on the Code Security Vulnerabilities page and grouped per repository on the Code Security Repositories page.
On the Secret Scanning (Secrets) tab, use filters to narrow results by facets such as:
- Severity
- Status (open, muted, fixed)
- Validation Status
- Team
- Repository visibility
- Is Git History
Create Jira tickets from findings
You can create a bidirectional Jira ticket directly from any finding to track and remediate issues in your existing workflows. Ticket status remains synced between Datadog and Jira. For more information, see Bidirectional ticket syncing with Jira.
Declare an incident from a leaked secret
Declare an incident from a finding by clicking Declare incident in the Secret Scanning side panel. The incident is pre-filled with all detection metadata.
Mute findings
To suppress a finding, click Mute in the finding details panel. This opens a workflow where you can create a Muting Rule for context-aware filtering by tag values (for example, by repository). Muting a finding hides it and excludes it from reports.
To restore a muted finding, click Unmute in the details panel. You can also use the Status filter on the Code Security Vulnerabilities page to review muted findings.
Next steps
- Set up Secret Scanning in your environment.
- Set up Automation Pipelines to automate initial triage.
- Review findings on the Code Security Vulnerabilities page.
Further Reading
Additional helpful documentation, links, and articles: