mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
## Summary This PR addresses several security vulnerabilities and applies hardening measures to the GitHub Actions workflows: - **Replace `secrets: inherit` with explicit secret passing** - Prevents unnecessary exposure of all repository secrets to called workflows - **Add SHA256 checksum verification for downloaded binaries** - Protects against supply chain attacks via compromised upstream releases - **Add GitHub Environment protections for release workflows** - Requires approval before publishing to Docker Hub or creating releases - **Add explicit minimal permissions to all workflows** - Follows principle of least privilege, removes unnecessary `packages: write` from CI.yml ## Changes by Category ### 1. Explicit Secret Passing | Workflow | Before | After | |----------|--------|-------| | CI.yml → docker-build-ci | `secrets: inherit` | No secrets (GITHUB_TOKEN is automatic) | | CI.yml → docker-build-release | `secrets: inherit` | Explicit `DOCKERHUB_USERNAME`, `DOCKERHUB_TOKEN` | | CI.yml → e2e-tests | `secrets: inherit` | No secrets (GITHUB_TOKEN is automatic) | ### 2. Binary Checksum Verification | Workflow | Binary | SHA256 | |----------|--------|--------| | task-rust-lint.yml | taplo 0.8.1 | `c62baa73c9d7c1572...` | | task-e2e.yml | kurtosis 1.11.99 | `5e88e98c1b255362...` | ### 3. Environment Protections | Workflow | Job | Environment | |----------|-----|-------------| | task-docker-release.yml | build-test-push | `production` | | task-publish-binary.yml | publish-draft-release | `releases` | | task-publish-binary.yml | docker-release-candidate | `production` | | task-publish-runtime.yml | publish-draft-release | `releases` | ### 4. Explicit Permissions All 14 workflow files now have explicit `permissions:` blocks with minimal required access. Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
74 lines
2.1 KiB
YAML
74 lines
2.1 KiB
YAML
# Rust Tests: CI for Rust components (DataHaven runtime and node Rust tests)
|
|
#
|
|
# Overview:
|
|
# All Rust Tests: Executes the full suite of Rust tests across two partitions to
|
|
# to reduce total execution time.
|
|
|
|
name: DataHaven Operator Rust Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
# Explicit minimal permissions
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
all-rust-tests:
|
|
name: Run all Operator Rust tests (/w partitioning)
|
|
runs-on:
|
|
group: DH-runners
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
partition: [1, 2]
|
|
env:
|
|
RUSTC_WRAPPER: "sccache"
|
|
CARGO_INCREMENTAL: "0"
|
|
CARGO_TERM_COLOR: always
|
|
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=mold"
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
defaults:
|
|
run:
|
|
working-directory: ./operator
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- uses: ./.github/workflows/actions/setup-env
|
|
with:
|
|
cache-key: "TEST"
|
|
install-deps: false
|
|
- name: Set build flags
|
|
run: echo "RUSTFLAGS=${{ env.RUSTFLAGS }} -C linker=clang -C link-arg=-fuse-ld=mold" >> $GITHUB_ENV
|
|
- name: Install nextest
|
|
run: |
|
|
if ! command -v cargo-nextest &> /dev/null; then
|
|
echo "Installing cargo-nextest version 0.9.100"
|
|
cargo install cargo-nextest --version 0.9.100 --locked
|
|
else
|
|
echo "cargo-nextest is already installed: $(cargo-nextest --version)"
|
|
fi
|
|
- name: Run Tests for All Projects!
|
|
run: |
|
|
~/.cargo/bin/cargo-nextest nextest run \
|
|
--partition count:${{ matrix.partition }}/2
|
|
|
|
tests-result-checker:
|
|
name: Check tests were successful
|
|
needs: [all-rust-tests]
|
|
runs-on:
|
|
group: DH-runners
|
|
steps:
|
|
- name: Validate test results
|
|
run: |
|
|
echo "matrix result: ${{ needs.all-rust-tests.result }}"
|
|
|
|
if [ "${{ needs.all-rust-tests.result }}" != "success" ]; then
|
|
echo "Rust tests failed or were cancelled"
|
|
exit 1
|
|
else
|
|
echo "Rust tests passed"
|
|
fi
|
|
|