-
Notifications
You must be signed in to change notification settings - Fork 16
Add OSSF Scorecard workflow to gh-workflows module #651
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
| # Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/gh-workflows/base/.github/workflows/scorecards.yaml instead. | ||
|
|
||
| name: Scorecards supply-chain security | ||
| on: | ||
| # Only the default branch is supported. | ||
| branch_protection_rule: | ||
| push: | ||
| # We don't have a consistent name on our default branches, so include both variants for now. | ||
| branches: ["main", "master"] | ||
|
|
||
| # Declare default permissions as read only. | ||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| analysis: | ||
| name: Scorecards analysis | ||
| runs-on: ubuntu-latest | ||
| if: github.repository_owner == 'cert-manager' && github.ref_name == github.event.repository.default_branch | ||
| permissions: | ||
| # Needed to upload the results to code-scanning dashboard. | ||
| security-events: write | ||
| # Used to receive a badge. | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: "Checkout code" | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: "Run analysis" | ||
| uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 | ||
| with: | ||
| results_file: results.sarif | ||
| results_format: sarif | ||
|
|
||
| # Publish the results for public repositories to enable scorecard badges. For more details, see | ||
| # https://github.com/ossf/scorecard-action#publishing-results. | ||
| # For private repositories, `publish_results` will automatically be set to `false`, regardless | ||
| # of the value entered here. | ||
| publish_results: true | ||
|
|
||
| # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF | ||
| # format to the repository Actions tab. | ||
| - name: "Upload artifact" | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: SARIF file | ||
| path: results.sarif | ||
| retention-days: 5 | ||
|
|
||
| # Upload the results to GitHub's code scanning dashboard. | ||
| - name: "Upload to code-scanning" | ||
| uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 | ||
| with: | ||
| sarif_file: results.sarif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,3 +25,13 @@ shared_verify_targets += verify-pinact | |
| ## @category [shared] Generate/ Verify | ||
| fix-pinact: | $(NEEDS_PINACT) | ||
| $(PINACT) run --fix --verify-comment | ||
|
|
||
| generate_gh_workflows_base_dir := $(dir $(lastword $(MAKEFILE_LIST)))/base/ | ||
|
|
||
| .PHONY: generate-gh-workflows | ||
| ## Generate base files in the repository | ||
| ## @category [shared] Generate/ Verify | ||
| generate-gh-workflows: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unlike the govulncheck equivalent, there's no opt-out: the go module wraps its target in |
||
| cp -r $(generate_gh_workflows_base_dir)/. ./ | ||
|
erikgb marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two things here:
|
||
|
|
||
| shared_generate_targets += generate-gh-workflows | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Registering this in |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
| # Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/gh-workflows/base/.github/workflows/scorecards.yaml instead. | ||
|
|
||
| name: Scorecards supply-chain security | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the cert-manager manual upgrade you mention in the description: until |
||
| on: | ||
| # Only the default branch is supported. | ||
| branch_protection_rule: | ||
| push: | ||
| # We don't have a consistent name on our default branches, so include both variants for now. | ||
| branches: ["main", "master"] | ||
|
|
||
| # Declare default permissions as read only. | ||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| analysis: | ||
| name: Scorecards analysis | ||
| runs-on: ubuntu-latest | ||
| if: github.repository_owner == 'cert-manager' && github.ref_name == github.event.repository.default_branch | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated description.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The govulncheck workflow templates the repository via |
||
| permissions: | ||
| # Needed to upload the results to code-scanning dashboard. | ||
| security-events: write | ||
| # Used to receive a badge. | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: "Checkout code" | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: "Run analysis" | ||
| uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 | ||
| with: | ||
| results_file: results.sarif | ||
| results_format: sarif | ||
|
|
||
| # Publish the results for public repositories to enable scorecard badges. For more details, see | ||
| # https://github.com/ossf/scorecard-action#publishing-results. | ||
| # For private repositories, `publish_results` will automatically be set to `false`, regardless | ||
| # of the value entered here. | ||
| publish_results: true | ||
|
|
||
| # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF | ||
| # format to the repository Actions tab. | ||
| - name: "Upload artifact" | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: SARIF file | ||
| path: results.sarif | ||
| retention-days: 5 | ||
|
|
||
| # Upload the results to GitHub's code scanning dashboard. | ||
| - name: "Upload to code-scanning" | ||
| uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 | ||
| with: | ||
| sarif_file: results.sarif | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The owner guard still admits private repos inside the cert-manager org, should any adopt this module. There, |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,5 +56,6 @@ | |
| // Exclude files that are sourced from makefile-modules and shouldn't be upgraded in projects using makefile-modules. | ||
| 'make/_shared/**', | ||
| '.github/workflows/govulncheck.yaml', | ||
| '.github/workflows/scorecards.yaml', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two edges to this exclusion, neither blocking:
|
||
| ], | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
$(dir ...)already ends with/, so this expands to…/gh-workflows//base/(and the recipe's$(var)/.adds another). Cosmetic, but it shows up in consumer logs; dropping the explicit/matches repository-base.