Semgrep
An open-source static analysis tool whose rules look like the code they match, with metavariables and ellipses for the parts that vary.
In more detail
A rule has an ID, target languages, a severity, a message and one or more patterns. Semgrep matches them against the syntax tree, so formatting, comments and variable names do not matter.
Related terms
- static application security testing — Analysing source code without running it to find insecure patterns, such as SQL built from user input.
- metavariable — A placeholder in a Semgrep pattern, written as a dollar sign and capital letters such as $X, that matches any expression.
- ellipsis operator — The three-dot token in a Semgrep pattern, which stands for any arguments, any string contents or any statements in between.
- nosemgrep — A code comment that tells Semgrep to ignore a finding on that line, ideally naming the exact rule being suppressed.
Taught in
- Shift-Left Security Principles & Automated Pipeline Gates — Cloud Security & DevSecOps Engineering
- Static Application Security Testing with Semgrep — Cloud Security & DevSecOps Engineering