semgrep 1.157.0


pip install semgrep

  Latest version

Released: Mar 31, 2026


Meta
Author: Semgrep Inc.
Requires Python: >=3.10

Classifiers

Environment
  • Console

Operating System
  • MacOS
  • Microsoft :: Windows
  • POSIX :: Linux

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Security
  • Software Development :: Quality Assurance

Semgrep logo

Code scanning at ludicrous speed.

Homebrew PyPI Documentation Join Semgrep community Slack Issues welcome! Star Semgrep on GitHub Docker Pulls Docker Pulls (Old) Follow @semgrep on Twitter


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 →.

Semgrep CLI image

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 Semgrep AppSec Platform because it provides a visual interface, a demo project, result triaging and exploration workflows, and makes setup in CI/CD fast. Scans are still local and code isn't uploaded. Alternatively, you can also start with the CLI and navigate the terminal output to run one-off searches.

Option 1: Getting started from the Semgrep Appsec Platform (Recommended)

Semgrep platform image

  1. Register on semgrep.dev

  2. Explore the demo findings to learn how Semgrep works

  3. Scan your project by navigating to Projects > Scan New Project > Run scan in CI

  4. Select your version control system and follow the onboarding steps to add your project. After this setup, Semgrep will scan your project after every pull request.

  5. [Optional] If you want to run Semgrep locally, follow the steps in the CLI section.

Notes:

If there are any issues, please ask for help in the Semgrep Slack.

Option 2: Getting started from the CLI

  1. Install Semgrep CLI

    # For macOS
    $ brew install semgrep
    
    # For Ubuntu/WSL/Linux/macOS
    $ python3 -m pip install semgrep
    
    # To try Semgrep without installation run via Docker
    $ docker run -it -v "${PWD}:/src" semgrep/semgrep semgrep login
    $ docker run -e SEMGREP_APP_TOKEN=<TOKEN> --rm -v "${PWD}:/src" semgrep/semgrep semgrep ci
    
  2. Run semgrep login to create your account and login to Semgrep. This step is optional, but logging into Semgrep gets you access to:

  3. Go to your app's root directory and run semgrep ci. This will scan your project to check for vulnerabilities in your source code and its dependencies.

  4. Try writing your own query interactively with -e. For example, a check for Python == where the left and right hand sides are the same (potentially a bug): $ semgrep -e '$X == $X' --lang=py path/to/src

Semgrep Ecosystem

The Semgrep ecosystem includes the following:

  • Semgrep Community Edition - The open-source program analysis engine at the heart of everything. Suitable for ad-hoc use cases with a high tolerance for false positives - think consultants, security auditors, or pentesters.

  • Semgrep AppSec Platform - Easily orchestrate and scale SAST, SCA, and Secrets scanning across an organization, with no risk of overwhelming developers. Customize which findings developers see, where they see them, and integrate with CI providers like GitHub, GitLab, CircleCI, and more. Includes both free and paid tiers.

    • Semgrep Code (SAST) - Make real progress on your vulnerability backlog with SAST that minimizes noise and empowers developers to quickly fix issues on their own, even if they have no security knowledge. Easy to deploy secure guardrails and tailored, step-by-step remediation guidance mean developers actually fix issues since they don't feel slowed down.

    • Semgrep Supply Chain (SSC) - A high-signal dependency scanner that detects reachable vulnerabilities in open source third-party libraries and functions.

    • Semgrep Secrets (Secrets scanning) - Secrets detection that uses semantic analysis, improved entropy analysis, and validation to accurately surface sensitive credentials in the developer workflow.

    • Semgrep Assistant (AI) - Assistant is an AI-powered AppSec engineer that helps both developers and AppSec teams prioritize, triage, and remediate Semgrep findings at scale. Humans agree with Assistant auto-triage decisions 97% of the time, and rate generated remediation guidance as helpful 80% of the time. For an overview of how Assistant works, read this overview.

  • Semgrep MCP Server - A Model Context Protocol (MCP) server that lets AI coding assistants run Semgrep scans directly. Integrates with Cursor, VS Code, Windsurf, Claude Desktop, and more. Run semgrep mcp to start it locally.

    • Hooks - Automatically trigger Semgrep scans as you code.
    • Skills / Prompts - Built-in MCP prompts like write_custom_semgrep_rule help AI assistants write accurate Semgrep rules.
    • Claude Code plugin - Available on the official marketplace and via the semgrep/mcp-marketplace repo: /plugin marketplace add semgrep/mcp-marketplace
    • Cursor plugin - Available on the official marketplace and via the semgrep/cursor-plugin repo.

Additional resources:

  • Semgrep Playground - An online interactive tool for writing and sharing rules.
  • Semgrep Registry - 2,000+ community-driven rules covering security, correctness, and dependency vulnerabilities.

Join hundreds of thousands of other developers and security engineers already using Semgrep at companies like GitLab, Dropbox, Slack, Figma, Shopify, HashiCorp, Snowflake, and Trail of Bits.

Semgrep is developed and commercially supported by Semgrep, Inc., a software security company.

Semgrep Rules

Semgrep rules look like the code you already write; no abstract syntax trees, regex wrestling, or painful DSLs. Here's a quick rule for finding Python print() statements.

Run it online in Semgrep’s Playground by clicking here.

Semgrep rule example for finding Python print() statements

Examples

Visit Docs > Rule examples for use cases and ideas.

Use case Semgrep rule
Ban dangerous APIs Prevent use of exec
Search routes and authentication Extract Spring routes
Enforce the use secure defaults Securely set Flask cookies
Tainted data flowing into sinks ExpressJS dataflow into sandbox.run
Enforce project best-practices Use assertEqual for == checks, Always check subprocess calls
Codify project-specific knowledge Verify transactions before making them
Audit security hotspots Finding XSS in Apache Airflow, Hardcoded credentials
Audit configuration files Find S3 ARN uses
Migrate from deprecated APIs DES is deprecated, Deprecated Flask APIs, Deprecated Bokeh APIs
Apply automatic fixes Use listenAndServeTLS

Extensions

Visit Docs > Extensions to learn about using Semgrep in your editor or pre-commit. When integrated into CI and configured to scan pull requests, Semgrep will only report issues introduced by that pull request; this lets you start using Semgrep without fixing or ignoring pre-existing issues!

Documentation

Browse the full Semgrep documentation on the website. If you’re new to Semgrep, check out Docs > Getting started or the interactive tutorial.

Metrics

Using remote configuration from the Registry (like --config=p/ci) reports pseudonymous rule metrics to semgrep.dev.

When using configs from local files (like --config=xyz.yml), metrics are sent only when the user is logged in.

To disable Registry rule metrics, use --metrics=off.

The Semgrep privacy policy describes the principles that guide data-collection decisions and the breakdown of the data that are and are not collected when the metrics are enabled.

More

Upgrading

To upgrade, run the command below associated with how you installed Semgrep:

# Using Homebrew
$ brew upgrade semgrep

# Using pip
$ python3 -m pip install --upgrade semgrep

# Using Docker
$ docker pull semgrep/semgrep:latest
1.157.0 Mar 31, 2026
1.156.0 Mar 17, 2026
1.155.0 Mar 11, 2026
1.154.0 Mar 04, 2026
1.153.1 Feb 27, 2026
1.153.0 Feb 25, 2026
1.152.0 Feb 18, 2026
1.151.0 Feb 04, 2026
1.150.0 Jan 30, 2026
1.149.0 Jan 21, 2026
1.148.0 Jan 15, 2026
1.147.0 Jan 07, 2026
1.146.0 Dec 17, 2025
1.145.2 Dec 13, 2025
1.145.1 Dec 12, 2025
1.145.0 Dec 05, 2025
1.144.1 Dec 04, 2025
1.144.0 Nov 20, 2025
1.143.3 Nov 26, 2025
1.143.2 Nov 25, 2025
1.143.1 Nov 14, 2025
1.143.0 Nov 12, 2025
1.142.3 Nov 14, 2025
1.142.2 Nov 13, 2025
1.142.1 Nov 06, 2025
1.142.0 Oct 31, 2025
1.141.1 Oct 30, 2025
1.141.0 Oct 27, 2025
1.140.0 Oct 17, 2025
1.139.0 Oct 01, 2025
1.138.0 Sep 25, 2025
1.137.1 Sep 24, 2025
1.137.0 Sep 18, 2025
1.136.0 Sep 09, 2025
1.135.0 Sep 03, 2025
1.134.0 Aug 28, 2025
1.133.0 Aug 22, 2025
1.132.1 Aug 15, 2025
1.132.0 Aug 14, 2025
1.131.0 Jul 31, 2025
1.130.0 Jul 24, 2025
1.128.1 Jul 09, 2025
1.128.0 Jul 03, 2025
1.127.1 Jun 25, 2025
1.127.0 Jun 24, 2025
1.126.0 Jun 18, 2025
1.125.0 Jun 12, 2025
1.124.1 Jun 10, 2025
1.124.0 Jun 05, 2025
1.123.0 May 28, 2025
1.122.0 May 14, 2025
1.121.0 May 07, 2025
1.120.1 Apr 28, 2025
1.120.0 Apr 23, 2025
1.119.0 Apr 16, 2025
1.118.0 Apr 09, 2025
1.117.0 Apr 02, 2025
1.116.0 Mar 28, 2025
1.114.0 Mar 20, 2025
1.113.0 Mar 17, 2025
1.112.0 Mar 14, 2025
1.111.0 Mar 05, 2025
1.110.0 Feb 27, 2025
1.109.0 Feb 19, 2025
1.108.0 Feb 12, 2025
1.107.0 Feb 05, 2025
1.106.0 Jan 29, 2025
1.104.0 Jan 22, 2025
1.103.0 Jan 15, 2025
1.102.0 Jan 08, 2025
1.101.0 Dec 18, 2024
1.100.0 Dec 13, 2024
1.99.0 Dec 05, 2024
1.97.0 Nov 20, 2024
1.96.0 Nov 07, 2024
1.95.0 Oct 31, 2024
1.94.0 Oct 31, 2024
1.93.0 Oct 23, 2024
1.92.0 Oct 17, 2024
1.91.0 Oct 11, 2024
1.90.0 Sep 26, 2024
1.89.0 Sep 20, 2024
1.88.0 Sep 19, 2024
1.87.0 Sep 13, 2024
1.86.0 Sep 04, 2024
1.85.0 Aug 15, 2024
1.84.1 Aug 07, 2024
1.84.0 Aug 06, 2024
1.83.0 Aug 02, 2024
1.82.0 Jul 30, 2024
1.81.0 Jul 24, 2024
1.80.0 Jul 18, 2024
1.79.0 Jul 10, 2024
1.78.0 Jun 27, 2024
1.77.0 Jun 24, 2024
1.76.0 Jun 17, 2024
1.75.0 Jun 03, 2024
1.74.0 May 23, 2024
1.73.0 May 16, 2024
1.72.0 May 08, 2024
1.71.0 May 03, 2024
1.70.0 Apr 24, 2024
1.69.0 Apr 16, 2024
1.68.0 Apr 09, 2024
1.67.0 Mar 28, 2024
1.66.2 Mar 26, 2024
1.66.1 Mar 25, 2024
1.66.0 Mar 19, 2024
1.65.0 Mar 11, 2024
1.64.0 Mar 07, 2024
1.63.0 Feb 27, 2024
1.62.0 Feb 22, 2024
1.61.1 Feb 14, 2024
1.61.0 Feb 13, 2024
1.60.1 Feb 09, 2024
1.60.0 Feb 08, 2024
1.59.1 Feb 02, 2024
1.59.0 Jan 30, 2024
1.58.0 Jan 23, 2024
1.57.0 Jan 18, 2024
1.56.0 Jan 10, 2024
1.55.2 Jan 05, 2024
1.55.1 Jan 04, 2024
1.55.0 Jan 02, 2024
1.54.3 Dec 22, 2023
1.54.2 Dec 21, 2023
1.54.1 Dec 20, 2023
1.54.0 Dec 20, 2023
1.53.0 Dec 12, 2023
1.52.0 Dec 05, 2023
1.51.0 Nov 29, 2023
1.50.0 Nov 17, 2023
1.49.0 Nov 15, 2023
1.48.0 Nov 06, 2023
1.46.0 Oct 24, 2023
1.45.0 Oct 18, 2023
1.44.0 Oct 11, 2023
1.43.0 Oct 03, 2023
1.42.0 Sep 29, 2023
1.41.0 Sep 19, 2023
1.40.0 Sep 14, 2023
1.39.0 Sep 07, 2023
1.38.3 Sep 02, 2023
1.38.2 Sep 01, 2023
1.38.1 Sep 01, 2023
1.38.0 Aug 31, 2023
1.37.0 Aug 25, 2023
1.36.0 Aug 14, 2023
1.35.0 Aug 09, 2023
1.34.1 Jul 29, 2023
1.34.0 Jul 27, 2023
1.33.2 Jul 21, 2023
1.33.1 Jul 21, 2023
1.32.0 Jul 13, 2023
1.31.2 Jul 07, 2023
1.31.1 Jul 07, 2023
1.31.0 Jul 07, 2023
1.30.0 Jun 28, 2023
1.29.0 Jun 26, 2023
1.28.0 Jun 21, 2023
1.27.0 Jun 13, 2023
1.26.0 Jun 09, 2023
1.25.0 Jun 06, 2023
1.24.1 Jun 01, 2023
1.24.0 May 31, 2023
1.23.0 May 24, 2023
1.22.0 May 16, 2023
1.21.0 May 04, 2023
1.20.0 Apr 28, 2023
1.19.0 Apr 21, 2023
1.18.0 Apr 14, 2023
1.17.1 Apr 05, 2023
1.17.0 Apr 05, 2023
1.16.0 Mar 31, 2023
1.15.0 Mar 15, 2023
1.14.0 Mar 01, 2023
1.13.0 Feb 24, 2023
1.12.1 Feb 17, 2023
1.12.0 Feb 14, 2023
1.11.0 Feb 10, 2023
1.10.0 Feb 09, 2023
1.9.0 Feb 02, 2023
1.8.0 Feb 01, 2023
1.7.0 Feb 01, 2023
1.6.0 Jan 27, 2023
1.5.1 Jan 20, 2023
1.3.0 Jan 06, 2023
1.2.1 Dec 16, 2022
1.2.0 Dec 15, 2022
1.1.0 Dec 05, 2022
1.0.0 Dec 01, 2022
0.123.0 Nov 29, 2022
0.122.0 Nov 16, 2022
0.121.2 Nov 10, 2022
0.121.1 Nov 08, 2022
0.121.0 Nov 07, 2022
0.120.0 Nov 02, 2022
0.118.0 Oct 19, 2022
0.117.0 Oct 12, 2022
0.116.0 Oct 06, 2022
0.115.0 Sep 27, 2022
0.114.0 Sep 19, 2022
0.113.0 Sep 15, 2022
0.112.1 Sep 08, 2022
0.112.0 Sep 07, 2022
0.111.1 Aug 23, 2022
0.111.0 Aug 22, 2022
0.110.0 Aug 15, 2022
0.109.0 Aug 11, 2022
0.108.0 Aug 04, 2022
0.107.0 Jul 29, 2022
0.106.0 Jul 21, 2022
0.105.0 Jul 20, 2022
0.104.0 Jul 13, 2022
0.103.0 Jul 05, 2022
0.102.0 Jun 30, 2022
0.101.1 Jun 28, 2022
0.101.0 Jun 27, 2022
0.100.0 Jun 22, 2022
0.98.0 Jun 15, 2022
0.97.0 Jun 08, 2022
0.96.0 Jun 04, 2022
0.95.0 Jun 02, 2022
0.94.0 May 25, 2022
0.93.0 May 17, 2022
0.92.1 May 13, 2022
0.92.0 May 11, 2022
0.91.0 May 03, 2022
0.90.0 Apr 27, 2022
0.89.0 Apr 20, 2022
0.88.0 Apr 13, 2022
0.87.0 Apr 08, 2022
0.86.5 Mar 28, 2022
0.86.3 Mar 25, 2022
0.86.2 Mar 25, 2022
0.86.1 Mar 25, 2022
0.86.0 Mar 24, 2022
0.85.0 Mar 16, 2022
0.84.0 Mar 09, 2022
0.83.0 Feb 25, 2022
0.82.0 Feb 09, 2022
0.81.0 Feb 02, 2022
0.80.0 Jan 26, 2022
0.79.0 Jan 20, 2022
0.78.0 Jan 13, 2022
0.77.0 Dec 17, 2021
0.76.2 Dec 08, 2021
0.76.1 Dec 07, 2021
0.76.0 Dec 07, 2021
0.75.0 Nov 23, 2021
0.74.0 Nov 19, 2021
0.73.0 Nov 12, 2021
0.72.0 Nov 10, 2021
0.71.0 Nov 01, 2021
0.70.0 Oct 20, 2021
0.69.1 Oct 14, 2021
0.69.0 Oct 13, 2021
0.68.2 Oct 08, 2021
0.68.1 Oct 07, 2021
0.68.0 Oct 07, 2021
0.67.0 Sep 30, 2021
0.66.0 Sep 22, 2021
0.65.0 Sep 14, 2021
0.64.0 Sep 01, 2021
0.63.0 Aug 25, 2021
0.62.0 Aug 17, 2021
0.61.0 Aug 04, 2021
0.60.0 Jul 27, 2021
0.59.0 Jul 20, 2021
0.58.2 Jul 15, 2021
0.58.1 Jul 15, 2021
0.58.0 Jul 14, 2021
0.57.0 Jun 30, 2021
0.56.0 Jun 15, 2021
0.55.1 Jun 09, 2021
0.55.0 Jun 08, 2021
0.54.0 Jun 02, 2021
0.53.0 May 26, 2021
0.52.0 May 18, 2021
0.51.0 May 13, 2021
0.50.1 May 07, 2021
0.50.0 May 06, 2021
0.49.0 Apr 28, 2021
0.48.0 Apr 20, 2021
0.47.0 Apr 16, 2021
0.46.0 Apr 09, 2021
0.45.0 Mar 31, 2021
0.44.0 Mar 25, 2021
0.43.0 Mar 16, 2021
0.42.0 Mar 10, 2021
0.41.1 Feb 24, 2021
0.41.0 Feb 24, 2021
0.40.0 Feb 18, 2021
0.39.1 Jan 27, 2021
0.39.0 Jan 27, 2021
0.38.0 Jan 20, 2021
0.37.0 Jan 13, 2021
0.36.0 Jan 06, 2021
0.35.0 Dec 16, 2020
0.34.0 Dec 09, 2020
0.33.0 Dec 02, 2020
0.32.0 Nov 19, 2020
0.31.1 Nov 11, 2020
0.31.0 Nov 10, 2020
0.30.0 Nov 04, 2020
0.29.0 Oct 27, 2020
0.28.0 Oct 21, 2020
0.27.0 Oct 06, 2020
0.26.0 Sep 30, 2020
0.25.0 Sep 23, 2020
0.24.0 Sep 16, 2020
0.23.0 Sep 10, 2020
0.22.0 Sep 01, 2020
0.21.0 Aug 25, 2020
0.20.0 Aug 19, 2020
0.19.1 Aug 13, 2020
0.19.0 Aug 12, 2020
0.18.0 Aug 06, 2020
0.17.0 Jul 29, 2020
0.16.0 Jul 22, 2020
0.15.0 Jul 16, 2020
0.15.0b1 Jul 15, 2020
0.14.0 Jul 08, 2020
0.13.0 Jul 01, 2020
0.12.0 Jun 24, 2020
0.11.0 Jun 17, 2020
0.11.0b1 Jun 17, 2020
0.10.1 Jun 10, 2020
0.10.0 Jun 10, 2020
0.9.0 Jun 03, 2020
0.8.1 May 26, 2020
0.8.0 May 21, 2020
0.8.0b1 May 20, 2020
0.6.0 May 06, 2020
0.0.0 Feb 17, 2021
Extras: None
Dependencies:
attrs (>=21.3)
boltons (~=21.0)
click-option-group (~=0.5)
click (~=8.1.8)
colorama (~=0.4.0)
exceptiongroup (~=1.2.0)
glom (>=23.3)
jsonschema (~=4.25.1)
mcp (==1.23.3)
opentelemetry-api (~=1.37.0)
opentelemetry-sdk (~=1.37.0)
opentelemetry-exporter-otlp-proto-http (~=1.37.0)
opentelemetry-instrumentation-requests (~=0.58b0)
opentelemetry-instrumentation-threading (~=0.58b0)
packaging (>=21.0)
peewee (~=3.14)
pyjwt[crypto] (~=2.12.0)
requests (~=2.22)
rich (>=13.5.2)
ruamel.yaml (>=0.18.15)
ruamel.yaml.clib (==0.2.14)
semantic-version (~=2.10.0)
tomli (~=2.0.1)
typing-extensions (~=4.2)
urllib3 (~=2.0)
wcmatch (~=8.3)
pywin32 (==311)