diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1a1febd..07b1135 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -32,9 +32,17 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true +permissions: {} + jobs: cpp-build: - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@main with: build_type: ${{ inputs.build_type || 'branch' }} @@ -45,7 +53,13 @@ jobs: sha: ${{ inputs.sha }} python-build: needs: [cpp-build] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@main with: build_type: ${{ inputs.build_type || 'branch' }} @@ -58,7 +72,13 @@ jobs: docs-build: if: github.ref_type == 'branch' needs: [python-build] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: arch: "amd64" @@ -71,15 +91,29 @@ jobs: sha: ${{ inputs.sha }} upload-conda: needs: [cpp-build, python-build] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/conda-upload-packages.yaml@main + secrets: + CONDA_RAPIDSAI_NIGHTLY_TOKEN: ${{ secrets.CONDA_RAPIDSAI_NIGHTLY_TOKEN }} + CONDA_RAPIDSAI_TOKEN: ${{ secrets.CONDA_RAPIDSAI_TOKEN }} with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} date: ${{ inputs.date }} sha: ${{ inputs.sha }} wheel-build-libnvforest: - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: build_type: ${{ inputs.build_type || 'branch' }} @@ -94,8 +128,16 @@ jobs: package-type: cpp wheel-publish-libnvforest: needs: wheel-build-libnvforest - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@main + secrets: + CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN: ${{ secrets.CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN }} + RAPIDSAI_PYPI_TOKEN: ${{ secrets.RAPIDSAI_PYPI_TOKEN }} with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} @@ -105,7 +147,13 @@ jobs: package-type: cpp wheel-build-nvforest: needs: wheel-build-libnvforest - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: build_type: ${{ inputs.build_type || 'branch' }} @@ -120,8 +168,16 @@ jobs: matrix_filter: group_by({CUDA_VER, ARCH}) | map(min_by(.PY_VER | split(".") | map(tonumber))) wheel-publish-nvforest: needs: wheel-build-nvforest - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@main + secrets: + CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN: ${{ secrets.CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN }} + RAPIDSAI_PYPI_TOKEN: ${{ secrets.RAPIDSAI_PYPI_TOKEN }} with: build_type: ${{ inputs.build_type || 'branch' }} branch: ${{ inputs.branch }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 31e78f8..73a6e27 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,11 +1,19 @@ name: "Pull Request Labeler" -on: +# `zizmor` always flags these triggers because they are easy to use +# incorrectly. These usages are ok and don't execute any PR-specific +# code (and so aren't susceptible to exploits from forked PRs) +on: # zizmor: ignore[dangerous-triggers] - pull_request_target +permissions: {} + jobs: triage: runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index af50619..3707c99 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -6,6 +6,9 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + +permissions: {} + jobs: # Please keep pr-builder as the top job here pr-builder: @@ -25,7 +28,8 @@ jobs: - wheel-build-nvforest - wheel-tests-nvforest - devcontainer - secrets: inherit + permissions: + contents: read uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@main if: always() with: @@ -33,6 +37,8 @@ jobs: telemetry-setup: runs-on: ubuntu-latest continue-on-error: true + permissions: + contents: read env: OTEL_SERVICE_NAME: "pr-nvforest" steps: @@ -43,13 +49,15 @@ jobs: runs-on: ubuntu-latest permissions: actions: read + contents: read id-token: write + pull-requests: read env: GH_TOKEN: ${{ github.token }} steps: - name: Get PR Info id: get-pr-info - uses: nv-gha-runners/get-pr-info@main + uses: nv-gha-runners/get-pr-info@090577647b8ddc4e06e809e264f7881650ecdccf # main - name: Check if nightly CI is passing uses: rapidsai/shared-actions/check_nightly_success/dispatch@main with: @@ -57,8 +65,12 @@ jobs: target-branch: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.ref }} max-days-without-success: 7 changed-files: - secrets: inherit needs: telemetry-setup + permissions: + actions: read + contents: read + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/changed-files.yaml@main with: files_yaml: | @@ -134,8 +146,9 @@ jobs: - '!docs/**' - '!**/*/agents.md' checks: - secrets: inherit needs: telemetry-setup + permissions: + contents: read uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@main with: enable_check_generated_files: false @@ -144,7 +157,13 @@ jobs: telemetry-summarize clang-tidy: needs: checks - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: build_type: pull-request @@ -154,7 +173,13 @@ jobs: script: "ci/run_clang_tidy.sh" conda-cpp-build: needs: checks - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@main with: build_type: pull-request @@ -162,7 +187,13 @@ jobs: script: ci/build_cpp.sh conda-cpp-tests: needs: [conda-cpp-build, changed-files] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp with: @@ -170,13 +201,24 @@ jobs: script: ci/test_cpp.sh conda-cpp-checks: needs: conda-cpp-build - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@main with: build_type: pull-request conda-python-build: needs: conda-cpp-build - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@main with: build_type: pull-request @@ -185,7 +227,13 @@ jobs: matrix_filter: group_by({CUDA_VER, ARCH}) | map(min_by(.PY_VER | split(".") | map(tonumber))) conda-python-tests: needs: [conda-python-build, changed-files] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@main if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda with: @@ -194,7 +242,13 @@ jobs: run_codecov: false docs-build: needs: [conda-python-build, changed-files] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main if: fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs with: @@ -205,7 +259,13 @@ jobs: script: "ci/build_docs.sh" wheel-build-libnvforest: needs: checks - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: build_type: pull-request @@ -220,7 +280,13 @@ jobs: package-type: cpp wheel-build-nvforest: needs: [checks, wheel-build-libnvforest] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: build_type: pull-request @@ -232,7 +298,13 @@ jobs: matrix_filter: group_by({CUDA_VER, ARCH}) | map(min_by(.PY_VER | split(".") | map(tonumber))) wheel-tests-nvforest: needs: [wheel-build-nvforest, changed-files] - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels with: @@ -240,7 +312,13 @@ jobs: script: ci/test_wheel.sh devcontainer: needs: telemetry-setup - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/build-in-devcontainer.yaml@release/26.04 with: arch: '["amd64", "arm64"]' @@ -260,6 +338,8 @@ jobs: needs: pr-builder if: ${{ vars.TELEMETRY_ENABLED == 'true' && !cancelled() }} continue-on-error: true + permissions: + actions: read steps: - name: Telemetry summarize uses: rapidsai/shared-actions/telemetry-dispatch-summarize@main diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4086bad..02eb255 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,9 +22,16 @@ on: type: string default: nightly +permissions: {} + jobs: conda-cpp-checks: - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-post-build-checks.yaml@main with: build_type: ${{ inputs.build_type }} @@ -32,7 +39,13 @@ jobs: date: ${{ inputs.date }} sha: ${{ inputs.sha }} conda-cpp-tests: - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main with: build_type: ${{ inputs.build_type }} @@ -41,7 +54,13 @@ jobs: script: ci/test_cpp.sh sha: ${{ inputs.sha }} conda-python-tests: - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@main with: build_type: ${{ inputs.build_type }} @@ -51,7 +70,13 @@ jobs: script: "ci/test_python.sh" run_codecov: false wheel-tests-nvforest: - secrets: inherit + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main with: build_type: ${{ inputs.build_type }} diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 0000000..1b6ea1e --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,9 @@ +rules: + unpinned-uses: + config: + policies: + # We require SHA-pinning for all workflows and actions _except_ for those from + # rapidsai/shared-workflows and rapidsai/shared-actions + "rapidsai/shared-workflows/*": any + "rapidsai/shared-actions/*": any + "*": hash-pin diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5114a21..4aee6a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -122,6 +122,10 @@ repos: hooks: - id: shellcheck args: ["--severity=warning"] + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.24.1 + hooks: + - id: zizmor default_language_version: python: python3