GitHub Enterprise
When you want to add new integrations to your Snyk account you need to first decide the level type at which you want to install the integration.
Group level - Add integrations to your Snyk application that will be available for your Snyk AppRisk Essentials or Snyk AppRisk Pro. To set up integrations for Snyk AppRisk, use the Integrations menu at the Group level.
Organization level - Add integrations for your Snyk application that will be available for all Snyk products, except Snyk AppRisk.
Organization level - Snyk integrations
Feature availability
GitHub Enterprise integration is available only for Enterprise plans. If you have a Legacy Business plan, contact Snyk support for access. For more information, see Plans and pricing.
If you are a Snyk Enterprise plan customer, Snyk recommends that you use the GitHub Enterprise integration. If you use the self-hosted GitHub Enterprise product, you must use the GitHub Enterprise integration.
Prerequisites for GitHub Enterprise integration
Internet-accessible repositories. If your repositories are not internet-accessible, you must use Snyk Broker. This requires creating a startup script. For the script and instructions, see GitHub Enterprise - install and configure using Docker.
A public or private GitHub project.
The required PAT and GitHub repository access scope permissions. For more information, see GitHub and GitHub Enterprise permission requirements.
You do not need to be on a GitHub Enterprise level plan to use the Snyk GitHub Enterprise integration.
GitHub Enterprise integration features
The GitHub Enterprise integration lets you:
Perform periodic security scans across all integrated repositories.
Detect vulnerabilities in your Open Source components.
Provide automated fixes and upgrades through status checks in GitHub.
How to set up the GitHub Enterprise integration
Follow these steps to connect Snyk with your GitHub repositories:
Create a dedicated service account in GitHub Enterprise with a write level or higher scope for the repos you want to monitor with Snyk permissions. See Types of GitHub accounts and Required access scopes for the GitHub integration for details. Note that to create webhooks, which is required for PR checks, the repo permission for the account must be
Admin
. GitHub custom roles are not supported.Generate a personal access token for that account.
Generate a Personal Access Token
A personal access token (PAT) or fine-grained PAT must be generated in GitHub Enterprise under Developer settings.
See GitHub and GitHub Enterprise permissions requirements for detailed information on the access scope requirements you must adhere to.
How to authorize your Personal Access Token and enable SSO
In Snyk, navigate to the Integrations page and click the GitHub Enterprise card.
Enter your GitHub Enterprise URL and the personal access token (PAT) for the service account you created, and Save your changes. After Snyk has successfully connected to the GitHub instance, the list of available repositories displays for your selection.
If your GitHub Enterprise organization enforces SAML/SSO, select Configure SSO next to the PAT in GitHub after the PAT has been created. Occasionally, SSO is enforced in your GitHub Enterprise organizations after a PAT and Integration are configured. If this happens, any Projects that have already been imported show in Snyk, but retests, PR Checks, and so on, will not be performed. To fix this, check the Configure SSO settings to ensure the GitHub Enterprise organization is Authorized. If the organization is showing as Authorized, but the issue still persists, try de-authorizing the organization and then re-authorizing.
To use the integration with GitHub Enterprise Cloud, add the URL https://api.github.com
. To integrate with a self-hosted GitHub Enterprise, add the URL https://your.github-enterprise.host
in step two of PAT authorization.
Ensure that there are no trailing characters such as /
following the url. An integration with trailing characters in the URL may connect successfully but provide incorrect links back to the GitHub files.
If the PAT token changes or expires in GitHub, the integration with Snyk will not function. To resolve this, update the token in the Snyk GitHub Enterprise Integration settings.
How to import GitHub repositories
Select the repositories you want to import to Snyk and click Add selected repositories.
Snyk starts scanning the selected repositories for dependency files, such as package.json
, in the entire directory tree and imports the repositories to Snyk as Projects.
The imported Projects appear on your Projects page and are continuously checked for vulnerabilities.
Uses of the GitHub Enterprise integration
Obtain Project-level security reports
Snyk produces advanced security reports, allowing you to explore the vulnerabilities found in your repositories and fix them by opening a fix pull request directly to your repository with the required upgrades or patches.
The example that follows shows a Project-level security report.
Monitor Projects and generate automatic fix pull requests
Snyk scans your Projects on either a daily or a weekly basis. When new vulnerabilities are found, Snyk notifies you by email and opens an automated pull request with fixes for your repositories.
The example that follows shows a fix pull request opened by Snyk.
To review and update the automatic fix pull request settings:
In Snyk, navigate to Settings > Integrations > Source control > GitHub Enterprise > Edit Settings.
Scroll to the Automatic fix pull requests section, then select options as required:
Test new pull requests
The PR Checks feature enables Snyk to test any newly-created pull requests in your repositories for security vulnerabilities and sends a status check to GitHub. This allows you to see, directly from GitHub, whether the pull request introduces new security issues.
The following example shows how Snyk pull request checks appear on the pull requests page in GitHub.
To review and adjust the pull request test settings: In Snyk, navigate to Organization Settings > Integrations > Source control > GitHub Enterprise, and select Edit Settings.
Scroll to Snyk PR status checks; see Configure PR Checks for details.
How to assign pull requests to users
Feature availability
The Auto-assign PRs feature is supported only for private repositories.
Snyk can automatically assign the pull requests it creates to ensure that they are handled by the right team members.
Auto-assign for PRs can be enabled for the GitHub and GitHub Enterprise integration and all Projects imported via GitHub, or on a per-Project basis.
Users can either be manually specified, and all will be assigned, or automatically selected based on the last commit user account.
Enable Auto-assign for all Projects in the GitHub Enterprise integration
To configure the Auto-assign settings for all the Projects from an imported private repository, go to the Github integration settings using Organization Settings > Integrations > Source control > GitHub and select Enable pull request assignees.
You can then choose to assign PRs to the last user to change the manifest file or specified contributors.
For pull request assignees, the option The last user to change the manifest file is based on blame data, not Git commits.
Enable Auto-assign for a single Project
To configure the Auto-assign settings for a specific Project from an imported private repository, follow these steps:
In the Projects tab for your Organization, select and expand the relevant private repository, select a Target, and click the Settings cog. This opens the Project page.
On the Project page, apply unique settings for that specific Project. Select the Settings tab in the upper right and the Github integration __ option in the left sidebar.
Go to the Pull request assignees for private repos section at the bottom of the page and choose to Inherit from integration settings or Customize only for this Project.
Ensure Auto-assign PRs for this private Project is enabled.
Choose to assign PRs to the last user to change the manifest file or named contributors.
How to disconnect the GitHub Enterprise integration
Disconnecting the Snyk GitHub Enterprise integration halts all scans for imported repositories, PR checks cannot be executed, and Projects are deactivated in the Snyk Web UI.
Navigate to the Snyk GitHub Enterprise integration Settings.
At the bottom of the page, select Remove GitHub Enterprise.
A confirmation modal opens. To proceed, select Disconnect GitHub Enterprise.
After GitHub Enterprise is disconnected, imported Snyk Projects will be set to inactive, and you will no longer get alerts, pull requests, or Snyk tests on pull requests.
You can re-connect anytime; however, re-initiating GitHub Enterprise projects for monitoring requires setting up the integration again.
Group level - Snyk AppRisk integrations
The Integrations page shows all active integrations, including data from your existing Snyk Organizations that is automatically synced and provides access to the Integration Hub.
GitHub setup guide for Snyk AppRisk
If you used GitHub Apps for your SCM integrations at the Snyk Organization level, Snyk AppRisk requires an overview of your GitHub Organization. This means that the GitHub integration in Snyk AppRisk uses an API token as an authentication method to onboard your GitHub Organization.
Pulled entities by Snyk AppRisk from GitHub
Repositories
Builds - only when using GitHub Actions.
Scans - only when using Code security.
Prerequisites
Ensure you meet all prerequisites listed on the GitHub and GitHub Enterprise permission requirements page.
Integrate GitHub using Snyk AppRisk
Profile name (
mandatory
): Input your integration profile name.Organizations (
mandatory
): Input the names of all the relevant GitHub organizations.
If you have changed the name of your GitHub organization, copy the new name from the GitHub URL and paste it into the GitHub Organizations field in the Snyk AppRisk Integration Hub.
Access Token (
mandatory
): Create your GitHub PAT from your GitHub Organization.
Generate your GitHub PAT by following the instructions in the Generate a Personal access token from your GitHub settings section.
Authorize your GitHub PAT if you have configured SAML SSO. See the How to authorize your Personal Access Token and enable SSO page for more details.
Broker Token (
mandatory
): Create and add your Broker token if you use Snyk broker for AppRisk.Generate your Broker token by following the instructions from the Obtain your Broker token for Snyk Broker page.
Copy and paste the Broker token on the integration setup menu from the Integration Hub.
API URL (
mandatory
) - Input the API URL. The default URL ishttps://api.github.com
.Pull personal repositories (
optional
): Enable the option if you only want to pull the repositories you own.Add Backstage Catalog (
optional
): If you want to add your Backstage catalog, follow the instructions from the Backstage file for SCM Integrations page.
If you enabled the Pull personal repositories option, only your personal repositories are pulled, not the public ones.
If you want to pull data from both organization and personal repositories, then you must set up separate profiles.
Generate a Personal access token from your GitHub settings
Open GitHub and click the Settings menu for your profile.
Select Developer settings from the left sidebar.
Select Personal access tokens and then Tokens (classic).
Click Generate new token and, from the dropdown, select Generate new token (classic).
Add a description for your token in the Note field.
Select the required permissions:
repo
read:org
read:user
user:email
.
Click Generate token.
Copy and store the displayed key.
Fine-grained personal access token is not supported.
API Version
You can use the GitHub REST API repository to access information about the API.
You can use as the host Address the IP/URL of the GitHub server. The default URL is https://api.github.com
.
The user associated with the token needs to have write permissions on relevant repositories to collect a breakdown of scan issues.
Last updated