semgrep /semgrep
Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.
★ 17,694⑂ 1,181👁 118⑃ 8,623● 3,352▤ 352
+7
Daily
17,694
stars
1,181
forks
118
watchers
8,623
prs
3,352
issues
352
releases
README
Code scanning at ludicrous speed.
Semgrep is a fast, open-source, static analysis tool that searches code, finds bugs, and enforces secure guardrails and coding standards. Semgrep supports 30+ languages and can run in an IDE, as a pre-commit check, and as part of CI/CD workflows.
Semgrep is semantic grep for code. While running grep "2" would only match the exact string _2_, Semgrep would match x = 1; y = x + 1 when searching for _2_. Semgrep rules look like the code you already write; no abstract syntax trees, regex wrestling, or painful DSLs.
Note that in security contexts, Semgrep Community Edition will miss many true positives as it can only analyze code within the boundaries of a single function or file. If you want to use Semgrep for security purposes (SAST, SCA, or secrets scanning), the Semgrep AppSec Platform is strongly recommended since it adds the following critical capabilities:
1. Improved core analysis capabilities (cross-file, cross-function, data-flow reachability) that greatly reduce false positives by 25% and increase detected true positives by 250%
2. Contextual post-processing of findings with Semgrep Assistant (AI) to further reduce noise by ~20%. In addition, Assistant enriches findings with tailored, step-by-step remediation guidance that humans find actionable 80% of the time.
3. Customizable policies and seamless integration into developer workflows, giving security teams granular control over where, when, and how different findings are presented to developers (IDE, PR comment, etc.)
The Semgrep AppSec Platform works out-of-the-box with 20000+ proprietary rules across SAST, SCA, and secrets. Pro rules are written and maintained by the Semgrep security research team and are highly accurate, meaning AppSec teams can feel confident bringing findings directly to developers without slowing them down.
Semgrep analyzes code locally on your computer or in your build environment: by default, code is never uploaded. Get started →.
Language support
Semgrep Code supports 30+ languages, including:
Apex · Bash · C · C++ · C · Clojure · Dart · Dockerfile · Elixir · HTML · Go · Java · JavaScript · JSX · JSON · Julia · Jsonnet · Kotlin · Lisp · Lua · OCaml · PHP · Python · R · Ruby · Rust · Scala · Scheme · Solidity · Swift · Terraform · TypeScript · TSX · YAML · XML · Generic (ERB, Jinja, etc.)
Semgrep Supply Chain supports 12 languages across 15 package managers, including:
C (NuGet) · Dart (Pub) · Go (Go modules, go mod) · Java (Gradle, Maven) · Javascript/Typescript (npm, Yarn, Yarn 2, Yarn 3, pnpm) · Kotlin (Gradle, Maven) · PHP (Composer) · Python (pip, pip-tool, Pipenv, Poetry) · Ruby (RubyGems) · Rust (Cargo) · Scala (Maven) · Swift (SwiftPM)
For more information, see Supported languages.
Getting started 🚀
1. From the Semgrep AppSec Platform
2. From the CLI
For new users, we recommend starting with the SemTop issues
#6835Include/exclude patterns matching on start/end26 comments · 2023-01-13#1301[Ruby] Typed metavariable handling new, literal arrays26 comments · 2020-07-17#5665Cannot correctly identify hardcoded secrets in YAML files due to intolerance to special characters.23 comments · 2022-06-30#2991yaml parsing: End_of_file exception on Windows22 comments · 2021-04-22#3304Provide better contextual display for patterns with large elisions18 comments · 2021-06-08#8074Group/filter findings in different categories17 comments · 2023-06-16#4620Semgrep tries to pull registry when `--validate` is on17 comments · 2022-02-04#2663semgrep timeout error "python.lang.maintainability.useless-literal.useless-literal-dict" on big dictionnaries17 comments · 2021-02-27
Discussions
#7155Announcing Semgrep Code: SAST designed and built for engineers0 comments · 2023-02-14#6654Releasing Semgrep 1.00 comments · 2022-12-02
Latest release
Release v1.185.0 v1.185.0 2026-11-101.185.0 - 2026-11-10 Added - PHP: Improved virtual call resolution for basic trait composition. (CODE-9176) - Supply Chain: a requirements.txt dependency declared as a version range (litellm=1.10) or with no version (flask) now produces a finding for every advisory whose affected versions overlap the declared range, in both the Python and native resolvers. Such a finding has no single installed version to confirm, so it needs review. A range line next to a pinned copy of the same package produces no finding of its own, since the pinned copy names the installed version. (SC-4243) - Secrets: