diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index de68ffc8..ed523e10 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -6,6 +6,7 @@ on: - main tags: - v* + permissions: contents: read env: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c21da76..21804da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: concurrency: group: ci-${{ github.head_ref || github.ref }} cancel-in-progress: true + permissions: contents: read jobs: diff --git a/.github/workflows/clean-ghcr.yaml b/.github/workflows/clean-ghcr.yaml index 8e6d7c9d..ff163806 100644 --- a/.github/workflows/clean-ghcr.yaml +++ b/.github/workflows/clean-ghcr.yaml @@ -5,6 +5,8 @@ on: - cron: "0 1 * * *" # every day at midnight workflow_dispatch: +permissions: + contents: read jobs: trigger: uses: statnett/workflows/.github/workflows/clean-ghcr.yaml@main diff --git a/.github/workflows/clear-cache.yaml b/.github/workflows/clear-cache.yaml index fa13b3bd..f5918a6f 100644 --- a/.github/workflows/clear-cache.yaml +++ b/.github/workflows/clear-cache.yaml @@ -2,10 +2,13 @@ name: Clear cache on: workflow_dispatch: + permissions: - actions: write + contents: read jobs: clear-cache: + permissions: + actions: write runs-on: ubuntu-latest steps: - name: Clear cache diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b1128aac..52f80516 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -10,6 +10,8 @@ on: schedule: - cron: "0 0 * * 1" +permissions: + contents: read jobs: trigger: uses: statnett/github-workflows/.github/workflows/codeql.yaml@main diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 79893802..bde50017 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -1,17 +1,10 @@ -# Dependency Review Action -# -# This Action will scan dependency manifest files that change as part of a Pull Request, -# surfacing known-vulnerable versions of the packages declared or updated in the PR. -# Once installed, if the workflow run is marked as required, -# PRs introducing known-vulnerable packages will be blocked from merging. -# -# Source repository: https://github.com/actions/dependency-review-action -name: 'Dependency Review' -on: [pull_request] +--- +name: Dependency Review +on: + pull_request: permissions: contents: read - jobs: dependency-review: runs-on: ubuntu-latest diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index e8a046ab..d6e9d607 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -4,6 +4,7 @@ on: release: types: - published + permissions: contents: read env: diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 4be350a4..25e503b0 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -7,6 +7,8 @@ on: - edited - synchronize +permissions: + contents: read jobs: trigger: uses: statnett/github-workflows/.github/workflows/lint-pr.yaml@main diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index ec427897..b9c137b8 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -6,6 +6,8 @@ on: - main workflow_dispatch: +permissions: + contents: read jobs: trigger: uses: statnett/github-workflows/.github/workflows/release-please.yaml@main diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml new file mode 100644 index 00000000..21f3fc6a --- /dev/null +++ b/.github/workflows/scorecard.yaml @@ -0,0 +1,20 @@ +--- +name: Scorecard supply-chain security +on: + branch_protection_rule: + schedule: + - cron: "20 7 * * 2" + push: + branches: + - main + +permissions: + contents: read +jobs: + trigger: + uses: statnett/github-workflows/.github/workflows/scorecard.yaml@main + permissions: + security-events: write + id-token: write + contents: read + actions: read diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml deleted file mode 100644 index db3f6a9e..00000000 --- a/.github/workflows/scorecards.yml +++ /dev/null @@ -1,71 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. They are provided -# by a third-party and are governed by separate terms of service, privacy -# policy, and support documentation. - -name: Scorecard supply-chain security -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - schedule: - - cron: '20 7 * * 2' - push: - branches: ["main"] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - contents: read - actions: read - - steps: - - name: "Checkout code" - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@483ef80eb98fb506c348f7d62e28055e49fe2398 # v2.3.0 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecards on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always 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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - 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@fdcae64e1484d349b3366718cdfef3d404390e85 # v2.22.1 - with: - sarif_file: results.sarif