Managing Panther Content via GitHub Actions
Manage detections and schemas in Panther with a CI/CD workflow using GitHub Actions
Last updated
Was this helpful?
Manage detections and schemas in Panther with a CI/CD workflow using GitHub Actions
Last updated
Was this helpful?
You can configure GitHub Actions to automate testing, customize detections, and upload your detection pipeline from your GitHub repository to your Panther Console. This guide will walk you through the following:
Creating a custom workflow via GitHub Actions
Testing your custom schemas and detections
Uploading the schemas and detections to your Panther Console
Customizing your GitHub Actions workflow to fit your organization's needs
See for information on starting your CI/CD workflow with Panther.
To get started with managing your Panther detections and schemas using GitHub Actions, you will need:
A Panther API Token
Follow our documentation for and ensure it has the for each command.
You will pass this API token as an argument to the panther_analysis_tool
command for operations such as uploading/deleting detections, custom schemas, saved queries, and more.
Your Panther API Host Name
Your Panther API hostname will look like this:
https://api.<your-panther-instance-name>.runpanther.net/public/graphql
Your Panther API Token added as a GitHub secret under the name PANTHER_API_TOKEN
To add the token to Secrets, follow . This secret is shown later in this document as secrets.PantherApiToken
.
Navigate to the GitHub repository where you would like to set up automation.
On the next page, replace the default filename (main.yml
) with a descriptive name, e.g., panther-workflow.yml
.
Add the following code to the YAML file:
Make sure to change the environment variable PANTHER_API_HOST
on line 51
to your Panther Instance's public GraphQL URL by replacing <your-panther>
.
This will run the tests you have created on your detections and then upload all your Panther content (Lookup Tables, Data Models, and detections) if they passed.
Run git push
.
After the Github Actions workflow is complete, the following will occur the next time you use git push
to make changes to the folders in the paths
section of the workflow:
Custom detections are tested with panther_analysis_tool
.
Upon success, detections are uploaded to your Panther Console.
If you are building custom schemas, use the following YAML code to include the schemas in your workflow:
Make sure to change the environment variable PANTHER_API_HOST
on line 84
to your Panther Instance's public GraphQL URL by replacing <your-panther>
.
Run git push
.
Now, the following will occur the next time you use git push
to make changes to the folders in the paths
section of the workflow:
Custom log schemas are tested with pantherlog
.
Custom detections are tested with panther_analysis_tool
.
Upon success, schemas and detections are uploaded to your Panther Console.
Optionally, you can extend or customize this workflow to better fit your organization. The following are common workflow customizations with Panther:
Perform Python Linting against .py
files.
Trigger from an approved Pull Request (PR) instead of a Push to a specific folder.
This guide explains how to upload to your Panther Console via GitHub Actions using Panther API keys and Github secrets. This is the recommended method if you are using GitHub Actions. You can also upload to your Panther Console directly via the panther_analysis_tool
. For more information, see
Follow the documentation to make use of Panther-managed detections in the panther-analysis GitHub repo: .
Within the GitHub repository, navigate to Actions.
Click New Workflow.
Click Set up a workflow yourself →.
Note: This workflow assumes you have added your Panther API token as a GitHub secret under the name PANTHER_API_TOKEN
. If you have not yet done this, please follow the instructions under the .
This workflow assumes you have added your Panther API token as a GitHub secret under the name PANTHER_API_TOKEN
. Please follow the instructions under the if you have not done that.
If you fork the repository by the latest tag, learn how can help keep Panther Detections up-to-date. We recommend syncing weekly by tag.
For more information on GitHub Actions, please see .