All Projects → returntocorp → Semgrep

returntocorp / Semgrep

Licence: lgpl-2.1
Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language
ocaml
1615 projects
Standard ML
205 projects
shell
77523 projects

Projects that are alternatives of or similar to Semgrep

Static Analysis
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
Stars: ✭ 9,310 (+64.26%)
Mutual labels:  static-analysis, static-code-analysis, sast
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-99.36%)
Mutual labels:  static-code-analysis, static-analysis
Pytype
A static type analyzer for Python code
Stars: ✭ 3,545 (-37.46%)
Mutual labels:  static-analysis, static-code-analysis
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (-19.88%)
Mutual labels:  static-analysis, static-code-analysis
Sonar Php
🐘 SonarPHP: PHP static analyzer for SonarQube & SonarLint
Stars: ✭ 288 (-94.92%)
Mutual labels:  static-analysis, static-code-analysis
codeclimate-eslint
Code Climate Engine for ESLint
Stars: ✭ 86 (-98.48%)
Mutual labels:  static-code-analysis, static-analysis
gha-setup-scancentral-client
GitHub Action to set up Fortify ScanCentral Client
Stars: ✭ 15 (-99.74%)
Mutual labels:  static-analysis, sast
eba
EBA is a static bug finder for C.
Stars: ✭ 14 (-99.75%)
Mutual labels:  static-code-analysis, static-analysis
unimport
A linter, formatter for finding and removing unused import statements.
Stars: ✭ 119 (-97.9%)
Mutual labels:  static-code-analysis, static-analysis
codeclimate-duplication
Code Climate engine for code duplication analysis
Stars: ✭ 96 (-98.31%)
Mutual labels:  static-code-analysis, static-analysis
Chronos
Chronos - A static race detector for the go language
Stars: ✭ 272 (-95.2%)
Mutual labels:  static-analysis, static-code-analysis
codeclimate-phpcodesniffer
Code Climate Engine for PHP Code Sniffer
Stars: ✭ 27 (-99.52%)
Mutual labels:  static-code-analysis, static-analysis
OpenStaticAnalyzer
OpenStaticAnalyzer is a source code analyzer tool, which can perform deep static analysis of the source code of complex systems.
Stars: ✭ 19 (-99.66%)
Mutual labels:  static-code-analysis, static-analysis
Pmd
An extensible multilanguage static code analyzer.
Stars: ✭ 3,667 (-35.3%)
Mutual labels:  static-analysis, static-code-analysis
analysis-model
A library to read static analysis reports into a Java object model
Stars: ✭ 74 (-98.69%)
Mutual labels:  static-code-analysis, static-analysis
analysis-net
Static analysis framework for .NET programs.
Stars: ✭ 19 (-99.66%)
Mutual labels:  static-code-analysis, static-analysis
Pylint
It's not just a linter that annoys you!
Stars: ✭ 3,733 (-34.14%)
Mutual labels:  static-analysis, static-code-analysis
identypo
identypo is a Go static analysis tool to find typos in identifiers (functions, function calls, variables, constants, type declarations, packages, labels).
Stars: ✭ 26 (-99.54%)
Mutual labels:  static-code-analysis, static-analysis
nakedret
nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
Stars: ✭ 82 (-98.55%)
Mutual labels:  static-code-analysis, static-analysis
qodana-action
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at GitHub with Qodana
Stars: ✭ 112 (-98.02%)
Mutual labels:  static-code-analysis, static-analysis

Semgrep logo

Lightweight static analysis for many languages.
Find bugs and enforce code standards.

Homebrew PyPI Documentation Join Semgrep community Slack Issues welcome! 4000+ GitHub stars Follow @r2cdev on Twitter


Semgrep is a fast, open-source, static analysis tool for finding bugs and enforcing code standards at editor, commit, and CI time. Get started →.

Semgrep analyzes code locally on your computer or in your build environment: code is never uploaded.

Its 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 the image:

Semgrep rule example for finding Python print() statements

The Semgrep ecosystem includes:

  • Semgrep - the open-source command line tool at the heart of everything (this project)
  • Semgrep CI - a specialized Docker image for running Semgrep in CI environments
  • Semgrep Playground - an online interactive editor for writing and sharing rules
  • Semgrep Registry - 1,000+ community-driven rules covering security, correctness, and performance bugs
  • Semgrep App - deploy, manage, and monitor Semgrep at scale with free and paid tiers.

Join 100,000 other developers and security engineers already using Semgrep at companies like Chef, Dropbox, Figma, HashiCorp, Snowflake, and Trail of Bits. Also check out tools powered by Semgrep!

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

Language support

General availability

C# · Go · Java · JavaScript · JSX · JSON · Python · Ruby · TypeScript · TSX

Beta & experimental

See supported languages for the complete list.

Getting started

To install Semgrep use Homebrew or pip, or run without installation via Docker:

# 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 --rm -v "${PWD}:/src" returntocorp/semgrep --help

Once installed, Semgrep can run with single rules or entire rulesets. Visit Docs > Running rules to learn more or try the following:

# Check for Python == where the left and right hand sides are the same (often a bug)
$ semgrep -e '$X == $X' --lang=py path/to/src

# Run the r2c-ci ruleset (with rules for many languages) on your own code!
$ semgrep --config=p/r2c-ci path/to/src

Visit the full documentation to learn more.

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

Using configs from local files (like --config=xyz.yml) does not enable metrics.

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

PRIVACY.md 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 returntocorp/semgrep:latest
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].