You can add your Node.js, Ruby, Python, Scala and Java GitHub repos and quickly test them, or decide which ones you’d like to continuously watch with Snyk.
This integration only works with GitHub and GitHub Enterprise instances that are publicly reachable (not on a private network) and not for bitbucket.org. For private instances, you will need to set up via Snyk’s Broker first.
- Go to the integrations page and click “Connect to GitHub”.
- You need to grant Snyk additional GitHub permissions. Choose to give access to public and private repositories, or grant access to public repositories only.
- Next, you’ll see a list of all GitHub repos across your GitHub organisations. Select the repos you would like to test with Snyk. If you have supported manifest files at the root, or one or two directories deep, Snyk will automatically recognise and create projects for them.
- Click on the button at the bottom of the page “Add selected repositories to Snyk”. The selected repos appear in your projects, and will be continuously checked for vulnerabilities.
- Clicking “View report” on any project lets you view & fix vulnerabilities right away. You’ll be able to review the suggested remediations, and create a PR with the required upgrades or patches.
To view your organisation's projects in Snyk, you'll need to have sufficient access to your organisation's repositories on GitHub.
Watch a Node.js, Ruby, Python, Scala or Java GitHub repo to add it as a project to Snyk. This will allow you to:
- see Snyk tests in your pull requests that check for vulnerabilities.
- get email alerts and a Snyk pull request with fixes when new vulnerabilities that affect your repo are disclosed.
- get email alerts and a Snyk pull request if a new upgrade or patch is available for a vulnerability that affects you.
- trigger a Snyk pull request with fixes yourself from the test report page or the project page for your repo on snyk.io.
Snyk tests will be visible in pull requests on repos that you are watching with Snyk. You can review and adjust the settings for this by going to the ‘Settings’ for the watched project:
- By default, Snyk runs a test when the dependencies in the
Gemfilechange, and fails the test if the new dependencies have vulnerabilities.
- You can change this to fail if the repository has any existing vulnerabilities (so tests will fail even if the current PR is not adding new vulnerable dependencies).
- You can choose to fail tests only for high severity vulnerabilities.
- You can disable Snyk tests in pull requests.
Note: Currently for Node.js and Ruby only
When viewing a Snyk test report for a repo that you own, or when looking at a project that you are watching with Snyk, you’ll see two options for fixing a vulnerability:
1) ‘Open a fix PR’ link: generate a Snyk pull request with the minimal changes needed to fix the vulnerabilities affecting the repo.
2) ‘Fix this vulnerability’ link: generate a Snyk pull request that fixes only this vulnerability.
You can review the vulnerabilities that will be fixed, change your selection, and choose to ignore any vulnerabilities that can’t be fixed right now before opening the pull request on the ‘Open a fix PR’ page.
Note that patching is only supported for Node.js repos; Ruby vulnerabilities can be fixed with upgrades only.
Snyk fixes your Ruby projects by updating vulnerable dependencies in your Gemfile.lock file. When a fix requires a change to your Gemfile, our fix pull requests will propose these changes.
When you open a PR via snyk.io, we will give you a heads-up when this is the case:
Here’s an example for the pull request:
Get a Snyk pull request when newly disclosed vulnerabilities affect you
Whenever a vulnerability is disclosed that affects a repo you’re watching, Snyk will not only email you about it, but also generate a Snyk pull request that addresses the vulnerabilities. You’ll receive a pull request similar to the example above.
Get a Snyk pull request when new upgrades or patches are available
When no upgrade is available, you can ignore or patch the vulnerability (patching is only available for Node.js projects). When a better remediation option has become available, for example an upgrade for a vulnerability you previously ignored, Snyk notifies you about this via email, and also generates a pull request with the new fix.
Disable automatic pull requests
You can disable Snyk’s auto-generated pull requests with fixes in your organisation settings. This will affect all projects in the organisation.
If you don’t want to watch a GitHub repo anymore, you can stop watching this project via the project settings. The project will be set to inactive, and you’ll no longer get alerts, pull requests, or Snyk test on your pull requests. The webhook that enables the GitHub integration for this repo will be removed.
You can restart watching at any time.
When granting Snyk access to GitHub, you can choose to:
- grant access to public and private repositories
- grant access to public repositories only
This is for all GitHub organisations you have sufficient permissions for.
If you want to change your permissions at another point in time, you can do so by going to Settings, Integrations and selecting GitHub from the list.
To test your GitHub organisation’s repositories with Snyk, you will need to have sufficient user permissions. When you authenticate Snyk, GitHub will show you which organisations you can integrate.
If you do not have the correct permissions, you will see “Access request pending” next to your organisation’s name, and you will be unable to see this organisation’s projects in Snyk.
If you’d like to integrate this organisation, you will need to request organisational approval in GitHub.