feat: worker sandboxing #228
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Root Cargo workspace checks. Dependency auditing is supply-chain.yml. | |
| name: Rust CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_NET_GIT_FETCH_WITH_CLI: true | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| version-alignment: | |
| name: Version Alignment | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: worldcoin/bedrock/.github/actions/version-alignment@857c252013ac52cea24f5d7add3475a909d663f2 | |
| with: | |
| uniffi_version: ${{ vars.UNIFFI_VERSION }} | |
| rust_toolchain_channel: ${{ vars.RUST_TOOLCHAIN_CHANNEL }} | |
| cargo-clippy: | |
| name: clippy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - uses: ./.github/actions/setup-rust | |
| - name: Public dependency boundary | |
| run: | | |
| cargo metadata --locked --format-version 1 > "$RUNNER_TEMP/public-metadata.json" | |
| jq -e 'all(.packages[]; .name != "flamingo-verifier-worker" and .name != "face-engine" and ((.source // "") | contains("biometric-engines") | not))' "$RUNNER_TEMP/public-metadata.json" | |
| - name: fmt | |
| run: cargo fmt --all -- --check | |
| - name: clippy | |
| run: cargo clippy --locked --workspace --all-targets --all-features -- | |
| cargo-tests: | |
| name: tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - uses: ./.github/actions/setup-rust | |
| - name: tests | |
| run: cargo test --locked --workspace --all-features --exclude flamingo-verifier-worker-process --verbose | |
| - name: Minijail process tests | |
| run: | | |
| cargo test --locked -p flamingo-verifier-worker-process --all-features --no-run \ | |
| --message-format=json > target/worker-test-artifacts.json | |
| test_binary=$(jq -r 'select(.reason == "compiler-artifact" and .target.name == "process") | .executable // empty' target/worker-test-artifacts.json) | |
| test -n "$test_binary" | |
| sudo timeout --kill-after=5s 60s "$test_binary" | |
| # Public outputs must evaluate and build without private Git or model credentials. | |
| flake: | |
| name: Flake eval | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22 | |
| # --no-update-lock-file: otherwise a new flake.nix input resolves against upstream right | |
| # now and the lock is quietly rewritten. | |
| - name: Evaluate the enclave image and converter derivations | |
| run: | | |
| set -euo pipefail | |
| for output in di-enclave verifier-enclave worker-bundle di-oci verifier-oci di-eif verifier-eif; do | |
| drv="$(nix eval --raw --no-update-lock-file ".#packages.x86_64-linux.$output.drvPath")" | |
| echo "$output -> $drv" | |
| done | |
| - name: Build the di enclave image | |
| run: nix build --no-link --no-update-lock-file .#packages.x86_64-linux.di-oci |