A zero-trust, SLSA-aligned reference architecture for compiling deterministic, cryptographically attested Python wheels for hardened and air-gapped environments.
Standard Python packaging workflows often rely on implicit trust: pulling unverified binary wheels or compiling natively inside unhardened runners with full internet access and mutable action tags. In regulated domains (defense, financial systems, healthcare, and critical infrastructure), this creates critical supply-chain exposure:
This repository enforces deterministic immutability, least-privilege tool compilation, and verifiable cryptographic attestations from commit to artifact release.
┌────────────────────────────────────────┐
│ Developer Workstation (Signed GPG) │
└──────────────────┬─────────────────────┘
│ PR (Fast-forward only)
▼
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ GitHub Actions: Zero-Trust Isolation │
│ │
│ [Job: Gates] (No code checkout) │
│ ├── Parse OpenPGP signature packets (issuer fpr v4 allowlist) │
│ └── Compare API ancestor & linear history enforcement │
│ │
│ [Job: Hermetic Container Build] │
│ ├── Multi-arch Alpine musl (x86_64 / aarch64) pinned to content-addressable digests │
│ ├── sccache built with --no-default-features (local disk cache only, 0 network) │
│ ├── Embedded dependency tracking via cargo-auditable │
│ └── Build-time assertion gate with automated mutation testing │
│ │
│ [Job: Policy Verification & Cryptographic Attestation] │
│ ├── Syft SBOM generation (CycloneDX / SPDX) │
│ ├── OpenVEX exploitability documentation matching exact pinned crate hashes │
│ ├── GitHub OIDC / Sigstore Keyless Attestation (actions/attest) │
│ └── Machine-verifiable Policy Check (IMG-1 through IMG-11) │
└────────────────────────────────────────────────────────────────────────────────────────┘
sccache default feature set pulls in AWS, Azure, Google Cloud, and Redis SDKs via Apache OpenDAL and reqwest. We compile sccache with --no-default-features for local disk caching only, mathematically eliminating the network stack from the compiler wrapper.cargo-auditable: Instead of persisting the full Cargo registry in the final image layer, dependencies are embedded directly into the ELF .dep-v0 section. Scanners (Syft, Trivy) read the binary directly, preserving 100% SBOM visibility without layer bloat.assert-sccache-build.sh) that halts compilation if network crates or un-VEXed crate versions are detected.Security scripts often suffer from false-positive confidence. Our test harness (tests/) implements mutation testing against our assertion gates:
* Systematically neuters each assert_* function to return 0 and verifies that the test suite catches the slipped violation.
* Enforces bidirectional synchronization: the OpenVEX statement and the pinned crate assertions cannot drift without failing unit tests.
* Full integration test suite verifies real multi-arch container builds against intentional pin-drift mutations.
policy/builder-image/)Releases are governed by a machine-verifiable policy schema (policy.json) evaluated by verify_builder_policy.py:
* Enforced Rules (IMG-1 to IMG-11): Cryptographic attestation verification, pinned action commit SHAs, digest-pinned base images, SBOM/VEX parity, and annotated Gitsign signatures.
* Explicit Trust Roots (TRU-1 to TRU-4): Transparently defines the boundaries of the threat model (e.g., trust in Alpine signing keys and GitHub runner infrastructure).
Every published builder container and release asset includes a Sigstore cryptographic attestation linked to this repository's OIDC workflow identity.
gh attestation verify oci://ghcr.io/patrickryankenneth/python-wheels-builder-alpine:<digest> \
--owner patrickryankenneth
python3 .github/scripts/verify_builder_policy.py \
--policy policy/builder-image/policy.json \
--tag <release-tag> \
--tag-sha <commit-sha> \
--artifacts-dir /path/to/downloaded/assets \
--vex environments/alpine-3.24-musl/vex/builder.openvex.json \
--assets-file /path/to/assets.txt
pytest tests -q
pytest tests -q --integration
This project is built as an educational and operational reference for: * NIST SP 800-218: Secure Software Development Framework (SSDF) * SLSA (Supply-chain Levels for Software Artifacts): Level 3 Build Invariants * OpenVEX Specification: Transparent Vulnerability Exploitability Exchange
Patrick Ryan