Skip to content

Ossf/gha scorecard #6

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

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/src"
schedule:
interval: "weekly"
open-pull-requests-limit: 0
- package-ecosystem: "nuget"
directory: "/test"
schedule:
interval: "weekly"
open-pull-requests-limit: 0
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "weekly"
open-pull-requests-limit: 0
6 changes: 4 additions & 2 deletions .github/workflows/pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Bootstrapper Pipeline
on:
pull_request:
branches: [main]
paths-ignore:
- .github/**
- .codecov/**
- .docfx/**
- .nuget/**
- '**.md'
- '**/*.md'
workflow_dispatch:
inputs:
configuration:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Scorecard supply-chain security
on:
branch_protection_rule:
schedule:
- cron: '45 17 * * 2'
push:
branches: [ "main" ]

permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/[email protected]
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: "Upload artifact"
uses: actions/upload-artifact@v4
with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
Comment on lines +19 to +42
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider security and maintainability improvements

While the steps are well-structured, consider these security and maintainability enhancements:

  1. Pin action versions to specific SHA hashes instead of version tags
  2. Use a reusable variable for the SARIF file path

Apply these security improvements:

       - name: "Checkout code"
-        uses: actions/checkout@v4
+        uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
         with:
           persist-credentials: false

       - name: "Run analysis"
-        uses: ossf/[email protected]
+        uses: ossf/scorecard-action@483ef80d5735bb0476af9ab3aa5c8ac88a6a1a29 # v2.4.0
         with:
           results_file: results.sarif
           results_format: sarif
           publish_results: true

       - name: "Upload artifact"
-        uses: actions/upload-artifact@v4
+        uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
         with:
           name: SARIF file
           path: results.sarif
           retention-days: 5

       - name: "Upload to code-scanning"
-        uses: github/codeql-action/upload-sarif@v3
+        uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v3.22.11
         with:
           sarif_file: results.sarif

Committable suggestion skipped: line range outside the PR's diff.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
![Bootstrapper API by Codebelt](.nuget/Codebelt.Bootstrapper/icon.png)
# Bootstrapper API by Codebelt

[![bootstrapper CI/CD Pipeline](https://github.com/codebeltnet/bootstrapper/actions/workflows/pipelines.yml/badge.svg)](https://github.com/codebeltnet/bootstrapper/actions/workflows/pipelines.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bootstrapper&metric=alert_status)](https://sonarcloud.io/dashboard?id=bootstrapper) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=bootstrapper&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=bootstrapper) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bootstrapper&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=bootstrapper) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bootstrapper&metric=security_rating)](https://sonarcloud.io/dashboard?id=bootstrapper) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/codebeltnet/bootstrapper/badge)](https://scorecard.dev/viewer/?uri=github.com/codebeltnet/bootstrapper)

An open-source family of assemblies (MIT license) that provide a uniform and consistent way of bootstraping your code with Program.cs paired with Startup.cs -OR- using the new `Minimal` equivalent for all project types.

## Codebelt.Bootstrapper

The core types of this lightweight boostrapper framework optimized for console apps, providing a uniform and consistent implementation of:
Expand Down
Loading