Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Sonatype Lift as a dependency update tool, doc upgrade #2328

Merged
merged 4 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions checks/dependency_update_tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestDependencyUpdateTool(t *testing.T) {
SearchCommits: []clients.Commit{{Committer: clients.User{ID: 111111111}}},
CallSearchCommits: 1,
expected: scut.TestReturn{
NumberOfWarn: 2,
NumberOfWarn: 1,
},
},
{
Expand All @@ -87,7 +87,7 @@ func TestDependencyUpdateTool(t *testing.T) {
SearchCommits: []clients.Commit{},
CallSearchCommits: 1,
expected: scut.TestReturn{
NumberOfWarn: 2,
NumberOfWarn: 1,
},
},

Expand Down
8 changes: 2 additions & 6 deletions checks/evaluation/dependency_update_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ func DependencyUpdateTool(name string, dl checker.DetailLogger,
// Apply the policy evaluation.
if r.Tools == nil || len(r.Tools) == 0 {
dl.Warn(&checker.LogMessage{
Text: `dependabot config file not detected in source location.
We recommend setting this configuration in code so it can be easily verified by others.`,
})
dl.Warn(&checker.LogMessage{
Text: `renovatebot config file not detected in source location.
We recommend setting this configuration in code so it can be easily verified by others.`,
Text: `Config file not detected in source location for dependabot, renovatebot, Sonatype Lift, or
PyUp (Python). We recommend setting this configuration in code so it can be easily verified by others.`,
})
return checker.CreateMinScoreResult(name, "no update tool detected")
}
Expand Down
2 changes: 1 addition & 1 deletion checks/evaluation/dependency_update_tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestDependencyUpdateTool(t *testing.T) {
err: false,
expected: scut.TestReturn{
Score: 0,
NumberOfWarn: 2,
NumberOfWarn: 1,
},
},
{
Expand Down
13 changes: 13 additions & 0 deletions checks/raw/dependency_update_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ var checkDependencyFileExists fileparser.DoWhileTrueOnFilename = func(name strin
},
},
})
case ".lift.toml", ".lift/config.toml":
*ptools = append(*ptools, checker.Tool{
Name: "Sonatype Lift",
URL: asPointer("https://lift.sonatype.com"),
Desc: asPointer("Automated dependency updates. Multi-platform and multi-language."),
Files: []checker.File{
{
Path: name,
Type: checker.FileTypeSource,
Offset: checker.OffsetDefault,
},
},
})
default:
// Continue iterating.
return true, nil
Expand Down
18 changes: 18 additions & 0 deletions checks/raw/dependency_update_tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ func Test_checkDependencyFileExists(t *testing.T) {
want: false,
wantErr: false,
},
{
name: ".lift.toml",
args: args{
name: ".lift.toml",
data: &[]checker.Tool{},
},
want: false,
wantErr: false,
},
{
name: ".lift/config.toml",
args: args{
name: ".lift/config.toml",
data: &[]checker.Tool{},
},
want: false,
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
Expand Down
15 changes: 8 additions & 7 deletions docs/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,12 @@ The highest score is awarded when all workflows avoid the dangerous code pattern
Risk: `High` (possibly vulnerable to attacks on known flaws)

This check tries to determine if the project uses a dependency update tool,
specifically [dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates) or
[renovatebot](https://docs.renovatebot.com/configuration-options/). Out-of-date
dependencies make a project vulnerable to known flaws and prone to attacks.
specifically one of:
- [dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates)
- [renovatebot](https://docs.renovatebot.com/configuration-options/)
- [Sonatype Lift](https://help.sonatype.com/lift/getting-started)
- [PyUp](https://docs.pyup.io/docs) (Python)
Out-of-date dependencies make a project vulnerable to known flaws and prone to attacks.
These tools automate the process of updating dependencies by scanning for
outdated or insecure requirements, and opening a pull request to update them if
found.
Expand All @@ -310,7 +313,7 @@ low score is therefore not a definitive indication that the project is at risk.


**Remediation steps**
- Signup for automatic dependency updates with [dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates) or [renovatebot](https://docs.renovatebot.com/configuration-options/) and place the config file in the locations that are recommended by these tools. Due to https://github.com/dependabot/dependabot-core/issues/2804 Dependabot can be enabled for forks where security updates have ever been turned on so projects maintaining stable forks should evaluate whether this behavior is satisfactory before turning it on.
- Signup for automatic dependency updates with one of the previously listed dependency update tools and place the config file in the locations that are recommended by these tools. Due to https://github.com/dependabot/dependabot-core/issues/2804 Dependabot can be enabled for forks where security updates have ever been turned on so projects maintaining stable forks should evaluate whether this behavior is satisfactory before turning it on.
- Unlike dependabot, renovatebot has support to migrate dockerfiles' dependencies from version pinning to hash pinning via the [pinDigests setting](https://docs.renovatebot.com/configuration-options/#pindigests) without aditional manual effort.

## Fuzzing
Expand Down Expand Up @@ -478,9 +481,7 @@ dependencies using the [GitHub dependency graph](https://docs.github.com/en/code
- If your project is producing an application and the package manager supports lock files (e.g. `package-lock.json` for npm), make sure to check these in the source code as well. These files maintain signatures for the entire dependency tree and saves from future exploitation in case the package is compromised.
- For Dockerfiles used in building and releasing your project, pin dependencies by hash. See [Dockerfile](https://github.com/ossf/scorecard/blob/main/cron/internal/worker/Dockerfile) for example. If you are using a manifest list to support builds across multiple architectures, you can pin to the manifest list hash instead of a single image hash. You can use a tool like [crane](https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md) to obtain the hash of the manifest list like in this [example](https://github.com/ossf/scorecard/issues/1773#issuecomment-1076699039).
- For GitHub workflows used in building and releasing your project, pin dependencies by hash. See [main.yaml](https://github.com/ossf/scorecard/blob/f55b86d6627cc3717e3a0395e03305e81b9a09be/.github/workflows/main.yml#L27) for example. To determine the permissions needed for your workflows, you may use [StepSecurity's online tool](https://app.stepsecurity.io/) by ticking the "Pin actions to a full length commit SHA". You may also tick the "Restrict permissions for GITHUB_TOKEN" to fix issues found by the Token-Permissions check.
- To help update your dependencies after pinning them, use tools such as
Github's [dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/)
or [renovate bot](https://github.com/renovatebot/renovate).
- To help update your dependencies after pinning them, use tools such as those listed for the dependency update tool check.

## SAST

Expand Down
17 changes: 8 additions & 9 deletions docs/checks/internal/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ checks:
Risk: `High` (possibly vulnerable to attacks on known flaws)

This check tries to determine if the project uses a dependency update tool,
specifically [dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates) or
[renovatebot](https://docs.renovatebot.com/configuration-options/). Out-of-date
dependencies make a project vulnerable to known flaws and prone to attacks.
specifically one of:
naveensrinivasan marked this conversation as resolved.
Show resolved Hide resolved
- [dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates)
- [renovatebot](https://docs.renovatebot.com/configuration-options/)
- [Sonatype Lift](https://help.sonatype.com/lift/getting-started)
- [PyUp](https://docs.pyup.io/docs) (Python)
Out-of-date dependencies make a project vulnerable to known flaws and prone to attacks.
These tools automate the process of updating dependencies by scanning for
outdated or insecure requirements, and opening a pull request to update them if
found.
Expand All @@ -75,9 +78,7 @@ checks:

remediation:
- >-
Signup for automatic dependency updates with
[dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates) or
[renovatebot](https://docs.renovatebot.com/configuration-options/) and place
Signup for automatic dependency updates with one of the previously listed dependency update tools and place
the config file in the locations that are recommended by these tools. Due to
https://github.com/dependabot/dependabot-core/issues/2804 Dependabot can
be enabled for forks where security updates have ever been turned on so projects
Expand Down Expand Up @@ -506,9 +507,7 @@ checks:
the "Pin actions to a full length commit SHA". You may also tick the "Restrict permissions for GITHUB_TOKEN" to fix issues found
by the Token-Permissions check.
- >-
To help update your dependencies after pinning them, use tools such as
Github's [dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/)
or [renovate bot](https://github.com/renovatebot/renovate).
To help update your dependencies after pinning them, use tools such as those listed for the dependency update tool check.
SAST:
risk: Medium
tags: supply-chain, security, testing
Expand Down