|
| 1 | +# BoundaryAttest-gated export/import |
| 2 | + |
| 3 | +This optional example signs an exact `agentenv export` bundle with |
| 4 | +[BoundaryAttest's Python Interop Profile v0.1 example][interop], then refuses to |
| 5 | +run `agentenv import` until all of these checks pass: |
| 6 | + |
| 7 | +1. BoundaryAttest accepts the strict three-field envelope, expected Ed25519 |
| 8 | + public key, canonical claim, and signature. |
| 9 | +2. The claim says `server_attested`, `agentenv.export_bundle`, `success`, and a |
| 10 | + supported `export_kind` (`full_dag` or `snapshot`). |
| 11 | +3. SHA-256 of the received bundle bytes matches `claim.artifact_hash`. |
| 12 | +4. `agentenv import` reads the same private staged copy that was hashed. |
| 13 | + |
| 14 | +The final step avoids a check/use race: changing the received path after it was |
| 15 | +hashed cannot switch the bytes that agentenv imports. |
| 16 | + |
| 17 | +## Run the fixture |
| 18 | + |
| 19 | +Keep BoundaryAttest as a separate checkout; no Python or crypto dependency is |
| 20 | +added to the agentenv binary. This example is tested against BoundaryAttest |
| 21 | +commit `89c6c4706b368651c2549d7e43de08c24f3079e5`. |
| 22 | + |
| 23 | +```bash |
| 24 | +git clone https://github.com/cullenmeyers/BoundaryAttest.git /tmp/BoundaryAttest |
| 25 | +git -C /tmp/BoundaryAttest checkout 89c6c4706b368651c2549d7e43de08c24f3079e5 |
| 26 | + |
| 27 | +make verify-boundaryattest BOUNDARYATTEST_DIR=/tmp/BoundaryAttest |
| 28 | +``` |
| 29 | + |
| 30 | +The Docker target creates a parent with two branch tips, tags candidate B as |
| 31 | +`winner`, exports the complete DAG, signs its digest, verifies and imports it |
| 32 | +into an empty root, and checks that HEAD, both branches, the tag, and their files |
| 33 | +survived. It also proves that import is not reached for: |
| 34 | + |
| 35 | +- a one-byte bundle change (`artifact_hash_mismatch`); |
| 36 | +- an edited signed claim (`invalid_signature`); |
| 37 | +- a different expected key (`public_key_id_mismatch`); |
| 38 | +- an extra envelope field (strict-envelope rejection); and |
| 39 | +- a validly signed `client_observed` claim (agentenv semantic-policy rejection). |
| 40 | + |
| 41 | +On Linux, the same fixture can run without Docker: |
| 42 | + |
| 43 | +```bash |
| 44 | +python3 -m venv /tmp/agentenv-boundaryattest-venv |
| 45 | +/tmp/agentenv-boundaryattest-venv/bin/pip install \ |
| 46 | + -r /tmp/BoundaryAttest/examples/python-interop-v0.1/requirements.txt |
| 47 | +go build -o /tmp/agentenv . |
| 48 | + |
| 49 | +PATH=/tmp/agentenv-boundaryattest-venv/bin:$PATH \ |
| 50 | + bash examples/boundaryattest-export/demo.sh \ |
| 51 | + /tmp/BoundaryAttest/examples/python-interop-v0.1 /tmp/agentenv |
| 52 | +``` |
| 53 | + |
| 54 | +## Adapter usage |
| 55 | + |
| 56 | +The receiver supplies the bundle, receipt, an independently trusted public key, |
| 57 | +an empty destination root, and a local BoundaryAttest reference checkout: |
| 58 | + |
| 59 | +```bash |
| 60 | +python3 examples/boundaryattest-export/verify_and_import.py \ |
| 61 | + environment.agentenv.gz \ |
| 62 | + environment.agentenv.gz.receipt.json \ |
| 63 | + host-public-key.pem \ |
| 64 | + --interop-dir /path/to/BoundaryAttest/examples/python-interop-v0.1 \ |
| 65 | + --agentenv /usr/local/bin/agentenv \ |
| 66 | + --import-root /fresh/agentenv-root |
| 67 | +``` |
| 68 | + |
| 69 | +The signer and receipt store belong outside the rewindable rootfs. The checked-in |
| 70 | +BoundaryAttest demo key is only a deterministic test fixture; use a separately |
| 71 | +managed host/orchestrator key in a real handoff. |
| 72 | + |
| 73 | +Passing this gate proves that the expected key signed the claim and that the |
| 74 | +imported bytes match its artifact digest. It does not prove the claim was true, |
| 75 | +the export was authorized, the internal snapshots are tamper-evident, or either |
| 76 | +runtime was uncompromised. |
| 77 | + |
| 78 | +[interop]: https://github.com/cullenmeyers/BoundaryAttest/tree/main/examples/python-interop-v0.1 |
0 commit comments