HashiCorp Cloud Platform
Scan GitHub for secrets
Connect GitHub as a data source to HCP Vault Radar to scan your GitHub repositories for sensitive data and secrets. Vault Radar supports scanning GitHub Cloud and GitHub Enterprise Server. You can connect to GitHub either as a data source host to auto discover GitHub organizations or as a data source tied to a single GitHub organization.
If you are new to HCP Vault Radar, checkout the HCP Vault Radar quickstart tutorial series.
Security and operations considerations
You can add GitHub as a data source in HCP Vault Radar using either a GitHub App or a personal access token (PAT).
The GitHub App is the recommended authentication method because it uses short-lived installation access tokens with scoped permissions, providing more granular access control. Installation access tokens are well-suited for use cases where long-lived user credentials are undesirable.
PAT authentication is easier to set up, but it uses long-lived tokens tied to a specific GitHub user, which can pose security risks if the token is compromised. PAT authentication also provides broader permissions, and has access to any repositories the user has access to.
Data source vs data source host
You can use GitHub App authentication with HCP Vault Radar data source. A data source supports a single GitHub organization per connection. If you have multiple GitHub organizations, you can add multiple data sources to Vault Radar, one for each organization.
You can use PAT authentication as either a data source, or a data source host. A data source host supports multiple GitHub organizations in a single connection.
This is an important security and operations trade-off to consider when deciding which authentication method to use.
| Requirement | GitHub App authentication | Personal access token (PAT) authentication |
|---|---|---|
| Single connection for multiple organizations | ā | ā |
| Connection per organization | ā | ā |
| Short-lived tokens | ā | ā |
| Limited repository access | ā | ā |
| Organization-level governance | ā | ā |
| Independent identity | ā | ā |
| Tied to a specific GitHub user | ā | ā |
Prerequisites
HCP IAM user with the HCP owner, or admin role
Vault Radar agent deployed and running (agent scan only)
Python 3.10.20 or later installed (GitHub App authentication only)
For GitHub App authentication with GitHub Cloud or GitHub Enterprise Server, create a GitHub App.
For GitHub personal access token (PAT) authentication with GitHub Cloud or GitHub Enterprise Server, create a PAT with the following permission scopes:
repo > all admin:org > read:org admin:repo_hook > all admin:org_hook > all user > read:user
Add a GitHub data source with app authentication
You can add and scan GitHub Cloud or GitHub Enterprise Server using the HCP Vault Radar cloud scan or HCP Vault Radar agent scan.
Using app authentication with the HCP Vault Radar cloud scan does not require Python 3.10.20 or later to complete the setup.
Set up HCP Vault Radar
Log into the HCP Portal with an HCP IAM user that has the HCP owner or admin role.
Click Vault Radar.
Click Settings.
Click Data sources.
Click Add data source.
Select HCP Vault Radar Scan.
Select GitHub Cloud.
Under Select authentication method, click the dropdown and select GitHub OAuth to authenticate with the GitHub App.
Click Connect to GitHub.
On redirect to GitHub, select which GitHub Org to Onboard and the repositories to install on.
On successful redirect to Vault Radar, click Next.
Select either All active repositories or Select repositories to monitor.
Click Finish.
Add a GitHub data source host with PAT authentication
You can add and scan GitHub Cloud or GitHub Enterprise Server using the HCP Vault Radar cloud scan or HCP Vault Radar agent scan.
Add GitHub Cloud as a data source to scan your GitHub organization's repositories for secrets.
Log into the HCP Portal with an HCP IAM user that has the HCP owner or admin role.
Click Vault Radar.
Click Settings.
Click Data Source Hosts.
Click Add data source host.
Select HCP Vault Radar Scan.
Select GitHub Cloud.
Enter the personal access token in the Enter your GitHub personal access token field.
Click Next.
Select either All data sources or Select data sources.
Click Finish.
Assign a group to a resource
Once you add a data source, an HCP user with the admin role must assign
a group to each of the monitored resources within each data source. You can
assign each resource to only one group.
If you do not already have a group, refer to the Identity and Access Management groups documentation to create a group.
Navigate to the Project dashboard.
Click Access control (IAM).
Click Add new assignment.
Search the name of the group in the Search for an assignee search field.
Click the group name in the search results.
Click the Select service pulldown menu and select Vault Radar.
Click the Select role pulldown menu and select the Vault Radar Developer role.
Click Save.
Click Back to Dashboard.
Click Vault Radar.
Click Resources.
Select the resource you want to assign to a group and click Assign groups.
Click the Assign resoruce to group pulldown menu.
Select the group that requires access to the resource.
Select either the Viewer or Contributor role.
Click OK.
Update data source host
Navigate to Settings.
Click Data Source Hosts
Click the vertical ellipsis to the right of the data source host.
To update the monitored data sources, click Edit data sources.
To update the token, click Edit data source host details.
To delete the data source host, click Delete data source host.
Update data source
Navigate to Settings.
Click Data sources.
Click the vertical ellipsis to the right of the data source.
To update the monitored data sources, click Edit data sources.
To update the authentication method, select the new authentication method from the Select authentication method dropdown.
To update the token, click Edit data source host details.
To delete the data source, click Delete data source.
Tutorials
Learn how to evaluate and implement HCP Vault Radar in your environment with our tutorials.
- HCP Vault Radar quickstart - Follow HashiCups, a fictitious coffee company, as they onboard HCP Vault Radar and scan their data sources for secrets.
- HCP Vault Radar operations - Learn how HashiCups operations team uses HCP Vault Radar advanced features to scan data sources with the Vault Radar agent, and correlates findings with HCP Vault to manage secrets.
- HCP Vault Radar developer - Learn how HashiCups developers use HCP Vault Radar advanced features to understand secret exposure, identify potential risks, and prevent leaked secrets during the software development lifecycle.