# GitHub Destination

## Overview

Destinations are integrations that receive alerts from rules, policies, system health notifications, and rule errors. Panther supports configuring Github as the destination where you will receive alerts.

The GitHub Destination requires a `Repository name` and an API `Token`.

When an alert is forwarded to a GitHub Destination, it creates an Issue in the repository. The repository must have Issues enabled.

The integration is most useful when infrastructure is defined in code such as with AWS CloudFormation or with Terraform.

## How to set up Github alert destinations in Panther

### Prerequisites

We recommend creating a dedicated Panther Alerts service account in Github.

### Generating an API Token in Github

Follow GitHub's documentation on [generating a Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).

1. Log in to your Github account using your service account (or any developer service account that has access to the repo)
2. Navigate to **Settings > Developer settings**:\
   ![The image shows the Github "Developer Settings" page. In the upper right corner, a dropdown menu is expanded and the "Settings" option is highlighted.](https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-3b019ba0b8f94b5176b7e9b96ed27ca9c01dc446%2Fgithub1%20\(11\).png?alt=media)
3. On the Developer Settings page, Click **Personal access tokens** on the left. Click **Generate new token**.\
   ![On the Developer Settings page in Github, the Personal Access Tokens tab is selected. There is a token named "Panther Alerts."](https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-64187157494e46ef08ff9410fbd4015452bf91c0%2Fgithub2%20\(10\).png?alt=media)
4. Fill out the form to configure your token. Select the `repo` permissions checkbox.
   * Note: GitHub does not support granular permissions for creating Issues. If this level of access is a concern, consider [creating a dedicated Issue tracking repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-an-issues-only-repository).
5. Click **Generate Token**. Copy the token and store it in a secure location, as you will need it in the next steps.
   * Note: GitHub does not allow you to view the token again. If you lose access to this token, you will need to generate a new one.\
     ![In the Github page for Personal Access Tokens, the token appears in a green tile. A black rectangle covers the actual token value in this screen shot.](https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-593ed240dc4571fe1080e8ee652db88397aea14a%2Fgithub3%20\(9\)%20\(12\)%20\(6\)%20\(1\).png?alt=media)

### Configure the Github Destination in Panther

1. Log in to the Panther Console.
2. In the left sidebar, click **Configure > Alert Destinations**.
3. Click **+Add your first Destination**.
   * If you have already created Destinations, click **Create New** in the upper right side of the page to add a new Destination.
4. Click **Github**.
5. Fill out the form to configure the Destination:
   * **Display Name**: Enter a descriptive name.
   * **Repository Name**: Enter the Github repository name. This will be in the format `owner/repo_name`.
   * **Token**: Enter the token you generated in Github during the previous steps of this documentation.
   * **Severity**: Select the severity level of alerts to send to this Destination.
   * **Alert Types**: Select the alert types to send to this Destination.
   * **Log Type**: By default, we will send alerts from all log types. Specify log types here if you want to only send alerts from specific log types.
   * **Allow Manual Dispatch**: Set this toggle ON if you'd like to be able to [manually dispatch alerts](https://docs.panther.com/alerts#manual-alert-dispatch) to this destination.\
     ![In the Panther Console, the "Configure your Github Destination" page is displayed. It contains fields for Display Name, Repository Name, Token, Severity, Alert Types, and Log Types.](https://4011785613-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-e205dd3b2f990b4decabb4c4c8f4d8d536a658ba%2FScreen%20Shot%202022-08-31%20at%2012.30.30.png?alt=media)
6. Click **Add Destination**.
7. On the final page, optionally click **Send Test Alert** to test the integration. When you are finished, click **Finish Setup**.

## Additional Information on Destinations

For more information on alert routing order, modifying or deleting destinations, and workflow automation, please see the Panther docs: [Destinations](https://docs.panther.com/destinations).


---

# 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.panther.com/alerts/destinations/github.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.
