...
Table of Contents |
---|
Overview
WhiteSource Remediate is a feature of WhiteSource's repository integrations, which automatically opens fix Pull Requests for vulnerable open-source components, upgrading them to the lowest non-vulnerable version.
...
Table of Contents |
---|
Overview
WhiteSource Remediate automatically opens fix Pull Requests for vulnerable open-source components, upgrading them to the lowest non-vulnerable version. WhiteSource Remediate is part of WhiteSource Developer Integrations and integrated with WhiteSource for GitHub.com, WhiteSource for GitHub Enterprise, WhiteSource for Bitbucket Server, and WhiteSource for GitLab. In additionProviding additional capabilities for project dependency health, Remediate is integrated with WhiteSource Renovate (see below for details). Renovate enables you to save time and reduce risk by automating dependency updates in software projects.
WhiteSource Remediate provides the following capabilities:
...
NOTE: A fix Pull Request is only generated for security vulnerabilities discovered on your repo's default branch, and for direct dependencies onlybase branches, including transitive dependencies in npm.
Supported Package Managers
Package Manager | Language | Extra Details |
---|---|---|
Maven | Java | N/A |
Gradle | Java | N/A |
Go Modules | Golang | Remediate will update both the |
npm/Yarn | JavaScript | WhiteSource Remediate always updates both the package file (e.g. package.json) as well as any lock file (e.g. yarn.lock) in the same commit/fix Pull Request. |
NuGet | .NET | Only SDK-style
To convert your .NET Framework .csproj into an SDK-style project, follow this guide. |
pip | Python | N/A |
pipenv | Python | N/A |
poetry | Python | N/A |
setuptools | Python | N/A |
Composer | PHP | N/A |
NOTE: In WhiteSource for GitLab, mirrored repositories are not supported.
...
From the WhiteSource web application, click the Integrate tab.
Expand the WhiteSource for Developers option.
From within the relevant repo integration settings, click Manage Workflow Rules. The Workflow Rules page is displayed.
Click Add Rule. The Add Rule dialog box is displayed.
Select a Product and/or Project scope from the Scope area or leave at the default (applies to all of your WhiteSource Products and Projects).
Select a rule type from the Type dropdown menu.
Click OK to create the rule.
Once you set up a Workflow Rule, WhiteSource Remediate will start monitoring your selected repositories for vulnerable dependencies and generate corresponding fix Pull Requests.
Configuration
...
of GitHub.
...
com Credentials
Info |
---|
If you are running Remediate against github.com already, or making use of WhiteSource for github.com, then you don’t need to provision credentials explicitly. |
...
WhiteSource Remediate can be configured to work with the integration activation key using either the prop.json
configuration file or using environment variables.
NOTE: The environment variable takes precedence over an activation key value specified inside a prop.json file.
Providing the Integration Activation Key in prop.json
You can provide the integration's activation key to the Remediate container using a prop.json file.
Providing the Integration Activation Key using
...
Environment Variables
You can provide the integration activation key by using the W4D_BOLT_OP_ACTIVATION_KEY environment variable inside the Remediate container.
Proxy Support
WhiteSource Remediate can be configured to work with proxy servers using either the prop.json
configuration file or using environment variables.
...
WhiteSource Remediate also supports the industry convention of HTTP_PROXY
, HTTPS_PROXY
and NO_PROXY
. This provides more flexibility if you need to also configure any internal/private registries in the no proxy list so is the recommended configuration approach. Such variables will be passed transparently to child processes.
Integration with WhiteSource Renovate
WhiteSource Renovate functionality can be enabled in WhiteSource Remediate.
With Renovate functionality enabled, Remediate will then raise PRs/MRs not only for vulnerable dependencies but also for outdated dependencies too.
Renovate is designed for users who aim to keep their dependencies up-to-date, primarily for the reasons of:
Keeping up with all bug-fixes from open source libraries
Reducing the risk of updating vulnerable versions in a hurry, because small jumps in versions are easier to test than large
Renovate itself is well-documented via its own documentation site. The Renovate docs are automatically generated based off the open source Renovate repository, so are unnecessary to duplicate here in full, however examples and clarifications will be provided below specifically for users of WhiteSource Remediate.
Renovate Configuration
Renovate supports a range of different filenames, however for WhiteSource Remediate integration only the .whitesource
configuration file is used. Renovate is disabled by default so enabled by setting remediateSettings.enableRenovate = true like so:
Code Block |
---|
{
"remediateSettings": {
"enableRenovate": true
}
} |
Any configuration you place within the remediateSettings
object will be used by Remediate similarly to how Renovate usually uses a renovate.json
configuration file. Therefore, if you have an existing renovate.json
file in a repository but are migrating to WhiteSource Remediate then you'd copy paste its contents inside remediateSettings
before removing the renovate.json
file.
Recommended Starting Config
If you are new to Renovate, we recommend you start with the config:base preset config, which enables functionality such as maximum two dependency update PRs per hour as well as grouping well-known monorepo dependencies together:
Code Block |
---|
{
"remediateSettings": {
"enableRenovate": true,
"extends": ["config:base"]
}
} |
What Happens When Remediations Are Available
It's useful to understand how Remediate works if you have Renovate enabled with updates available while vulnerability fixes are also required at the same time. If a package dependency needs vulnerability remediation then Remediate reads the list of fixed versions and determines the minimum version that solves all known CVEs. It then uses a package rule to enforce that the remediation PR/MR for that package does not propose to update to the latest and instead updates to the lowest version that can resolve all open CVEs for the package. If an existing PR/MR exists proposing an update to the latest version but the minimum fix is lower, the existing PR/MR may be auto-closed by Remediate and replaced with the minimum fix PR/MR instead. This is intentional so that (a) teams can focus on the high priority remediation PR/MR, and (b) remediations cause the least changes possible so that they are simpler to verify and test.
Common Configuration Options and Examples
Renovate is highly configurable with many options, so here are the most commonly used ones to take a look at first:
schedule: use this is you want to raise dependency update PRs during limited times, such as weeknights and weekends. Combine with timezone so that schedules can be written in your local time instead of UTC.
packageRules with groupName: matching multiple packages and assigning a groupName will mean they will be grouped into a single PR. This can be useful if certain packages must always be upgraded together, or if you wish to reduce the total number of PRs.
assignees and reviewers: use these fields to configure who is assigned or requested to review PRs (note: will apply to remediation PRs/MRs too)
automerge: enable this (ideally using packageRules) on dependencies you trust to be merged automatically by Remediate once they pass tests.
If you have questions about any particular configuration option or are looking for examples of its use, you may find it useful to search existing Issues in Renovate's Config Help Repository on GitHub.
Merge Confidence
Info |
---|
For more information Merge Confidence, see here. |
Merge Confidence is a beta feature for Renovate which embeds visual "badges" in Pull Requests to show statistics on upgrade age, adoption, compatibility and ultimately "confidence".
To enable it for Renovate within WhiteSource Remediate, add the following configuration within the remediateSettings
section of your .whitesource
file:
Code Block | ||
---|---|---|
| ||
{
"remediateSettings": {
"enableRenovate": true,
"extends": ["github>whitesource/merge-confidence:beta"]
}
} |
NOTE: the above configuration is supported only in version 21.2.2 or later of the Repo integration.
If you are using version 21.2.1 or earlier of the Repo integration, add the following configuration within the remediateSettings
section of your .whitesource
file:
...
language | js |
---|
...
Automated Dependency Updates for Improved Dependency Health
Although remediating vulnerabilities should be the highest priority for dependency updating, it is recommended to adopt a proactive dependency update approach using Remediate’s “Renovate” capabilities.
WhiteSource’s Renovate capabilities bring automated dependency updates to WhiteSource’s repository integrations. By enabling Renovate, more than 50 package manager formats can be detected automatically and dependencies within updated, including numerous Infrastructure as Code managers such as Terraform and Ansible.
The key advantages of automating dependency updates are:
Vulnerability fixes are often discretely released days or weeks prior to public disclosure, and you may be lucky enough to frequently update using Renovate prior to disclosure and avoid a vulnerability notification altogether
Even if projects are not completely up-to-date, being reasonably up-to-date means that applying vulnerability remediations is much lower risk and therefore can be done more quickly, lowering the average time-to-resolution for CVEs
For highly nested dependencies, such as Containers and Infrastructure as Code where vulnerable components may be deeply transitive, staying up-to-date (e.g. with Docker base image updates) is one of the best ways to stay secure anyway
Integration with WhiteSource Renovate
WhiteSource Renovate functionality can be enabled in WhiteSource Remediate via an option in the .whitesource configuration file.
With Renovate functionality enabled, Remediate will then raise PRs/MRs not only for vulnerable dependencies but also for outdated dependencies too.
Renovate is designed for users who aim to keep their dependencies up-to-date, primarily for the reasons of:
Keeping up with all bug-fixes from open source libraries
Reducing the risk of updating vulnerable versions in a hurry, because small jumps in versions are easier to test than large
Renovate itself is well-documented via its own documentation site. The Renovate docs are automatically generated based off the open source Renovate repository, so are unnecessary to duplicate here in full, however examples and clarifications will be provided below specifically for users of WhiteSource Remediate.
Renovate Configuration
Renovate supports a range of different filenames, however for WhiteSource Remediate integration only the .whitesource
configuration file is used. Renovate is disabled by default so enabled by setting remediateSettings.enableRenovate = true like so:
Code Block |
---|
{
"remediateSettings": {
"enableRenovate": true
}
} |
Any configuration you place within the remediateSettings
object will be used by Remediate similarly to how Renovate usually uses a renovate.json
configuration file. Therefore, if you have an existing renovate.json
file in a repository but are migrating to WhiteSource Remediate then you'd copy paste its contents inside remediateSettings
before removing the renovate.json
file.
Recommended Starting Config
If you are new to Renovate, we recommend you start with the config:base preset config, which enables functionality such as maximum two dependency update PRs per hour as well as grouping well-known monorepo dependencies together:
Code Block |
---|
{
"remediateSettings": {
"enableRenovate": true,
"extends": ["config:base"]
}
} |
What Happens When Remediations Are Available
It's useful to understand how Remediate works if you have Renovate enabled with updates available while vulnerability fixes are also required at the same time. If a package dependency needs vulnerability remediation then Remediate reads the list of fixed versions and determines the minimum version that solves all known CVEs. It then uses a package rule to enforce that the remediation PR/MR for that package does not propose to update to the latest and instead updates to the lowest version that can resolve all open CVEs for the package. If an existing PR/MR exists proposing an update to the latest version but the minimum fix is lower, the existing PR/MR may be auto-closed by Remediate and replaced with the minimum fix PR/MR instead. This is intentional so that (a) teams can focus on the high priority remediation PR/MR, and (b) remediations cause the least changes possible so that they are simpler to verify and test.
Common Configuration Options and Examples
Renovate is highly configurable with many options, so here are the most commonly used ones to take a look at first:
schedule: use this is you want to raise dependency update PRs during limited times, such as weeknights and weekends. Combine with timezone so that schedules can be written in your local time instead of UTC.
packageRules with groupName: matching multiple packages and assigning a groupName will mean they will be grouped into a single PR. This can be useful if certain packages must always be upgraded together, or if you wish to reduce the total number of PRs.
assignees and reviewers: use these fields to configure who is assigned or requested to review PRs (note: will apply to remediation PRs/MRs too)
automerge: enable this (ideally using packageRules) on dependencies you trust to be merged automatically by Remediate once they pass tests.
If you have questions about any particular configuration option or are looking for examples of its use, you may find it useful to search existing Issues in Renovate's Config Help Repository on GitHub.
Merge Confidence
Info |
---|
For more information Merge Confidence, see here. |
Merge Confidence is a beta feature for Renovate which embeds visual "badges" in Pull Requests to show statistics on upgrade age, adoption, compatibility and ultimately "confidence".
To enable it for Renovate within WhiteSource Remediate, add the following configuration within the remediateSettings
section of your .whitesource
file:
Code Block | ||
---|---|---|
| ||
{ "remediateSettings": { "enableRenovate": true, "prBodyDefinitionsextends": { "Age": "![age](https://badges.renovateapi.com/packages/npm/{{replace '/' '%2f' depName}}/{{{toVersion}}}/age-slim)", "Adoption": "![adoption](https://badges.renovateapi.com/packages/npm/{{replace '/' '%2f' depName}}/{{{toVersion}}}/adoption-slim)",["github>whitesource/merge-confidence:beta"] } } |
NOTE: the above configuration is supported only in version 21.2.2 or later of the Repo integration.
If you are using version 21.2.1 or earlier of the Repo integration, add the following configuration within the remediateSettings
section of your .whitesource
file:
Code Block | ||
---|---|---|
| ||
{ "remediateSettings": { "enableRenovate": true, "prBodyDefinitions": { "PassingAge": "![passingage](https://badges.renovateapi.com/packages/npm/{{replace '/' '%2f' depName}}/{{{toVersion}}}/compatibilityage-slim/{{{fromVersion}}})", "ConfidenceAdoption": "![confidenceadoption](https://badges.renovateapi.com/packages/npm/{{replace '/' '%2f' depName}}/{{{toVersion}}}/confidenceadoption-slim/{{{fromVersion}}})" , }, "packageRulesPassing": "![passing](https://badges.renovateapi.com/packages/npm/{{replace '/' { "datasources": [ '%2f' depName}}/{{{toVersion}}}/compatibility-slim/{{{fromVersion}}})", "mavenConfidence",: "npm", "pypi" ![confidence](https://badges.renovateapi.com/packages/npm/{{replace '/' '%2f' depName}}/{{{toVersion}}}/confidence-slim/{{{fromVersion}}})" }, ], "packageRules": [ "updateTypes": [ { "patchdatasources",: [ "minormaven", "npm", "pypi" ], "updateTypes": [ "patch", "minor", "major" ], "prBodyColumns": [ "Package", "Change", "Age", "Adoption", "Passing", "Confidence" ] } ] } } |
Remediate Worker Horizontal Scalability
To scale Remediate to allow it to utilize additional containers, in order to process multiple repositories concurrently, you can enable Remediate Worker Horizontal Scalability. In this mode, the Remediate “worker” logic (which processes repositories) is separated from the Remediate “server” logic (scheduler, job queue and webhook handling) in a many-to-one relationship.
The same Remediate Docker image is used for both Server and Worker functionality, as they are differentiated/configured using environment variables.
If you have already been running Remediate, you can keep that existing node as the new “Remediate Server”. All that is needed is to pass it the environment variable REMEDIATE_SERVER_ONLY: 'true'
and that will be enough for it to know it should be in server-only mode and not run any worker jobs itself. This container will still be the one that the W4D controller needs to reach, e.g. to pass on webhooks.
Next, you should configure one or more Remediate Worker containers. To do so, start up a Remediate image and configure the environment variable REMEDIATE_SERVER_URL
to point to the above Remediate Server’s API.
Here is a simple example of two Worker containers and one Server container using Docker Compose syntax:
Code Block |
---|
remediate-server: image: wss-remediate "prBodyColumns"restart: [always ports: "Package", "Change", "Age",- '8080:8080' volumes: - './conf/:/etc/usr/local/whitesource/conf/' "Adoption", environment: REMEDIATE_SERVER_ONLY: 'true' remediate-worker: "Passing", image: wss-remediate scale: 2 depends_on: "Confidence" - remediate-server restart: always ] volumes: }- './conf/:/etc/usr/local/whitesource/conf/' environment: ] } }REMEDIATE_SERVER_URL: http://remediate-server:8080 |