Skip to content

Commit 49449f8

Browse files
committed
Add scorecard and dependency-review workflows
https://issues.redhat.com/browse/HACBS-2534 Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
1 parent 4a270c4 commit 49449f8

3 files changed

Lines changed: 95 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ files](https://docs.github.com/en/communities/setting-up-your-project-for-health
1111
* [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
1212
* [CONTRIBUTING.md](./CONTRIBUTING.md)
1313
* [SECURITY.md](./SECURITY.md)
14+
15+
## Required Workflows
16+
17+
The [workflows](./workflows) defined in this repository are meant to be used by other repositories
18+
within this organization. They should be included in a [repository
19+
ruleset](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets)
20+
at the organization level. This is not done automatically. When adding a new workflow, be sure to
21+
also update the corresponding ruleset
22+
[here](https://github.com/organizations/enterprise-contract/settings/rules).

workflows/dependency-review.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# This workflow will scan dependency manifest files that change as part of a Pull Request,
3+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
4+
# Once installed, if the workflow run is marked as required,
5+
# PRs introducing known-vulnerable packages will be blocked from merging.
6+
name: 'Dependency Review'
7+
"on": [pull_request]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
dependency-review:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Harden Runner
17+
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
18+
with:
19+
egress-policy: audit
20+
disable-telemetry: true
21+
22+
- name: 'Checkout Repository'
23+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
24+
- name: 'Dependency Review'
25+
uses: actions/dependency-review-action@6c5ccdad469c9f8a2996bfecaec55a631a347034 # v3.1.0

workflows/scorecard.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Scorecard supply-chain security
3+
"on":
4+
# For Branch-Protection check. Only the default branch is supported. See
5+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
6+
branch_protection_rule:
7+
# To guarantee Maintained check is occasionally updated. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
9+
schedule:
10+
- cron: '20 7 * * 2'
11+
push:
12+
branches: ["main"]
13+
14+
permissions: read-all
15+
16+
jobs:
17+
analysis:
18+
name: Scorecard analysis
19+
runs-on: ubuntu-latest
20+
permissions:
21+
# Needed to upload the results to code-scanning dashboard.
22+
security-events: write
23+
# Needed to publish results and get a badge (see publish_results below).
24+
id-token: write
25+
contents: read
26+
actions: read
27+
28+
steps:
29+
- name: Harden Runner
30+
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
31+
with:
32+
egress-policy: audit
33+
disable-telemetry: true
34+
35+
- name: "Checkout code"
36+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
37+
with:
38+
persist-credentials: false
39+
40+
- name: "Run analysis"
41+
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
42+
with:
43+
results_file: results.sarif
44+
results_format: sarif
45+
# https://github.com/ossf/scorecard-action#publishing-results.
46+
publish_results: true
47+
48+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run
49+
# results in SARIF format to the repository Actions tab.
50+
- name: "Upload artifact"
51+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
52+
with:
53+
name: SARIF file
54+
path: results.sarif
55+
retention-days: 5
56+
57+
# Upload the results to GitHub's code scanning dashboard.
58+
- name: "Upload to code-scanning"
59+
uses: github/codeql-action/upload-sarif@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
60+
with:
61+
sarif_file: results.sarif

0 commit comments

Comments
 (0)