SoftwareTestPilot
Security TestingPublished: 13 min read

Best SAST Tools for Developers: Semgrep, Sonar and More

Compare Semgrep, SonarQube, Checkmarx and Veracode for static code security: feedback speed, custom rules, CI fit, plus a tested Semgrep SQL injection rule.

SoftwareTestPilot
QA Editorial Team
Share:XLinkedInWhatsApp
Best SAST Tools for Developers: Semgrep, Sonar and More: Security Testing article cover, SoftwareTestPilot.com
Best SAST Tools for Developers: Semgrep, Sonar and More: Security Testing article cover, SoftwareTestPilot.com

Which SAST tool is best for developers?

For most development teams, the shortlist is Semgrep, SonarQube, Checkmarx and Veracode, and the right choice depends on how your team works more than on any ranking. Choose Semgrep if developers want fast scans, readable rules they can write themselves, and findings in pull requests. Choose SonarQube if you want security checks combined with code quality, quality gates and the option to run it on your own servers. Choose Checkmarx or Veracode if you are in a larger organisation that needs central security policies, compliance reporting and broad language coverage.

SAST (static application security testing) means scanning source code, bytecode or binaries for security weaknesses without running the application. It catches problems such as SQL injection, hard-coded secrets and unsafe deserialisation while the code is still in the editor or pull request, which is when they are cheapest to fix.

SAST is one layer. It does not test the running application, so pair it with dynamic testing and good functional tests. Our guide to security testing platforms for DevOps explains how SAST fits with SCA and DAST.

How we compared these SAST tools

We did not run paid trials of Checkmarx, Veracode or the paid SonarQube editions for this article. Claims about them come from official documentation, linked next to each point. We did install the free Semgrep command-line tool and ran the worked example later in this article ourselves.

We judged each tool on what matters to a developer's day:

  1. Feedback speed: can it report in the IDE or on a pull request within minutes?
  2. Signal quality: are findings explained clearly, with a data-flow trace from input to dangerous call, so developers trust them?
  3. Customisation: can the team add rules for its own frameworks and tune out noise?
  4. Workflow fit: IDE plugins, CI integrations and the ability to fail a build only on new issues.
  5. Deployment: cloud service, self-hosted, or both, which matters for teams with strict data rules.

SAST tools for developers at a glance

ACCELQ is listed first as SoftwareTestPilot's standing partner placement. It is not a SAST tool; it automates functional web, mobile and API tests, which run after static checks pass. The order of the remaining tools is alphabetical by category of use, not a measured ranking.

ToolAnalysesDeveloper workflowDeploymentBest fit
ACCELQNot SAST: codeless functional test automationRuns regression suites in CI after the buildCloudTeams pairing static checks with functional regression
SemgrepSource code with pattern and data-flow rulesCLI, CI, pull request comments, custom rules in YAMLOpen-source CLI plus cloud platformDeveloper-led teams that want speed and custom rules
SonarQubeSource code: quality and security rules, taint analysisIDE plugin, pull request decoration, quality gatesSelf-hosted Server or SonarQube CloudTeams wanting quality and security in one gate
Checkmarx OneSource code, broad language coverageIDE extensions, CI and SCM integrationsCloud platformEnterprises with central AppSec programmes
VeracodeCompiled binaries and bytecode from packaged artifactsIDE extensions, Pipeline Scan in CI, policy checksCloud platformRegulated organisations needing policy and compliance evidence

Semgrep: fast scans and rules developers can read

Semgrep's Semgrep Code overview describes it as a SAST tool for first-party code that you can run locally or in CI/CD. Its rules combine pattern matching with data-flow analysis, and they are transparent: you can open any rule, read its syntax and change it to cut false positives.

Strengths

  • Rules look like code. A rule is mostly a snippet of the code you want to catch, which makes custom checks for your own frameworks realistic for developers, not just security specialists.
  • Wide language support. The supported languages page lists 35+ languages, with cross-file data-flow analysis on major ones such as Java, Go and C#.
  • Fits pull requests. Findings can be configured to comment on or block pull requests.

Limitations

  • The deepest cross-file analysis and the Pro rules belong to the commercial platform; the open-source CLI alone analyses more narrowly.
  • Custom rules are powerful but need maintenance as your code changes.

SonarQube: security inside a code quality gate

SonarQube treats security as part of overall code health. Its documentation describes four rule types: reliability bugs, maintainability code smells, security vulnerabilities and security hotspots. Hotspots are security-sensitive code that a person should review, rather than a confirmed vulnerability. Its security-injection rules trace tainted user input through the code and show the execution flow.

Strengths

  • One gate for quality and security. A quality gate can block a merge when new code adds vulnerabilities or drops below agreed standards.
  • Self-hosting option. SonarQube Server runs on your own infrastructure, which suits teams that cannot send code to a cloud service. Sonar also offers SonarQube Cloud.
  • Familiar to many teams. It integrates with GitHub Actions, GitLab CI/CD, Azure DevOps and Bitbucket Pipelines, according to the SonarQube Server page.

Limitations

  • The editions page shows that branch and pull request analysis start with the Developer edition, and some advanced security features need a separate subscription. Check which features your edition includes.
  • Teams focused only on security may find the quality findings add noise until rules are tuned.

Checkmarx One: central AppSec for large codebases

Checkmarx One combines SAST with other application security scanners on one platform. For developers, the important part is that results reach the editor: the Checkmarx VS Code extension imports scan results into VS Code so you can find the vulnerable line, triage the finding and fix it without switching tools.

Strengths

  • Central policy. Security teams can set rules and track risk across many applications and teams.
  • Broad coverage. It targets large organisations with many languages and repositories.

Limitations

  • It is an enterprise platform. Initial tuning usually needs security team involvement to keep false positives under control.
  • Developers may see a slower feedback loop than with lightweight local scanners, depending on how scans are configured.

Veracode: binary analysis and policy checks

Veracode takes a different technical approach. Its Static Analysis documentation explains that the engine scans compiled binaries or bytecode uploaded as a packaged artifact, building a model of the application's control and data flow. This can analyse code without sharing raw source.

Strengths

  • Pipeline Scan for fast feedback. Pipeline Scan runs static analysis in IDEs, repositories and CI/CD, and compares results with a baseline file so the build can fail only on new findings.
  • Policy evaluation. Scans can be judged against security policies by CWE, category or severity, which helps regulated teams show compliance.
  • IDE coverage. The IDE plugins page lists extensions for Eclipse, JetBrains, Visual Studio and VS Code.

Limitations

  • Code must be packaged correctly before scanning, which adds setup, especially for unusual build systems.
  • Veracode notes that Pipeline Scan is not connected to its platform, so features such as flaw mitigations and flaw matching need the full Upload and Scan workflow.

Decision guide: match the tool to your situation

Your situationStart by evaluatingWhy
Small team, developers own securitySemgrepFast local and pull request scans; custom rules without a security specialist
Already tracking code quality, want security tooSonarQubeSecurity findings join an existing quality gate
Code must stay on your own serversSonarQube ServerSelf-hosted deployment
Many teams, central security group, auditsCheckmarx or VeracodeCentral policies, reporting and governance
Cannot share source code with a vendorVeracodeAnalyses compiled artifacts

Whichever you choose, run a two-week pilot on one real repository and measure how many findings developers agree are real. That number predicts adoption better than any feature list.

Worked example: a custom rule that blocks SQL injection

This example uses the free, open-source Semgrep CLI (version 1.186.0). It shows the kind of team-specific rule that makes SAST useful. The code below has two functions: one builds SQL from an f-string, which is open to SQL injection, and one uses a ? placeholder, which is safe.

import sqlite3

def find_user_unsafe(conn, email):
    query = f"SELECT id, name FROM users WHERE email = '{email}'"
    return conn.execute(query).fetchall()

def find_user_safe(conn, email):
    return conn.execute(
        "SELECT id, name FROM users WHERE email = ?", (email,)
    ).fetchall()

Our rule, saved as sql-fstring.yml, flags SQL built from an f-string and passed to execute, whether directly or through a variable:

rules:
  - id: sql-built-with-fstring
    languages: [python]
    severity: ERROR
    message: SQL built from an f-string can allow SQL injection. Use a ? placeholder and pass values separately.
    patterns:
      - pattern-either:
          - pattern: |
              $Q = f"..."
              ...
              $CONN.execute($Q, ...)
          - pattern: $CONN.execute(f"...", ...)

We ran semgrep scan --config sql-fstring.yml app.py --metrics=off and got exactly one finding, the unsafe function, while the safe one was not flagged:

┌────────────────┐
│ 1 Code Finding │
└────────────────┘

    app.py
   ❯❯❱ sql-built-with-fstring
          ❰❰ Blocking ❱❱
          SQL built from an f-string can allow SQL injection. Use a ? placeholder and pass values separately.

            4┆ query = f"SELECT id, name FROM users WHERE email = '{email}'"
            5┆ return conn.execute(query).fetchall()

What this shows

  • The ... inside the rule means "any code in between", so the rule still matches when the query is built on one line and executed later.
  • The message tells the developer how to fix the problem, not just that it exists. Good SAST findings teach.
  • To fail a CI job on findings, add the --error flag so Semgrep exits with a non-zero status.

Limits of this rule

It only catches f-strings. Queries built with + or .format() would need extra patterns, and data-flow (taint) rules handle cases where input passes through several functions. Start narrow, prove the rule is accurate, then widen it.

What SAST covers, and what it does not

It helps to be precise about scope before buying anything. SAST looks at the code your team writes. It is good at finding injection flaws, where user input reaches a database query, shell command or file path without being cleaned; unsafe use of cryptography, such as weak hashing for passwords; dangerous functions, such as deserialising untrusted data; and some hard-coded credentials.

SAST is weak or blind in other areas. It does not know which open-source libraries you depend on or whether they have published vulnerabilities; that is the job of software composition analysis (SCA). It cannot see server configuration, cloud permissions or HTTP security headers, which only exist when the application is deployed. And it rarely understands business rules, such as "a customer must not see another customer's invoice", so authorization flaws usually need targeted tests.

A practical way to explain this to a team: SAST answers "did we write dangerous code?", SCA answers "did we import dangerous code?", and dynamic testing answers "does the running system behave safely?". Each question needs its own check, and a missing layer leaves a predictable gap.

Secrets deserve special mention. Some SAST tools include secret detection, while others leave it to a separate scanner. Because a leaked API key can be abused within minutes of being pushed to a public repository, confirm which tool in your stack checks for secrets, and make sure it runs before code leaves a developer's machine, for example as a pre-commit hook.

How to roll out SAST without annoying developers

  1. Start with a baseline. Record existing findings and fail builds only on new ones, so a legacy backlog does not block every merge.
  2. Enable a small, high-confidence rule set. Injection, hard-coded secrets and insecure deserialisation are good first targets.
  3. Show findings where developers work. IDE and pull request comments beat a separate dashboard nobody opens.
  4. Agree a triage rule. Every finding is fixed, marked a false positive with a reason, or accepted as a risk by a named person.
  5. Review noise monthly. Disable or rewrite rules that developers keep marking as false positives.

Where QA engineers fit in SAST

SAST is usually owned by developers and security teams, but QA engineers add value in three ways. First, a SAST finding is a lead for a test: if a scanner flags possible injection in a search endpoint, write a negative test that sends hostile input to that endpoint. Second, QA can confirm fixes actually work at runtime, which static analysis cannot. Third, QA engineers who understand findings become stronger candidates for SDET and security-focused roles.

To build those skills, read our security testing guide for QA engineers, practise sending hostile API requests in the free API Playground, and see how AI tools are changing code review in our article on LLM code review and bug detection.

Common SAST mistakes

  • Turning on every rule on day one. Hundreds of findings teach developers to ignore the tool.
  • Treating hotspots as confirmed bugs. A hotspot needs a human review; it may be safe in context.
  • Scanning only the main branch. Problems are cheapest to fix in the pull request, before merge.
  • Assuming SAST covers dependencies. Third-party library vulnerabilities need SCA, a separate check.
  • Skipping runtime testing. Configuration, authentication and business logic flaws often only appear when the application runs.

Frequently asked questions

What is the difference between SAST and DAST?

SAST reads code without running it, so it finds issues early and points to the exact line. DAST attacks the running application from outside, so it finds configuration and runtime issues that code reading misses. Most teams use both.

Is there a free SAST tool for developers?

Yes. The Semgrep CLI is open source, and SonarQube offers a free Community Build. Their free versions have fewer features than the commercial products, so check what you need before you depend on one.

Do SAST tools produce false positives?

All of them do to some degree. Tools that show a data-flow trace and let you tune rules make false positives easier to confirm and remove.

Can SAST check AI-generated code?

Yes. SAST analyses code regardless of who or what wrote it, which makes it a useful safety net when teams accept AI-suggested code.

Your next step

Install the free Semgrep CLI, copy the rule above, and run it on one of your own Python projects. Then write one negative test for any real finding it reports. When you have tried a tool on real code, share what worked and what was noisy with other testers in the QA Community.

References

  1. 1
    Semgrep Code overview— docs.semgrep.dev
  2. 2
    Semgrep supported languages— docs.semgrep.dev
  3. 3
    SonarQube security-related rules— docs.sonarsource.com
  4. 4
    SonarQube Server editions— docs.sonarsource.com
  5. 5
    SonarQube Server— sonarsource.com
  6. 6
    Checkmarx VS Code extension— docs.checkmarx.com
  7. 7
    Veracode Static Analysis— docs.veracode.com
  8. 8
    Veracode Pipeline Scan— docs.veracode.com
  9. 9
    Veracode IDE plugins— docs.veracode.com