Semgrep
Semgrep is an open-source static analysis tool whose rules look like the code being searched and match on meaning rather than exact text. It has a free edition under the LGPL-2.1-only license, and its maintainer also sells a paid edition or commercial license. It runs on Linux, macOS, and Windows.
Updated
- Pricing
- Free / Commercial
- License
- LGPL-2.1-only
- Platforms
- Linux, macOS, Windows
- Category
- Application Security Tools
What Is Semgrep?
Semgrep is an open-source static analysis tool whose rules look like the code being searched and match on meaning rather than exact text. It runs in IDEs, as a pre-commit check, and in CI/CD pipelines to find bugs and enforce secure coding standards.
Use Cases
Automated code review, custom security rule authoring, and SAST scanning across polyglot codebases.
Strengths and Limitations
Strengths
- +Runs locally or in the build environment; code is not uploaded by default.
- +Rules look like normal code, making it easy to write custom company-specific patterns.
- +Semgrep Registry offers 2,000+ community-driven rules for security, correctness, and dependency issues.
Limitations
- -Community Edition analyzes only within a single function or file; cross-file and cross-function analysis requires the commercial Semgrep AppSec Platform.
- -Semgrep positions Community Edition for ad-hoc use with a high tolerance for false positives.
Defensive Use
Blocking insecure code patterns (such as SQL injections and path traversals) before pull requests merge.
Semgrep Alternatives
4 tools| Tool | License | Platforms | Pricing |
|---|---|---|---|
| Bandit Security linter from PyCQA that processes Python ASTs to find common vulnerability patterns and insecure library usages. | Apache-2.0 | Linux, macOS, Windows | Open Source |
| gosec Static security checker from SecureGo that inspects Go AST and SSA code representations to identify security flaws and bad practices. | Apache-2.0 | Linux, macOS, Windows | Open Source |
| Snyk Freemium application security platform that scans source code, open-source dependencies, containers, and IaC for vulnerabilities and license issues. | Proprietary (platform); Apache-2.0 (Snyk CLI) | Linux, macOS, Windows | Freemium |
| SonarQube Multi-language static analysis and code quality platform with open-source Community Build and commercial Server and Cloud editions. | LGPL-3.0-or-later (source); Sonar Source-Available License v1.0 (bundled analyzers) | Linux, macOS, Windows | Free / Commercial |
Frequently Asked Questions
What is Semgrep?→
Semgrep is an open-source static analysis tool whose rules look like the code being searched and match on meaning rather than exact text. It runs in IDEs, as a pre-commit check, and in CI/CD pipelines to find bugs and enforce secure coding standards.
What is Semgrep used for?→
Automated code review, custom security rule authoring, and SAST scanning across polyglot codebases.
What are the strengths of Semgrep?→
- +Runs locally or in the build environment; code is not uploaded by default.
- +Rules look like normal code, making it easy to write custom company-specific patterns.
- +Semgrep Registry offers 2,000+ community-driven rules for security, correctness, and dependency issues.
What are the limitations of Semgrep?→
- +Community Edition analyzes only within a single function or file; cross-file and cross-function analysis requires the commercial Semgrep AppSec Platform.
- +Semgrep positions Community Edition for ad-hoc use with a high tolerance for false positives.
How is Semgrep used defensively?→
Blocking insecure code patterns (such as SQL injections and path traversals) before pull requests merge.