# Generating an Opengrep SAST Report

## **Introduction**

[Opengrep](https://github.com/opengrep/opengrep) is an open-source static analysis tool. You can read more about the Opengrep project [here](https://www.opengrep.dev/).

This guide covers:

1. **Running a basic Opengrep scan** using default rules.
2. **Generating and using a SARIF report.**

***

## **Prerequisites**

Before starting, ensure the following

* **Linux, macOS,** or **Windows**
* **Internet access** to download Opengrep

## **Installing and Running Opengrep**

#### **Step 1: Download Opengrep**

Use `wget` to download the latest release:

```bash
wget https://github.com/opengrep/opengrep/releases/download/v1.0.0-alpha.15/opengrep_manylinux_x86 -O opengrep
```

💡 *Replace the version number if a newer release is available on the* [*Opengrep releases page*](https://github.com/opengrep/opengrep/releases)*.*

#### **Step 2: Make Opengrep Executable**

```bash
chmod +x opengrep
```

This step ensures the binary has the necessary permissions to run.

***

## **Running an Opengrep Scan**

#### **Step 1: Clone Your Target Repository**

For example:

```bash
git clone https://github.com/WebGoat/WebGoat
cd WebGoat
```

💡 *Replace `WebGoat` with your actual project repository.*

#### **Step 2: Run the Opengrep Scan**

```bash
./opengrep ci --sarif --sarif-output opengrep_report.sarif --config auto
```

This will scan the repository and generate a **SARIF report (`opengrep_report.sarif`)** in the current directory.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mobb.ai/mobb-user-docs/integrating-sast-findings/semgrep-opengrep/generating-an-opengrep-sast-report.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
