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

✨ Update documentation #203

Merged
merged 11 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 10 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
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ The Scorecards GitHub Action is free for all public repositories. Private reposi

________
[Installation](#installation)
- [Authentication](#authentication)
- [Supported triggers and repositories](#supported-triggers-and-repositories)
- [Authentication](#authentication-with-pat)
- [Workflow Setup](#workflow-setup)

[View Results](#view-results)
Expand All @@ -24,21 +25,30 @@ ________
## Installation
To install the Scorecards GitHub Action, you need to:

1) Create a Personal Access Token (PAT) for authentication and save the token value as a repository secret;
1. (Optional) If you want to use the [Branch-Protection](https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection) check, create a Personal Access Token (PAT) for authentication and save the token value as a repository secret;
laurentsimon marked this conversation as resolved.
Show resolved Hide resolved
laurentsimon marked this conversation as resolved.
Show resolved Hide resolved

(Note: If you have already installed Scorecards on your repository from the command line, you can reuse your existing PAT for the repository secret. If you no longer have access to the PAT, though, simply create a new one.)

3) Set up the workflow via the GitHub UI
2. Set up the workflow via the GitHub UI - see [Workflow Setup](#workflow-setup)

### Authentication
### Supported triggers and repositories
The following GitHub triggers are supported: `push`, `schedule` (default branch only).

The `pull_request` and `workflow_dispatch` triggers are experimental.

Running the Scorecard action on a fork repository is not supported.

GitHub Enterprise repositories are not supported.

### Authentication with PAT
1. [Create a Personal Access Token](https://github.com/settings/tokens/new?scopes=public_repo,read:org,read:repo_hook,read:discussion) with the following read permissions:
- Note: `Read-only token for OSSF Scorecard Action - myorg/myrepo` (Note: replace `myorg/myrepo` with the names of your organization and repository so you can keep track of your tokens.)
- Expiration: `No expiration`
- Scopes:
* `repo > public_repo`
* `admin:org > read:org`
* `admin:repo_hook > read:repo_hook`
* `write:discussion > read:discussion`
* `repo > public_repo` Required to read [Branch-Protection](https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection) settings.
* `admin:org > read:org` Optional: not used in current implementation.
* `admin:repo_hook > read:repo_hook` Optional: needed for the experimental [Webhook](https://github.com/ossf/scorecard/blob/main/docs/checks.md#webhooks) check.
* `write:discussion > read:discussion` Optional: not used in current implementation.

![image](/images/tokenscopes.png)

Expand Down Expand Up @@ -77,14 +87,15 @@ Then click "Add More Scanning Tools."

## View Results

To view a list of results from each Scorecards Action run, go to the Security tab and click "Code Scanning Alerts." Click on the individual alerts for more information, including remediation instructions. You will need to click "Show more" to expand the full remediation instructions.
The workflow is preconfigured to run on every repository contribution. After making a code change, you can view a list of results by going to the Security tab and clicking "Code Scanning Alerts" (it can take a couple minutes for the run to complete and the results to show up). Click on the individual alerts for more information, including remediation instructions. You will need to click "Show more" to expand the full remediation instructions.

![image](/images/remediation.png)

### Verify Runs
The workflow is preconfigured to run on every repository contribution.

To verify that the Action is running successfully, click the repository's Actions tab to see the status of all recent workflow runs.
To verify that the Action is running successfully, click the repository's Actions tab to see the status of all recent workflow runs. You may
click on it to see the logs, which can help you troubleshoot if the run failed.
laurentsimon marked this conversation as resolved.
Show resolved Hide resolved

![image](/images/actionconfirm.png)

Expand All @@ -93,7 +104,7 @@ If the run has failed, the most likely reason is an authentication failure. Conf

If you install Scorecard on a repository owned by an organization that uses [SAML SSO](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/about-authentication-with-saml-single-sign-on) or if you see `403 Resource protected by organization SAML enforcement` in the logs, be sure to [enable SSO](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on) for your PAT token (see [Authentication](#authentication)).

If the PAT is saved as an encrypted secret and the run is still failing, confirm that you have not made any changes to the workflow yaml file that affected the syntax. Review the [workflow example](#workflow-example) and reset to the default values if necessary.
If the PAT is saved as an encrypted secret and the run is still failing, confirm that you have not made any changes to the workflow yaml file that affected the syntax. Review the [workflow example](#workflow-example) and reset to the default values if necessary.

## Manual Action Setup

Expand Down Expand Up @@ -161,7 +172,7 @@ jobs:
with:
results_file: results.sarif
results_format: sarif
# Read-only PAT token. To create it,
# (Optional) Read-only PAT token for Branch-Protection check. To create it,
# follow the steps in https://github.com/ossf/scorecard-action#pat-token-creation.
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see
Expand Down
1 change: 0 additions & 1 deletion options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ func TestNew(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

os.Setenv(EnvGithubAuthToken, testToken)
defer os.Unsetenv(EnvGithubAuthToken)

Expand Down