Skip to content

feat(transport): encrypt every frame between coordinator and volunteers (F3) - #21

Merged
aien-spark merged 1 commit into
mainfrom
feat/encrypted-transport
Oct 16, 2026
Merged

aien-spark merged 1 commit into
mainfrom
feat/encrypted-transport

Conversation

@aien-spark

Copy link
Copy Markdown
Collaborator

Evidence

cargo test --workspace --verbose: every suite ok, 0 failed. oh-core 61 passed (11 new transport tests); beacon-core 19 passed (3 new); new encrypted_transport integration test 1 passed; existing loopback (4) and teaching (3) tests pass over the encrypted link.
cargo clippy --workspace --all-targets: no new warnings (the 3 existing ones are in beacon-core cuckoo/lib and beacon-client, untouched code).
cargo audit: 0 vulnerabilities, 252 crates (main after #19). No new dependencies; Cargo.lock unchanged.
cargo fmt --check clean for the oh-* crates; beacon-core edits are additions only.

Tests:

  • Round trip both directions, wire frames pass through unchanged.
  • Tampered ciphertext rejected; tampered length header rejected; stream stays closed after a bad record.
  • Replayed record rejected (checked red by forcing the receive nonce to 0: the replay test failed, then restored).
  • Reordered records rejected; a record reflected back to its sender rejected (separate key per direction).
  • Wrong pinned coordinator key refused; trust on first use accepts and reports the key; a coordinator hello signed for another session refused; wrong version refused.
  • Eavesdropper: a relay records every byte of a full serve round (one training volunteer, one teaching volunteer). No 16-byte run of the training shards and none of the teaching text appear; negative control: the same check finds both in plain frames.

Demos: scripts/demo-local.sh (ROUNDS=2 STEPS=50 DIM=16 SEEDS=1): 6 of 6 updates accepted over the encrypted link. scripts/demo-teach.sh against a throwaway fake chat server (the Qwen server was down): batch 1 accepted, +824.615 T; batch 2 refused as a replay because the fake server repeats its text.

What changed

  • beacon-core: EphemeralKeyAgreement (x25519-dalek, refuses non-contributory results) and SessionCipher (chacha20poly1305 with caller nonce and associated data), plus BeaconError::KeyAgreementFailed. Thin wrappers only; no new crypto math.
  • oh-core transport: two-message handshake (fresh X25519 per connection, each hello signed with the Ed25519 identity; the coordinator signs over the volunteer's hello too), keys from BLAKE3 derive_key over the shared secret and the hash of both hellos, and EncryptedStream (Read + Write; each flush is one sealed record with a 64-bit counter nonce per direction).
  • Coordinator::serve runs the handshake on every connection (30 s limit; failures are logged and do not take a slot).
  • oh-volunteer: refuses to connect without --coordinator-key unless --trust-first-use (prints a warning naming the key, then pins it); work units must be signed by the key proven in the handshake.
  • Both demo scripts read the coordinator key from its start line and pin it.
  • Docs: new "Encrypted transport" section in volunteer-compute-v0.md; teacher doc and README updated; "not encrypted in transit" removed from the not-built lists.

Not built

  • A lasting coordinator identity (a new key every start).
  • Hiding record sizes and timing.
  • Checking volunteer identities (anonymous by design).
  • Protection against stalled handshakes beyond the 30 s limit.

Zero secrets: none in this diff.

🤖 Generated with Claude Code

Handshake at connect: each side sends a fresh X25519 key signed with its
Ed25519 identity (the coordinator's signature also covers the volunteer's
hello). The volunteer checks the coordinator key against
--coordinator-key, or accepts it on first use only with
--trust-first-use (prints a warning). Per-direction keys from BLAKE3
derive_key; records are ChaCha20-Poly1305 with the length header as
associated data and a per-direction 64-bit counter nonce, so tampered,
replayed, reordered or reflected records fail to open.

beacon-core gains EphemeralKeyAgreement and SessionCipher, thin wrappers
over the x25519-dalek and chacha20poly1305 crates it already uses.
Coordinator::serve runs the handshake on every connection; both demos
pass the printed coordinator key.

Co-authored-by: Drake Stapleton <drake@aien.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

⚖️ Sovereign Code Review & Alignment Gate

Greetings @aien-spark. I am AIEN, the automated review gate for the AIENOS project.

Your pull request #21 ("feat(transport): encrypt every frame between coordinator and volunteers (F3)") has undergone automated auditing against the project standards.

✅ Doctrine Diff Audit: PASS

  • Telemetry Check: Clean (zero tracking or surveillance hooks detected).
  • Sovereign Voice & Formatting Check: Clean (zero em/en dashes, zero banned buzzwords).
  • Secrets & Credentials Check: Clean (zero plaintext secrets, hardware vault only).
  • Status: Project standards verified.

🌿 Sovereign Steward: Contributor Alignment Interview

Greetings @aien-spark. I am AIEN, the automated steward for the AIENOS project.

We welcome all contributors who share our commitment to open collaboration, global humanity, and disciplined systems craftsmanship. We build to expand computing capability, advance open-source intelligence, and share technology freely with the world.

Your pull request #21 ("feat(transport): encrypt every frame between coordinator and volunteers (F3)") is ready for stewardship alignment.

Please respond directly to these four alignment inquiries:

  1. Long-Term Mission Alignment:
    This initiative is an enduring engineering commitment to open-source technology for humanity, not a vehicle for short-term hype, social media monetization, or get-rich-quick ventures. How does your contribution support global progress and the resilience of local communities?

  2. Telemetry & Integrity:
    Do you certify that this change introduces zero telemetry, zero surveillance, and zero artificial paywalls?

    "I certify that my contribution is submitted in service of human sovereignty and open collaboration. I affirm that this work maintains zero telemetry, contains no surveillance backdoors, and introduces no artificial barriers, and that I offer it under AGPL-3.0-or-later, the license that governs this project. I build so that intelligence is owned by the person who runs it, not rented."

  3. Downstream Heritage Preservation:
    Do you acknowledge and agree that any downstream branch, fork, or copy of this work remains under AGPL-3.0-or-later and retains the project's license and attribution notices, as the LICENSE file requires?

  4. Craftsmanship & Native Discipline:
    What architectural trade-offs did you make, and how did you verify that this code introduces zero regressions, zero unneeded dependencies, and complies with our pure native compiled standards?


Reply to this comment with your affirmation. Once verified against the project standards, I will grant the sovereign-interview-passed clearance. For direct sovereign coordination: Drake Stapleton (drake@aienos.com) and AIEN (aien@aienos.com)

@github-actions github-actions Bot added needs-testimony Contributor testimony required sovereign-audit-passed Constitutional diff audit passed labels Oct 16, 2026
@aien-spark
aien-spark merged commit 01405f4 into main Oct 16, 2026
3 checks passed
@aien-spark
aien-spark deleted the feat/encrypted-transport branch October 16, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-testimony Contributor testimony required sovereign-audit-passed Constitutional diff audit passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants