Skip to content

Commit b9b32d3

Browse files
committed
Merge branch 'main' into int
2 parents 01a8c09 + b6ea952 commit b9b32d3

File tree

3 files changed

+115
-35
lines changed

3 files changed

+115
-35
lines changed

.github/workflows/scorecards.yml

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,72 @@
1-
name: Scorecards supply-chain security
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
26
on:
3-
# Only the default branch is supported.
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
49
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
512
schedule:
6-
# Weekly on Saturdays.
7-
- cron: '30 1 * * 6'
13+
- cron: '33 16 * * 3'
814
push:
9-
branches: [ main, master ]
15+
branches: [ "main" ]
1016

1117
# Declare default permissions as read only.
1218
permissions: read-all
1319

1420
jobs:
1521
analysis:
16-
name: Scorecards analysis
22+
name: Scorecard analysis
1723
runs-on: ubuntu-latest
1824
permissions:
1925
# Needed to upload the results to code-scanning dashboard.
2026
security-events: write
21-
# Used to receive a badge. (Upcoming feature)
27+
# Needed to publish results and get a badge (see publish_results below).
2228
id-token: write
23-
actions: read
24-
contents: read
25-
29+
# Uncomment the permissions below if installing in a private repository.
30+
# contents: read
31+
# actions: read
32+
2633
steps:
2734
- name: "Checkout code"
28-
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
35+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
2936
with:
3037
persist-credentials: false
3138

3239
- name: "Run analysis"
33-
uses: ossf/scorecard-action@e363bfca00e752f91de7b7d2a77340e2e523cb18 # tag=v1.1.1
40+
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
3441
with:
3542
results_file: results.sarif
3643
results_format: sarif
37-
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
44+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
3845
# - you want to enable the Branch-Protection check on a *public* repository, or
39-
# - you are installing Scorecards on a *private* repository
46+
# - you are installing Scorecard on a *private* repository
4047
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
41-
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
48+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
4249

43-
# Publish the results for public repositories to enable scorecard badges. For more details, see
44-
# https://github.com/ossf/scorecard-action#publishing-results.
45-
# For private repositories, `publish_results` will automatically be set to `false`, regardless
46-
# of the value entered here.
50+
# Public repositories:
51+
# - Publish results to OpenSSF REST API for easy access by consumers
52+
# - Allows the repository to include the Scorecard badge.
53+
# - See https://github.com/ossf/scorecard-action#publishing-results.
54+
# For private repositories:
55+
# - `publish_results` will always be set to `false`, regardless
56+
# of the value entered here.
4757
publish_results: true
4858

4959
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
5060
# format to the repository Actions tab.
5161
- name: "Upload artifact"
52-
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # tag=v3.0.0
62+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
5363
with:
5464
name: SARIF file
5565
path: results.sarif
5666
retention-days: 5
57-
67+
5868
# Upload the results to GitHub's code scanning dashboard.
5969
- name: "Upload to code-scanning"
60-
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # tag=v1.0.26
70+
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
6171
with:
6272
sarif_file: results.sarif

README.md

Lines changed: 83 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ To create an instance of Secure Workflows, deploy _cloudformation/ecr.yml_ and _
5252
## Functionality
5353

5454
1. [Automatically set minimum GITHUB_TOKEN permissions](#1-automatically-set-minimum-github_token-permissions)
55-
2. [Pin Actions to a full length commit SHA](#2-pin-actions-to-a-full-length-commit-sha)
56-
3. [Add Harden-Runner GitHub Action to each job](#3-add-harden-runner-github-action-to-each-job)
57-
4. [Add or update Dependabot configuration](#4-add-or-update-dependabot-configuration)
58-
5. [Add CodeQL workflow (SAST)](#5-add-codeql-workflow-sast)
55+
2. [Add Harden-Runner GitHub Action to each job](#2-add-harden-runner-github-action-to-each-job)
56+
3. [Pin Actions to a full length commit SHA](#3-pin-actions-to-a-full-length-commit-sha)
57+
4. [Pin image tags to digests in Dockerfiles](#4-pin-image-tags-to-digests-in-dockerfiles)
58+
5. [Add or update Dependabot configuration](#5-add-or-update-dependabot-configuration)
59+
6. [Add CodeQL workflow (SAST)](#6-add-codeql-workflow-sast)
60+
7. [Add Dependency review workflow](#7-add-dependency-review-workflow)
61+
8. [Add OpenSSF Scorecard workflow](#8-add-openssf-scorecard-workflow)
5962

6063
### 1. Automatically set minimum GITHUB_TOKEN permissions
6164

@@ -79,7 +82,25 @@ In this pull request, minimum permissions are set automatically for the GITHUB_T
7982
- It looks up the permissions needed by each Action in your workflow and sums the permissions up to come up with a final recommendation
8083
- If you are the owner of a GitHub Action, please [contribute to the knowledge base](https://github.com/step-security/secure-repo/blob/main/knowledge-base/actions/README.md)
8184

82-
### 2. Pin Actions to a full length commit SHA
85+
### 2. Add Harden-Runner GitHub Action to each job
86+
87+
#### Why is this needed?
88+
89+
[Harden-Runner GitHub Action](https://github.com/step-security/harden-runner) installs a security agent on the Github-hosted runner to prevent exfiltration of credentials, monitor the build process, and detect compromised dependencies.
90+
91+
#### Before and After the fix
92+
93+
**Pull request example**: https://github.com/python-attrs/attrs/pull/1034
94+
95+
This pull request adds the Harden Runner GitHub Action to the workflow file.
96+
97+
<p align="center"><img src="images/harden-runner-example.png" width="600" alt="Screenshot of Harden-Runner GitHub Action added to a workflow" /></p>
98+
99+
#### How does Secure-Repo fix this issue?
100+
101+
Secure-Repo updates the YAML file and adds [Harden-Runner GitHub Action](https://github.com/step-security/harden-runner) as the first step to each job.
102+
103+
### 3. Pin Actions to a full length commit SHA
83104

84105
#### Why is this needed?
85106

@@ -104,25 +125,32 @@ In this pull request, the workflow file has the GitHub Actions tags pinned autom
104125
- Secure-Repo automates the process of getting the commit SHA for each mutable Action version or Docker image tag
105126
- It does this by using GitHub and Docker registry APIs
106127

107-
### 3. Add Harden-Runner GitHub Action to each job
128+
### 4. Pin image tags to digests in Dockerfiles
108129

109130
#### Why is this needed?
110131

111-
[Harden-Runner GitHub Action](https://github.com/step-security/harden-runner) installs a security agent on the Github-hosted runner to prevent exfiltration of credentials, monitor the build process, and detect compromised dependencies.
132+
- Docker tags are mutable, so use digests in place of tags when pulling images
133+
- If the tag changes you will not have a chance to review the change before it gets used
134+
- OpenSSF Scorecard [recommends pinning image tags for Dockerfiles used in building and releasing your project](https://github.com/ossf/scorecard/blob/main/docs/checks.md#pinned-dependencies).
112135

113136
#### Before and After the fix
114137

115-
**Pull request example**: https://github.com/python-attrs/attrs/pull/1034
138+
Before the fix, your Dockerfile uses image:tag, e.g. `rust:latest`
116139

117-
This pull request adds the Harden Runner GitHub Action to the workflow file.
140+
After the fix, Secure-Repo pins each docker image to an immutable checksum, e.g. `rust:latest@sha256:02a53e734724bef4a58d856c694f826aa9e7ea84353516b76d9a6d241e9da60e`.
118141

119-
<p align="center"><img src="images/harden-runner-example.png" width="600" alt="Screenshot of Harden-Runner GitHub Action added to a workflow" /></p>
142+
**Pull request example**: https://github.com/fleetdm/fleet/pull/10205
143+
144+
In this pull request, the Docker file has tags pinned automatically to their checksum.
145+
146+
<p align="center"><img src="images/pin-docker-example.png" alt="Screenshot of docker image pinned to checksum" width="600" /></p>
120147

121148
#### How does Secure-Repo fix this issue?
122149

123-
Secure-Repo updates the YAML file and adds [Harden-Runner GitHub Action](https://github.com/step-security/harden-runner) as the first step to each job.
150+
- Secure-Repo automates the process of getting the checksum for each Docker image tag
151+
- It does this by using Docker registry APIs
124152

125-
### 4. Add or update Dependabot configuration
153+
### 5. Add or update Dependabot configuration
126154

127155
#### Why is this needed?
128156

@@ -145,7 +173,7 @@ This pull request updates the Dependabot configuration.
145173

146174
Secure-Repo updates the `dependabot.yml` file to add missing ecosystems. For example, if the Dependabot configuration updates npm packages but not GitHub Actions, it is updated to add the GitHub Actions ecosystem.
147175

148-
### 5. Add CodeQL workflow (SAST)
176+
### 6. Add CodeQL workflow (SAST)
149177

150178
#### Why is this needed?
151179

@@ -165,6 +193,48 @@ This pull request adds CodeQL to the list of workflows.
165193

166194
Secure-Repo has a [workflow-templates](https://github.com/step-security/secure-repo/tree/main/workflow-templates) folder. This folder has the default CodeQL workflow, which gets added as part of the pull request. The placeholder for languages in the template gets replaced with languages for your GitHub repository.
167195

196+
### 7. Add Dependency review workflow
197+
198+
#### Why is this needed?
199+
200+
- The Dependency review workflow scans for vulnerable versions of dependencies introduced by package version changes in pull requests, and warns you about the associated security vulnerabilities.
201+
- This gives you better visibility of what's changing in a pull request, and helps prevent vulnerabilities being added to your repository.
202+
203+
#### Before and After the fix
204+
205+
Before the fix, you do not have a dependency review workflow.
206+
207+
After the fix, a `depdendency-review.yml` GitHub Actions workflow gets added to your project.
208+
209+
**Pull request example**: https://github.com/input-output-hk/catalyst-core/pull/286
210+
211+
This pull request adds GitHub's `actions/dependency-review-action` workflow to the list of workflows.
212+
213+
#### How does Secure-Repo fix this issue?
214+
215+
Secure-Repo has a [workflow-templates](https://github.com/step-security/secure-repo/tree/main/workflow-templates) folder. This folder has the default dependency review workflow, which gets added as part of the pull request.
216+
217+
### 8. Add OpenSSF Scorecard workflow
218+
219+
#### Why is this needed?
220+
221+
- OpenSSF Scorecard is an automated tool that assesses a number of important heuristics ("checks") associated with software security and assigns each check a score of 0-10.
222+
- You can use these scores to understand specific areas to improve in order to strengthen the security posture of your project.
223+
224+
#### Before and After the fix
225+
226+
Before the fix, you do not have a OpenSSF Scorecard workflow.
227+
228+
After the fix, a `scorecards.yml` GitHub Actions workflow gets added to your project.
229+
230+
**Pull request example**: https://github.com/mcornick/clilol/pull/14
231+
232+
This pull request adds OpenSSF Scorecard to the list of workflows.
233+
234+
#### How does Secure-Repo fix this issue?
235+
236+
Secure-Repo has a [workflow-templates](https://github.com/step-security/secure-repo/tree/main/workflow-templates) folder. This folder has the default Scorecard workflow, which gets added as part of the pull request.
237+
168238
## Contributing
169239

170240
Contributions are welcome!

images/pin-docker-example.png

87.3 KB
Loading

0 commit comments

Comments
 (0)