This guide is for tech leads and architects who own code quality across several teams. It shows how to set up Datadog Static Code Analysis (SAST) and Software Composition Analysis (SCA) for GitHub repositories, and then how to cut the noise so that teams act on the findings that are left. The examples use datadog-static-analyzer 0.9.13, DataDog/datadog-static-analyzer-github-action v3.0.0 and DataDog/datadog-sca-github-action v4.5.0 with configuration schema v1.7, which were the current releases on 1 December 2026.
A first scan often reports hundreds of findings, and most of them come from a few rules. When every finding looks urgent, teams stop reading the list.
Choose where the scan runs
Datadog gives you two options:
- Datadog-hosted scanning. Datadog runs the scans on its own infrastructure, which works for GitHub, GitLab, Azure DevOps and Bitbucket Cloud but not for GitHub repositories that use Git Large File Storage.
- CI pipelines. Your pipeline runs the scan and uploads the results.
Start on the Code Security setup page in Datadog. In both cases you install a GitHub App through the Datadog GitHub integration, because PR comments and PR Gates need it. Give the app these permissions:
- Contents: Read, to show code snippets in Datadog.
- Pull requests: Read and write, to post comments.
- Checks: Read and write, to create checks that can block a pull request.
Run the scans in GitHub Actions
Skip this section if you use hosted scanning. Otherwise, add a workflow like this one:
name: Datadog Code Security
on:
push:
permissions:
contents: read
jobs:
sast:
name: Datadog SAST
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: DataDog/datadog-static-analyzer-github-action@v3
with:
dd_api_key: ${{ secrets.DD_API_KEY }}
dd_app_key: ${{ secrets.DD_APP_KEY }}
dd_site: datadoghq.com
cpu_count: 2
sca:
name: Datadog SCA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: DataDog/datadog-sca-github-action@v4
with:
dd_api_key: ${{ secrets.DD_API_KEY }}
dd_app_key: ${{ secrets.DD_APP_KEY }}
dd_site: datadoghq.com
Some details matter here:
- Both actions support only the
pushtrigger, so do not addpull_request. A push to the branch of a pull request is enough for PR comments and PR Gates. - Store
DD_API_KEYandDD_APP_KEYas secrets, and note that the application key needs thecode_analysis_readscope. - Set
dd_siteto your Datadog site, for exampledatadoghq.eu. - The SAST action is diff-aware by default, so on a feature branch it scans only the changed files.
- Datadog shows the default branch first, so push to it once after you add the workflow.
Find the rules that make the noise
Open the Code Security Repositories page and click a repository. The Code Vulnerabilities tab shows findings from Security rules, while the Code Quality tab shows Best Practices, Code Style, Error Prone and Performance rules. Use the facets on the left to filter them.
For a count per rule, run the analyzer locally. You can install it with Homebrew on macOS, download a release from GitHub or use the Docker image ghcr.io/datadog/datadog-static-analyzer, and then run it on a clean checkout of the default branch:
datadog-static-analyzer -i . -o findings.sarif -f sarif
jq -r '.runs[].results[].ruleId' findings.sarif \
| sort | uniq -c | sort -rn | head -20
The output lists the 20 rules with the most findings. Because the analyzer reads the same code-security.datadog.yaml file as the Datadog scans, you can check each change before you push it.
Now give each of the top rules one decision:
- Fix. The rule finds real bugs. For example,
typescript-best-practices/no-dupe-keyscatches a duplicate key in an object literal, which overwrites the earlier value. - Lower. The rule is valid but not urgent here, so you set its severity to
NOTICEorNONE. - Narrow. The rule is noisy only in some folders, such as tests, where you change its severity or ignore those paths.
- Remove. The rule does not fit the code base, and you turn it off for the whole repository.
- Exception. One line breaks the rule on purpose, and you suppress the finding on that line only.
Tune the rules in code-security.datadog.yaml
Datadog renamed the configuration file, which is now code-security.datadog.yaml in the root of the repository. The old static-analysis.datadog.yml is deprecated, and if both files exist, the new file wins.
This example uses the first four decisions:
schema-version: v1.7
sast:
use-default-rulesets: true
ruleset-configs:
typescript-best-practices:
rule-configs:
no-console:
severity: NONE
typescript-code-style:
rule-configs:
strict-equals:
severity:
/: NOTICE
src/legacy: NONE
assignment-name:
ignore-paths:
- "**"
global-config:
ignore-paths:
- "src/generated/**"
- "**/*.test.ts"
- "vendor/**"
sca:
ignore-paths:
- "examples/**"
What each part does:
severity: NONEkeeps the rule running at the lowest of the four levels (ERROR,WARNING,NOTICEandNONE), so you can raise the level again later. In a local test, theno-consolefindings still appeared with severityNONE.- The
severitymap sets a level per path, where the/key is the default and the longest matching path wins. Here,strict-equalsis a notice everywhere except insrc/legacy. ignore-paths: ["**"]on a rule turns it off for the whole repository. Theassignment-namerule wants camelCase variable names, so turn it off when your team has agreed on another naming style.global-config.ignore-pathsskips paths for all rules.ignore-generated-filesis on by default, but in a local test a generated API client insrc/generatedwas still scanned until it was listed here.sca.ignore-pathsskips paths in the SCA scan, such as demo apps.
Keep use-default-rulesets: true, because with false you must list every ruleset under use-rulesets, including AI-native SAST rulesets such as typescript-ai_sast. To drop a whole ruleset, add it to ignore-rulesets.
For SCA, schema v1.7 also has ignore-ecosystems and ignore-packages, with entries such as npm:lodash, but an ignored package gets no findings at all, not even for new vulnerabilities. For a single SCA finding, click Mute in the finding panel instead, which opens a flow to create an Automation Rule. Mute works only for findings in repositories.
Where the configuration lives
The same schema works in three places, and Datadog merges them from lowest to highest precedence:
- The org-level configuration in Datadog.
- The repository-level configuration in Datadog.
- The
code-security.datadog.yamlfile in the repository.
Lists are joined, while for single values the highest level wins. Put shared ignores such as vendor/** at org level, and put the rule decisions for one repository in the file. The file goes through code review, so every change has an author and a reason.
Suppress one finding in the code
For a single exception, add a no-dd-sa comment on the line above the code and always name the rule:
// The CLI prints its result for the user.
// no-dd-sa:typescript-best-practices/no-console
console.log(`Generated ${count} files`);
A bare no-dd-sa suppresses all rules on that line, so a new problem on the same line goes unseen. Put the reason in a normal comment above the suppression, an order that worked in a local test.
Datadog does not delete suppressed findings: the Repositories page shows them with is_suppressed: true, so you can audit them.
Decide what blocks a merge
Block a merge only on precise checks, and log the rest.
PR comments are for information
PR comments are diff-aware, which means they flag only new findings on lines that the pull request changed. In Repository Settings, for the organisation or per repository, you can:
- Set a minimum severity per scan type.
- Skip findings in test files, or in dev and test dependencies.
- Filter out findings that Bits AI marks as false positives.
A comment is not a check, so it does not block a merge. Set the minimum severity high enough that most comments lead to a fix.
PR Gates block merges
Open PR Gate Rules in the Software Delivery section of Datadog, and click New Rule:
- Pick the source. For SAST, the condition is code vulnerabilities or code quality violations, and for SCA it is library vulnerabilities or library licence violations.
- Pick the scope: all repositories or a selection.
- Set the condition, for example to fail when a pull request adds a code vulnerability with severity Critical.
Datadog adds a check to the pull request through the GitHub integration, and to block the merge you mark that check as required in a branch protection rule or a ruleset.
Here is a split to start with:
- Block: new SAST code vulnerabilities at Critical, and new SCA library vulnerabilities at Critical or High.
- Comment only: new code quality violations above your comment threshold.
- Log only: everything else, on the Repositories page.
Start each gate as non-blocking by creating the rule without marking its check as required yet. Check its results for a few weeks before you make it required.
It helps to know how gates behave:
- A gate fails only on new findings in the changed lines, so existing findings do not block and you can turn on a gate before the backlog is clean.
- Gates do not work on pull requests from forks, and on GitHub you cannot make them required in a repository with a merge queue.
- Re-running the check in the pull request does not re-run the gate.
Review the rule set every quarter
Plan a short review every quarter:
- Run the count per rule again on the default branch and compare it with last quarter.
- Check each rule at
NONE, and if it has few findings left, raise the severity and fix them. - Pick a few rules that find real bugs, such as
no-dupe-keysandno-unused-expressions, and give each team one of them. - Run
git grep -n "no-dd-sa"and remove suppressions that have no reason. - Look at the gate results and make a non-blocking gate required when its findings were correct.
- Check that no repository still has
static-analysis.datadog.yml.
Explain each decision in the pull request that changes the configuration file, so that the next review can start from that history.
In practice
At an international cosmetics retailer, we partnered with the client’s architecture team and supported its 7 product teams, 5 on web and 2 on the app.
An RFC, accepted in November 2025, chose Datadog, and Datadog SAST and SCA replaced a separate SAST tool. We then tuned the rules so the teams could focus on real findings, and set the noisy rules, each with 50 to 1,000 findings, to severity “none”. From January to March 2026, the SAST findings went from 383 to 34. Read the full case study.
Checklist
- Scanning runs in Datadog or in GitHub Actions on
push, and the GitHub App is installed. - The application key has the
code_analysis_readscope. - You have a count per rule from the analyzer and
jq. - Each noisy rule has one decision: fix, lower, narrow, remove or exception.
code-security.datadog.yamlusesschema-version: v1.7, and the old file is gone.- Generated code, vendor code and tests are in
global-config.ignore-paths. - Inline suppressions name the rule and give a reason.
- PR comments cover code quality, and PR Gates cover vulnerabilities.
- New gates start non-blocking.
- The rules get a review every quarter.
If you want help with this work, see SAST and SCA noise reduction. For AI review with the same block-or-log rules, see AI code review in CI.
Sources
- Datadog: Code Security configuration reference
- Datadog: Static Code Analysis
- Datadog: Set up Static Code Analysis
- Datadog: Static Code Analysis configuration
- Datadog: Static Code Analysis and GitHub Actions
- Datadog: Software Composition Analysis
- Datadog: Software Composition Analysis configuration
- Datadog: SCA in GitHub Actions
- Datadog: Pull request comments
- Datadog: PR Gates
- Datadog: Set up PR Gates
- DataDog/datadog-static-analyzer on GitHub
- DataDog/datadog-static-analyzer-github-action on GitHub
- DataDog/datadog-sca-github-action on GitHub
- GitHub Docs: About protected branches