From 99b8f3d85a1b2dc7fa60d0e37657c7742f989f1f Mon Sep 17 00:00:00 2001 From: StepSecurity Bot Date: Thu, 14 Mar 2024 22:56:12 -0700 Subject: [PATCH 1/2] chore: ci security hardening (#16) Signed-off-by: StepSecurity Bot --- .github/dependabot.yml | 20 ++++++ .github/workflows/ci.build-test.yml | 4 +- .github/workflows/ci.dependency-graph.yml | 2 +- .github/workflows/deploy.site.yml | 13 ++-- .github/workflows/scorecards.yml | 76 +++++++++++++++++++++++ .pre-commit-config.yaml | 19 ++++++ 6 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/scorecards.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 01dfde6d..719b3b30 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -47,3 +47,23 @@ updates: directory: /samples schedule: interval: daily + + - package-ecosystem: bundler + directory: / + schedule: + interval: daily + + - package-ecosystem: maven + directory: /samples/modular-guava-maven + schedule: + interval: daily + + - package-ecosystem: maven + directory: /tools/bom + schedule: + interval: daily + + - package-ecosystem: maven + directory: /tools/graph + schedule: + interval: daily diff --git a/.github/workflows/ci.build-test.yml b/.github/workflows/ci.build-test.yml index ff96076a..d05a9b45 100644 --- a/.github/workflows/ci.build-test.yml +++ b/.github/workflows/ci.build-test.yml @@ -28,14 +28,14 @@ jobs: persist-credentials: false submodules: true - name: "Setup: Java 21" - uses: actions/setup-java@v4 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: java-version: '21' distribution: 'zulu' - name: "Setup: Bazelisk" uses: bazelbuild/setup-bazelisk@b39c379c82683a5f25d34f0d062761f62693e0b2 # v3.0.0 - name: "Setup: Cache" - uses: actions/cache@v4 + uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 with: path: | jdk diff --git a/.github/workflows/ci.dependency-graph.yml b/.github/workflows/ci.dependency-graph.yml index 601c2f29..0a606a57 100644 --- a/.github/workflows/ci.dependency-graph.yml +++ b/.github/workflows/ci.dependency-graph.yml @@ -31,7 +31,7 @@ jobs: with: persist-credentials: false - name: "Setup: Java 21" - uses: actions/setup-java@v4 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: java-version: '21' distribution: 'zulu' diff --git a/.github/workflows/deploy.site.yml b/.github/workflows/deploy.site.yml index be7634ed..12fb8c2d 100644 --- a/.github/workflows/deploy.site.yml +++ b/.github/workflows/deploy.site.yml @@ -23,7 +23,7 @@ jobs: with: egress-policy: audit - name: "Setup: Checkout" - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: persist-credentials: false - name: "Setup: Ruby" @@ -34,13 +34,13 @@ jobs: cache-version: 0 - name: "Setup: Pages" id: pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0 - name: "Build: Jekyll" run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" env: JEKYLL_ENV: production - name: "Artifact: Site" - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 deploy: name: "Deploy Site" @@ -50,6 +50,11 @@ jobs: runs-on: ubuntu-latest needs: build steps: + - name: Harden Runner + uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + with: + egress-policy: audit + - name: "Deploy: Pages" id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@decdde0ac072f6dcbe43649d82d9c635fff5b4e4 # v4.0.4 diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 00000000..68752b28 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,76 @@ +# 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: Harden Runner + uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + with: + egress-policy: audit + + - name: "Checkout code" + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 + 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@e56cfd0877b4826be144d11aa31e6c64a55828e9 # v2.24.7 + with: + sarif_file: results.sarif diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..99648ea8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +repos: +- repo: https://github.com/gherynos/pre-commit-java + rev: v0.2.4 + hooks: + - id: Checkstyle +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks +- repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: RuboCop + - id: shellcheck +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace From ac1ce85c0bd22260cd6d1f8bd8076e804e478e80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 05:57:00 +0000 Subject: [PATCH 2/2] build(deps): bump com.google.errorprone:error_prone_annotations Bumps [com.google.errorprone:error_prone_annotations](https://github.com/google/error-prone) from 2.25.0-jpms to 2.26.1. - [Release notes](https://github.com/google/error-prone/releases) - [Commits](https://github.com/google/error-prone/commits/v2.26.1) --- updated-dependencies: - dependency-name: com.google.errorprone:error_prone_annotations dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- tools/bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bom/pom.xml b/tools/bom/pom.xml index 78aab36c..d8d378aa 100644 --- a/tools/bom/pom.xml +++ b/tools/bom/pom.xml @@ -39,7 +39,7 @@ com.google.errorprone error_prone_annotations - 2.25.0-jpms + 2.26.1 com.google.j2objc