Commands
Opengrep is run as opengrep COMMAND [FLAGS] [ARGUMENTS]. When the first argument is not a command, scan is assumed: opengrep --config rule.yaml . is equivalent to opengrep scan --config rule.yaml .. The flags --debug and --profile can also be given before the command.
opengrep --help lists the commands, and opengrep COMMAND --help shows the built-in help of a command.
Index
| Name | Summary |
|---|---|
opengrep ci | Scan a repository in a CI job: report the new findings and fail on blocking ones. |
opengrep lsp | Run Opengrep as a language server over standard input and output. |
opengrep scan | Run rules on files and report the findings. |
opengrep show | Print the version, the supported languages, or internal representations. |
opengrep test | Test rules against files annotated with the lines they must and must not match. |
opengrep validate | Check that rule files are valid, without scanning any code. |
Examples
scan is the default command
rule.yaml
rules: - id: find-eval pattern: eval(...) message: found eval languages: [python] severity: WARNINGapp.py
eval(1)Command and result
$ opengrep -q --config rule.yaml app.py
app.py
warn find-eval
found eval
1: eval(1)