You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-24Lines changed: 38 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,17 +10,9 @@ The Scorecards GitHub Action is free for all public repositories. Private reposi
10
10
11
11
Starting from scorecard-action:v2, `GITHUB_TOKEN` permissions or job permissions needs to include
12
12
`id-token: write` for `publish_results: true`. This is needed to access GitHub's
13
-
OIDC token which verifies the authenticity of the result when publishing it.
13
+
OIDC token which verifies the authenticity of the result when publishing it. See details [here](#publishing-results)
14
14
15
-
scorecard-action:v2 has a new requirement for the job running the ossf/scorecard-action step. The steps running in this job must belong to this approved list of GitHub actions:
16
-
- "actions/checkout"
17
-
- "actions/upload-artifact"
18
-
- "github/codeql-action/upload-sarif"
19
-
- "ossf/scorecard-action"
20
-
21
-
If you are using custom steps in the job, it may fail.
22
-
We understand that this is restrictive, but currently it's necessary to ensure the integrity of the results that we publish, since GitHub workflow steps run in the same environment as the job they belong to.
23
-
If possible, we will work on making this feature more flexible so we can drop this requirement in the future.
15
+
If publishing results, scorecard-action:v2 also imposes new requirements on both the workflow and the job running the `ossf/scorecard-action` step. For full details see [here](#workflow-restrictions).
24
16
________
25
17
[Personal Access Token (PAT) Requirements and Risks](#personal-access-token-pat-requirements-and-risks)
26
18
@@ -38,6 +30,7 @@ ________
38
30
[Manual Action Setup](#manual-action-setup)
39
31
-[Inputs](#inputs)
40
32
-[Publishing Results](#publishing-results)
33
+
-[Workflow Restrictions](#workflow-restrictions)
41
34
-[Uploading Artifacts](#uploading-artifacts)
42
35
-[Workflow Example](#workflow-example)
43
36
________
@@ -169,15 +162,38 @@ First, [create a new file](https://docs.github.com/en/repositories/working-with-
169
162
|`result_file`| yes | The file that contains the results. |
170
163
|`result_format`| yes | The format in which to store the results [json \| sarif]. For GitHub's scanning dashboard, select `sarif`. |
171
164
|`repo_token`| no | PAT token with write repository access. Follow [these steps](#authentication-with-pat) to create it. |
172
-
|`publish_results`| recommended | This will allow you to display a badge on your repository to show off your hard work (release scheduled for Q2'22). See details [here](#publishing-results).|
165
+
|`publish_results`| recommended | This will allow you to display a badge on your repository to show off your hard work. See details [here](#publishing-results).|
173
166
174
167
### Publishing Results
175
168
The Scorecard team runs a weekly scan of public GitHub repositories in order to track
176
169
the overall security health of the open source ecosystem. The results of the scans are [publicly
Setting `publish_results: true` replaces the results of the team's weekly scans with your own scan results,
179
172
helping us scale by cutting down on repeated workflows and GitHub API requests.
180
-
This option is also needed to enable badges on the repository (release scheduled for Q2'22).
173
+
This option is also needed to enable badges on the repository.
174
+
175
+
### Workflow Restrictions
176
+
177
+
If [publishing results](#publishing-results), our API [enforces certain rules](https://github.com/ossf/scorecard-webapp/blob/9c2f66d5f6ff56ca4a4ac2fba6ec8dcc5379d31c/app/server/post_results.go#L184-L187) on the producing workflow, which may reject the results and cause the Scorecard Action run to fail.
178
+
We understand that this is restrictive, but currently it's necessary to ensure the integrity of our API dataset, since GitHub workflow steps run in the same environment as the job they belong to.
179
+
If possible, we will work on making this feature more flexible so we can drop this requirement in the future.
180
+
181
+
#### Global workflow restrictions
182
+
183
+
* The workflow can't contain top level env vars or defaults.
184
+
* No workflow level write permissions.
185
+
* Only the job with `ossf/scorecard-action` can use `id-token: write` permissions.
186
+
187
+
#### Restrictions on the job containing `ossf/scorecard-action`
188
+
* No job level env vars or defaults.
189
+
* No containers or services
190
+
* The job should run on one of the [Ubuntu hosted runners](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners)
191
+
* The steps running in this job must belong to this approved list of GitHub actions.
192
+
* "actions/checkout"
193
+
* "actions/upload-artifact"
194
+
* "github/codeql-action/upload-sarif"
195
+
* "ossf/scorecard-action"
196
+
* "step-security/harden-runner"
181
197
182
198
### Uploading Artifacts
183
199
The Scorecards Action uses the [artifact uploader action](https://github.com/actions/upload-artifact) to upload results in SARIF format to the Actions tab. These results are available to anybody for five days after the run to help with debugging. To disable the upload, comment out the `Upload Artifact` value in the Workflow Example.
@@ -187,7 +203,7 @@ Note: if you disable this option, the results of the Scorecards Action run will
187
203
### Workflow Example
188
204
189
205
```yml
190
-
name: Scorecards supply-chain security
206
+
name: Scorecard analysis workflow
191
207
on:
192
208
# Only the default branch is supported.
193
209
branch_protection_rule:
@@ -202,24 +218,22 @@ permissions: read-all
202
218
203
219
jobs:
204
220
analysis:
205
-
name: Scorecards analysis
221
+
name: Scorecard analysis
206
222
runs-on: ubuntu-latest
207
223
permissions:
208
-
# Needed to upload the results to code-scanning dashboard.
224
+
# Needed if using Code scanning alerts
209
225
security-events: write
210
-
#Used to receive a badge. (Upcoming feature)
226
+
#Needed for GitHub OIDC token if publish_results is true
0 commit comments