metavariable
A placeholder in a Semgrep pattern, written as a dollar sign and capital letters such as $X, that matches any expression.
In more detail
A pattern such as $X.execute(...) matches the call whatever the variable is named. If the same metavariable appears twice, both places must hold the same expression.
Example
$CUR.execute("..." % ...) matches SQL built with % formatting on any cursorRelated terms
- Semgrep — An open-source static analysis tool whose rules look like the code they match, with metavariables and ellipses for the parts that vary.
- ellipsis operator — The three-dot token in a Semgrep pattern, which stands for any arguments, any string contents or any statements in between.
Taught in
- Static Application Security Testing with Semgrep — Cloud Security & DevSecOps Engineering