diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a2a66d097..dd985a6a9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,3 +13,13 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + + - package-ecosystem: docker + directory: /build + schedule: + interval: daily + + - package-ecosystem: docker + directory: /examples/metrics + schedule: + interval: daily diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 68f8f3145..71b6ed5d9 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -14,8 +14,13 @@ jobs: name: Performance regression check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x @@ -24,13 +29,13 @@ jobs: run: make BENCH_OUTPUT=ci-cd run-bench # Download previous benchmark result from cache (if exists) - name: Download previous benchmark data - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: ./cache key: ${{ runner.os }}-gen1-benchmark # Run `github-action-benchmark` action - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1.17.0 + uses: benchmark-action/github-action-benchmark@29e55772d85cc51b2a291bde13f33ef9014d2d1f # v1.17.0 with: # What benchmark tool the output.txt came from tool: 'customBiggerIsBetter' diff --git a/.github/workflows/branch-cov.yml b/.github/workflows/branch-cov.yml index e29f58c74..f0e29c731 100644 --- a/.github/workflows/branch-cov.yml +++ b/.github/workflows/branch-cov.yml @@ -18,8 +18,13 @@ jobs: arch: [amd64] name: coverage steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index b0e2785ed..784f317d6 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -20,6 +20,11 @@ jobs: name: Build and test ZOT runs-on: ubuntu-latest steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Run build and test timeout-minutes: 60 run: | @@ -35,17 +40,22 @@ jobs: os: [linux, darwin] arch: [amd64, arm64] steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Install go - uses: actions/setup-go@v4 + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Cache go dependencies id: cache-go-dependencies - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: | ~/go/pkg/mod @@ -54,7 +64,7 @@ jobs: ${{ runner.os }}-go-mod- - name: Cache go build output id: cache-go-build - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: | ~/.cache/go-build @@ -116,7 +126,7 @@ jobs: OS: ${{ matrix.os }} ARCH: ${{ matrix.arch }} - name: Upload code coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -130,7 +140,7 @@ jobs: - if: github.event_name == 'release' && github.event.action == 'published' name: Publish artifacts on releases - uses: svenstaro/upload-release-action@v2 + uses: svenstaro/upload-release-action@2b9d2847a97b04d02ad5c3df2d3a27baa97ce689 # v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: bin/z* @@ -151,16 +161,21 @@ jobs: os: [linux, darwin] arch: [amd64, arm64] steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Log in to GitHub Docker Registry - uses: docker/login-action@v2 + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push zot container image - uses: project-stacker/stacker-build-push-action@main + uses: project-stacker/stacker-build-push-action@124d166f0fbaf3b69c2ee46825c8008dd2d1d1cd # main with: file: 'build/stacker.yaml' build-args: | @@ -206,7 +221,7 @@ jobs: OS: ${{ matrix.os }} ARCH: ${{ matrix.arch }} - name: Build and push zot-minimal container image - uses: project-stacker/stacker-build-push-action@main + uses: project-stacker/stacker-build-push-action@124d166f0fbaf3b69c2ee46825c8008dd2d1d1cd # main with: file: 'build/stacker-minimal.yaml' build-args: | @@ -253,7 +268,7 @@ jobs: OS: ${{ matrix.os }} ARCH: ${{ matrix.arch }} - name: Build and push zot-exporter container image - uses: project-stacker/stacker-build-push-action@main + uses: project-stacker/stacker-build-push-action@124d166f0fbaf3b69c2ee46825c8008dd2d1d1cd # main with: file: 'build/stacker-zxp.yaml' build-args: | @@ -299,7 +314,7 @@ jobs: OS: ${{ matrix.os }} ARCH: ${{ matrix.arch }} - name: Build and push zb container image - uses: project-stacker/stacker-build-push-action@main + uses: project-stacker/stacker-build-push-action@124d166f0fbaf3b69c2ee46825c8008dd2d1d1cd # main with: file: 'build/stacker-zb.yaml' build-args: | @@ -329,7 +344,7 @@ jobs: OS: ${{ matrix.os }} ARCH: ${{ matrix.arch }} - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@e5f43133f6e8736992c9f3c1b3296e24b37e17f2 # master with: image-ref: 'ghcr.io/${{ github.repository }}-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}' format: 'sarif' @@ -338,7 +353,7 @@ jobs: TRIVY_USERNAME: ${{ github.actor }} TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - name: Run Trivy vulnerability scanner (minimal) - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@e5f43133f6e8736992c9f3c1b3296e24b37e17f2 # master with: image-ref: 'ghcr.io/${{ github.repository }}-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}' format: 'sarif' @@ -347,7 +362,7 @@ jobs: TRIVY_USERNAME: ${{ github.actor }} TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5 with: sarif_file: 'trivy-results.sarif' @@ -357,13 +372,18 @@ jobs: name: Update Helm Chart runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 with: ref: main fetch-depth: '0' - name: Checkout project-zot/helm-charts - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 with: repository: project-zot/helm-charts ref: main @@ -376,11 +396,11 @@ jobs: git config --global user.name 'github-actions' git config --global user.email 'github-actions@users.noreply.github.com' - name: Update appVersion - uses: mikefarah/yq@master + uses: mikefarah/yq@845d4ae38915c31cc76ab968393657cceaec60fc # master with: cmd: yq -i '.appVersion = "${{ github.event.release.tag_name }}"' 'helm-charts/charts/zot/Chart.yaml' - name: Update image tag - uses: mikefarah/yq@master + uses: mikefarah/yq@845d4ae38915c31cc76ab968393657cceaec60fc # master with: cmd: yq -i '.image.tag = "${{ github.event.release.tag_name }}"' 'helm-charts/charts/zot/values.yaml' - name: Update version diff --git a/.github/workflows/cloc.yml b/.github/workflows/cloc.yml index 925121ce5..13526fb9f 100644 --- a/.github/workflows/cloc.yml +++ b/.github/workflows/cloc.yml @@ -17,13 +17,18 @@ jobs: name: Lines of code runs-on: ubuntu-latest steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Install go - uses: actions/setup-go@v4 + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install dependencies run: | cd $GITHUB_WORKSPACE diff --git a/.github/workflows/cluster.yaml b/.github/workflows/cluster.yaml index df9ddd360..cdd84478c 100644 --- a/.github/workflows/cluster.yaml +++ b/.github/workflows/cluster.yaml @@ -27,8 +27,13 @@ jobs: # - /tmp/data:/data # options: --name=minio --health-cmd "curl http://localhost:9000/minio/health/live" steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x @@ -160,13 +165,13 @@ jobs: # Download previous benchmark result from cache (if exists) - name: Download previous benchmark data - uses: actions/cache@v3 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: ./cache key: ${{ runner.os }}-gen1-benchmark-stateless-cluster # Run `github-action-benchmark` action - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1.17.0 + uses: benchmark-action/github-action-benchmark@29e55772d85cc51b2a291bde13f33ef9014d2d1f # v1.17.0 with: # What benchmark tool the output.txt came from tool: 'customBiggerIsBetter' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5b1d47c2a..e9a7c04fd 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,11 +42,16 @@ jobs: GOFLAGS: "-tags=sync,search,scrub,metrics,userprefs,containers_image_openpgp" steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install go - uses: actions/setup-go@v4 + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x @@ -62,7 +67,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -73,7 +78,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -86,4 +91,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@0225834cc549ee0ca93cb085b92954821a145866 # v2.3.5 diff --git a/.github/workflows/commit-msg.yaml b/.github/workflows/commit-msg.yaml index 2dda47189..0e01c172a 100644 --- a/.github/workflows/commit-msg.yaml +++ b/.github/workflows/commit-msg.yaml @@ -15,10 +15,15 @@ jobs: name: Check commit message style runs-on: ubuntu-latest steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Check Commit Type - uses: gsactions/commit-message-checker@v2 + uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee # v2.0.0 with: pattern: '^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?(!)?(: (.*\s*)*))' flags: 'gm' @@ -28,7 +33,7 @@ jobs: checkAllCommitMessages: 'true' accessToken: ${{ secrets.GITHUB_TOKEN }} - name: Check Line Length - uses: gsactions/commit-message-checker@v2 + uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee # v2.0.0 with: pattern: '^[^#].{1,74}' error: 'The maximum line length of 74 characters is exceeded.' diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml index 5123a88fd..056587065 100644 --- a/.github/workflows/dco.yml +++ b/.github/workflows/dco.yml @@ -11,9 +11,14 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Set up Python 3.x - uses: actions/setup-python@v4 + uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1 with: python-version: '3.x' - name: Check DCO diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 000000000..ebe6e77da --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,27 @@ +# 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] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/ecosystem-tools.yaml b/.github/workflows/ecosystem-tools.yaml index 889897c6b..51b77aaa4 100644 --- a/.github/workflows/ecosystem-tools.yaml +++ b/.github/workflows/ecosystem-tools.yaml @@ -16,8 +16,13 @@ jobs: name: Check client tools runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 2c9dc620c..dbce2e3fb 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -16,13 +16,18 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: '1.20' - - uses: actions/checkout@v3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version version: v1.52.2 diff --git a/.github/workflows/gqlgen.yaml b/.github/workflows/gqlgen.yaml index a0f9d50ce..36b2fec8c 100644 --- a/.github/workflows/gqlgen.yaml +++ b/.github/workflows/gqlgen.yaml @@ -21,8 +21,13 @@ jobs: name: Check GQL generation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x @@ -40,7 +45,12 @@ jobs: name: Check GQL schema follows best practices runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install dependencies run: | cd $GITHUB_WORKSPACE diff --git a/.github/workflows/license.yaml b/.github/workflows/license.yaml index 685d13194..fcca402de 100644 --- a/.github/workflows/license.yaml +++ b/.github/workflows/license.yaml @@ -18,8 +18,13 @@ jobs: runs-on: ubuntu-latest name: License Check steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index e3cfe8949..55529b1eb 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -16,8 +16,13 @@ jobs: name: Dedupe/restore blobs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: go-version: 1.20.x - name: Install dependencies @@ -59,8 +64,13 @@ jobs: name: Sync harness runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: go-version: 1.20.x - name: Install dependencies diff --git a/.github/workflows/oci-conformance-action.yml b/.github/workflows/oci-conformance-action.yml index 93a42debc..2e8cce979 100644 --- a/.github/workflows/oci-conformance-action.yml +++ b/.github/workflows/oci-conformance-action.yml @@ -20,13 +20,18 @@ jobs: runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Install go 1.20 - uses: actions/setup-go@v4 + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x - name: Checkout this PR - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Start zot server run: | cd $GITHUB_WORKSPACE @@ -35,7 +40,7 @@ jobs: IP=`hostname -I | awk '{print $1}'` echo "SERVER_URL=http://${IP}:8080" >> $GITHUB_ENV - name: Run OCI Distribution Spec conformance tests - uses: opencontainers/distribution-spec@main + uses: opencontainers/distribution-spec@58a1fe939258cb1c688ab49f819bde65eb401f75 # main env: OCI_ROOT_URL: ${{ env.SERVER_URL }} OCI_NAMESPACE: oci-conformance/distribution-test @@ -48,7 +53,7 @@ jobs: if: always() #run: docker run --rm -v $(pwd)/results:/results -w /results -e OCI_ROOT_URL=${{ env.OCI_ROOT_URL }} -e OCI_NAMESPACE="anuvu/zot" -e OCI_TEST_PULL=1 -e OCI_TEST_PUSH=1 -e OCI_TEST_CONTENT_DISCOVERY=1 -e OCI_TEST_CONTENT_MANAGEMENT=1 -e OCI_HIDE_SKIPPED_WORKFLOWS=0 -e OCI_DEBUG="true" ghcr.io/opencontainers/distribution-spec/conformance:db4cc68 - name: Upload test results zip as build artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: oci-test-results-${{ github.sha }} path: .out/ diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 59e07c9f3..834b16b4d 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -24,8 +24,13 @@ jobs: actions: read steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: "Checkout code" - uses: actions/checkout@v3 # v3.0.0 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 with: persist-credentials: false @@ -49,7 +54,7 @@ jobs: # 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@v3 # v3.0.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: SARIF file path: results.sarif diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index b81fe2ba6..959d7cdf4 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -12,7 +12,12 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8.0.0 with: stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' diff --git a/.github/workflows/sync-3rdparty-images.yaml b/.github/workflows/sync-3rdparty-images.yaml index 870f3d4e8..5b5a87535 100644 --- a/.github/workflows/sync-3rdparty-images.yaml +++ b/.github/workflows/sync-3rdparty-images.yaml @@ -20,8 +20,13 @@ jobs: - "1.20" runs-on: ubuntu-latest steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Log in to GitHub Docker Registry - uses: docker/login-action@v2 + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 with: registry: ghcr.io username: ${{ github.actor }} @@ -36,6 +41,11 @@ jobs: name: 'trivy-db' runs-on: ubuntu-latest steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Copy trivy-db using oras cli run: | oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io diff --git a/.github/workflows/tls.yaml b/.github/workflows/tls.yaml index 2ffec8640..30d2c2d29 100644 --- a/.github/workflows/tls.yaml +++ b/.github/workflows/tls.yaml @@ -18,8 +18,13 @@ jobs: arch: [amd64] name: TLS check steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x diff --git a/.github/workflows/web-scan.yml b/.github/workflows/web-scan.yml index add436daf..420e15d60 100644 --- a/.github/workflows/web-scan.yml +++ b/.github/workflows/web-scan.yml @@ -21,13 +21,18 @@ jobs: matrix: flavor: [zot-linux-amd64-minimal, zot-linux-amd64] steps: + - name: Harden Runner + uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + with: + egress-policy: audit + - name: Install go - uses: actions/setup-go@v4 + uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: cache: false go-version: 1.20.x - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Build zot run: | echo "Building $FLAVOR" @@ -56,7 +61,7 @@ jobs: env: FLAVOR: ${{ matrix.flavor }} - name: ZAP Scan Rest API - uses: zaproxy/action-baseline@v0.7.0 + uses: zaproxy/action-baseline@7cea08522cd386f6c675776d5e4296aecf61f33b # v0.7.0 with: token: ${{ secrets.GITHUB_TOKEN }} docker_name: 'owasp/zap2docker-stable' diff --git a/build/Dockerfile b/build/Dockerfile index e4f1ce2ec..c83f374c6 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,7 +1,7 @@ # --- # Stage 1: Install certs, build binary, create default config file # --- -FROM ghcr.io/project-zot/golang:1.20 AS builder +FROM ghcr.io/project-zot/golang:1.20@sha256:3fccedea46315261e4b6205bcffe91ece1e2aea60c23aab0f033f35461849b42 AS builder ARG COMMIT ARG OS ARG ARCH diff --git a/examples/metrics/Dockerfile b/examples/metrics/Dockerfile index 1239a18c9..d74b04a9e 100644 --- a/examples/metrics/Dockerfile +++ b/examples/metrics/Dockerfile @@ -1,7 +1,7 @@ # --- # Stage 1: Install certs, build binary, create default config file # --- -FROM ghcr.io/project-zot/golang:1.19 AS builder +FROM ghcr.io/project-zot/golang:1.19@sha256:dd9ad81920b63c7f9f18823d888d5fdcc7e7516086fd16654d07bc437f0e2427 AS builder RUN mkdir -p /go/src/github.com/project-zot/zot WORKDIR /go/src/github.com/project-zot/zot COPY . .