Security Health Metrics For Open Source
Motivation
A short motivational video clip to inspire us: https://youtu.be/rDMMYT3vkTk “You passed! All D’s … and an A!”
Goals
Automate analysis and trust decisions on the security posture of open source projects.
Use this data to proactively improve the security posture of the critical projects the world depends on.
Scorecard Checks
The following checks are all run against the target project by default:
Name | Description |
---|---|
Active | Did the project get any commits in the last 90 days? |
Automatic-Dependency-Update | Does the project use tools to automatically update its dependencies? |
Binary-Artifacts | Is the project free of checked-in binaries? |
Branch-Protection | Does the project use Branch Protection ? |
CI-Tests | Does the project run tests in CI, e.g. GitHub Actions, Prow? |
CII-Best-Practices | Does the project have a CII Best Practices Badge? |
Code-Review | Does the project require code review before code is merged? |
Contributors | Does the project have contributors from at least two different organizations? |
Fuzzing | Does the project use fuzzing tools, e.g. OSS-Fuzz? |
Frozen-Deps | Does the project declare and freeze dependencies? |
Packaging | Does the project build and publish official packages from CI/CD, e.g. GitHub Publishing ? |
Pull-Requests | Does the project use Pull Requests for all code changes? |
SAST | Does the project use static code analysis tools, e.g. CodeQL, SonarCloud? |
Security-Policy | Does the project contain a security policy? |
Signed-Releases | Does the project cryptographically sign releases? |
Signed-Tags | Does the project cryptographically sign release tags? |
Token-Permissions | Does the project declare GitHub workflow tokens as read only? |
Vulnerabilities | Does the project have unfixed vulnerabilities? Uses the OSV service. |
To see detailed information about each check and remediation steps, check out the checks documentation page.
Usage
Using repository URL
The program can run using just one argument, the URL of the repo:
$ go build
$ ./scorecard --repo=github.com/kubernetes/kubernetes
Starting [Signed-Tags]
Starting [Automatic-Dependency-Update]
Starting [Frozen-Deps]
Starting [Fuzzing]
Starting [Pull-Requests]
Starting [Branch-Protection]
Starting [Code-Review]
Starting [SAST]
Starting [Contributors]
Starting [Signed-Releases]
Starting [Packaging]
Starting [Token-Permissions]
Starting [Security-Policy]
Starting [Active]
Starting [Binary-Artifacts]
Starting [CI-Tests]
Starting [CII-Best-Practices]Finished [Contributors]
Finished [Signed-Releases]
Finished [Active]
Finished [Binary-Artifacts]
Finished [CI-Tests]
Finished [CII-Best-Practices]
Finished [Packaging]
Finished [Token-Permissions]
Finished [Security-Policy]
Finished [Automatic-Dependency-Update]
Finished [Frozen-Deps]
Finished [Fuzzing]
Finished [Pull-Requests]
Finished [Signed-Tags]
Finished [Branch-Protection]
Finished [Code-Review]
Finished [SAST]
RESULTS
-------
Repo: github.com/kubernetes/kubernetes
Active: Pass 10
Automatic-Dependency-Update: Fail 3
Binary-Artifacts: Pass 10
Branch-Protection: Fail 0
CI-Tests: Pass 10
CII-Best-Practices: Pass 10
Code-Review: Pass 10
Contributors: Pass 10
Frozen-Deps: Fail 10
Fuzzing: Pass 10
Packaging: Fail 0
Pull-Requests: Pass 10
SAST: Fail 10
Security-Policy: Fail 5
Signed-Releases: Fail 10
Signed-Tags: Fail 10
Token-Permissions: Pass 10
For more details why a check fails, use the --show-details
option:
./scorecard --repo=github.com/kubernetes/kubernetes --checks Frozen-Deps --show-details
Starting [Frozen-Deps]
Finished [Frozen-Deps]RESULTS
-------
Repo: github.com/kubernetes/kubernetes
Frozen-Deps: Fail 10
...
!! frozen-deps/docker - cluster/addons/fluentd-elasticsearch/es-image/Dockerfile has non-pinned dependency 'golang:1.16.5'
...
!! frozen-deps/fetch-execute - cluster/gce/util.sh is fetching and executing non-pinned program 'curl https://sdk.cloud.google.com | bash'
...
!! frozen-deps/fetch-execute - hack/jenkins/benchmark-dockerized.sh is fetching an non-pinned dependency 'GO111MODULE=on go install github.com/cespare/prettybench'
...
Using a Package manager
scorecard has an option to provide either --npm
/ --pypi
/ --rubygems
package name and it would run the checks on the corresponding GitHub source code.
For example:
./scorecard --npm=angular
Starting [Active]
Starting [Branch-Protection]
Starting [CI-Tests]
Starting [CII-Best-Practices]
Starting [Code-Review]
Starting [Contributors]
Starting [Frozen-Deps]
Starting [Fuzzing]
Starting [Packaging]
Starting [Pull-Requests]
Starting [SAST]
Starting [Security-Policy]
Starting [Signed-Releases]
Starting [Signed-Tags]
Finished [Signed-Releases]
Finished [Fuzzing]
Finished [CII-Best-Practices]
Finished [Security-Policy]
Finished [CI-Tests]
Finished [Packaging]
Finished [SAST]
Finished [Code-Review]
Finished [Branch-Protection]
Finished [Frozen-Deps]
Finished [Signed-Tags]
Finished [Active]
Finished [Pull-Requests]
Finished [Contributors]RESULTS
-------
Active: Fail 10
Branch-Protection: Fail 0
CI-Tests: Pass 10
CII-Best-Practices: Fail 10
Code-Review: Pass 10
Contributors: Pass 10
Frozen-De ps: Fail 0
Fuzzing: Fail 10
Packaging: Fail 0
Pull-Requests: Fail 9
SAST: Fail 10
Security-Policy: Pass 10
Signed-Releases: Fail 0
Signed-Tags: Fail 10
Running specific checks
To use a particular check(s), add the --checks
argument with a list of check names.
For example, --checks=CI-Tests,Code-Review
.
Authentication
Before running Scorecard, you need to, either:
<div class="highlight highlight-source-shell position-relative" data-snippet-clipboard-copy-content="# For posix platforms, e.g. linux, mac: export GITHUB_AUTH_TOKEN= # For windows: set GITHUB_AUTH_TOKEN= “>
# For posix platforms, e.g. linux, mac:
export GITHUB_AUTH_TOKEN=<your access token># For windows:
set GITHUB_AUTH_TOKEN=<your access token>