Skip to content

hip ranks: every byte after the key proof crosses the link in sealed records - #3075

Open
ashhart wants to merge 3 commits into
security/rank-link-keyfrom
security/rank-link-frames
Open

ashhart wants to merge 3 commits into
security/rank-link-keyfrom
security/rank-link-frames

Conversation

@ashhart

@ashhart ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What this changes

Before: the key proof of #3041 showed which process connected, and then the ROCm ranks' command link ran in clear text, so a host on the path read rank 0's words and could change them. After: both ends seal every byte after the proof in ChaCha20-Poly1305 records under keys derived from the proof's session key, one for each direction, with the record's place in its direction as the nonce. A record altered, replayed, moved, sent back or sealed under another key does not open, and the link closes.

Checks on this head

  • Head commit: 3ce5b18424440cc15a8ce321654346aaf4098154
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 345 on the base, 345 on this head, 0 new.
  • Tests run, with the command and pass, fail and skip counts:
    • zig fmt --check and git diff --check: pass
    • zig build test-rank-auth-host test-tp test-stage test-cli: 85/85 steps succeeded; 139/156 tests passed (17 skipped)
    • zig build -Dhip=true test-rank-link-hip-host check-native-hip-host test-native-hip-host test-environment-hip-host test-hip-family-offers-host: 19/19 steps succeeded; the link's 13 tests pass
    • zig build check-native-cuda-host compile-flashnext-mtp-parity-host compile-glm-native-open: 11/11 steps succeeded
    • zig build native: 66/66 steps succeeded
    • zig build test-server-cpu: 5/5 steps succeeded; 1326/1333 tests passed (7 skipped)
    • zig build test-golden test-server-security test-pull-security: 76/76 steps succeeded
    • the handshake module's tests built for aarch64 Linux and run in a throwaway VM: all 41 passed
  • New tests:
    • rank seal: bytes sealed at one end open at the other, across records and in both directions
    • security: a record altered, replayed, moved, sent back or sealed under another key does not open
    • security: the wire shows none of the bytes a record carries
    • security: rank 0's words cross the link sealed, and a bit changed on the way closes it
  • CI: runs on this push.
  • Not run, and why: Nothing ran on a ROCm device or between two hosts. zig build test and every step that runs on a GPU were not run: this Mac's GPU was serving a model, and no CUDA, ROCm or Intel hardware was available.

Receipt

  • Main against branch: could not be run. It needs a ROCm group of two ranks.
  • Boxes it reaches: a ROCm group's command link, on rank 0 and on every follower.
  • New switch? Default, accepted values, profile row: none. The key is ranks: every rank connection proves a shared key before its first protocol byte #3041's TF_RANK_SECRET_FILE.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: this head on Zig 0.17.0, on an Apple silicon Mac, CPU-only steps. No GPU and no checkpoint was used.
  • Paths and platforms the change reaches, which I ran and which I could not: the link's tests over loopback on macOS, with the real ROCm server compiled against stub kernels.
  • Exactness: not measured. One sealed record for each part of a message. No kernel, no arithmetic and no word of a message changes.
  • Main against this branch, same machine and checkpoint: not run, for the reason above.
  • Decode speed before and after: not measured.
  • Prompt speed before and after: not measured.
  • Licence of any new weights or drafter: n/a.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. On ranks: every rank connection proves a shared key before its first protocol byte #3041's head the new relay test fails: the host on the path reads rank 0's words in clear (12 of 13 tests pass).
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

For a change that reaches inference:

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. Not measured: no served run.
  • No precision traded for speed.
  • Decode and prompt processing are no slower than main. Not measured: no served run.

Notes for the reviewer

  • rank_seal.zig holds the record layer, for the other rank links to use.
  • A group with no key meets on one host only. Its records are sealed under the no-key session, which is public, so they hide nothing there.
  • Still clear after this: the tensor-parallel bootstrap, plan and liveness links on CUDA, and the NCCL, RCCL and RDMA traffic on every backend. SECURITY.md says so. The bootstrap's sockets pass to the TCP tensor transport, the plan link and the fate watcher, which read them with their own framing, so sealing those is a change to that transport and wants its own review.
  • The lean count is against ranks: every rank connection proves a shared key before its first protocol byte #3041's head.

Suggested changelog line

ROCm ranks: every byte after the key proof crosses the command link in sealed records, so a host on the path can neither read nor change it.

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Review: the record layer is sound. It's ChaCha20-Poly1305 with the length as associated data, one key per direction derived from the session key, and fresh session randomness from both ends, so a reconnect never reuses a nonce. Replay, reordering, reflection and a wrong key all fail, with tests. On cost, a verify step of about 650 B pays two records, so at most about 35 µs a round, well under 1% of a decode round.

Before landing:

  1. Rebase onto ranks: every rank connection proves a shared key before its first protocol byte #3041's current head (41354b8). This sits on its first commit. The merge is textually clean, but ranks: every rank connection proves a shared key before its first protocol byte #3041 now needs 32-byte keys, so the relay test's 23-byte secret (link_test.zig:372) fails with SecretTooShort. Lengthen it.
  2. Don't seal a same-host group that has no key. Sealing under the public key hides nothing, and leaving it off keeps those links byte for byte as on main.

We'll push both.

  • Synthena (Ash's Agent)

@ashhart
ashhart force-pushed the security/rank-link-frames branch from 3ce5b18 to 16314b8 Compare November 12, 2026 23:39
@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto #3041's current head (41354b8) and fixed, now at 16314b8:

Results:

We have no AMD card, so the HIP path is covered by these host tests and the HIP nightly. This lands after #3041.

  • Synthena (Ash's Agent)

@ashhart
ashhart marked this pull request as ready for review November 13, 2026 00:06
@ashhart
ashhart force-pushed the security/rank-link-key branch from d4d101a to 051bbf0 Compare November 14, 2026 03:26
@ashhart
ashhart force-pushed the security/rank-link-frames branch from 16314b8 to a90c289 Compare November 14, 2026 03:27
@ashhart
ashhart force-pushed the security/rank-link-key branch from 051bbf0 to b604acf Compare November 17, 2026 09:05
@ashhart
ashhart force-pushed the security/rank-link-frames branch from a90c289 to e855d5e Compare November 17, 2026 09:06
@ashhart
ashhart force-pushed the security/rank-link-key branch from b604acf to 04cb5b8 Compare November 18, 2026 02:04
@ashhart
ashhart force-pushed the security/rank-link-frames branch 2 times, most recently from 5d1c7e7 to 89da63e Compare November 21, 2026 04:51
@ashhart
ashhart force-pushed the security/rank-link-key branch 2 times, most recently from 7693e45 to f78ed60 Compare November 21, 2026 14:38
@ashhart
ashhart force-pushed the security/rank-link-frames branch from 89da63e to f73e87e Compare November 21, 2026 17:38
@ashhart
ashhart force-pushed the security/rank-link-key branch from f78ed60 to 85da6c9 Compare November 21, 2026 19:34
@ashhart
ashhart force-pushed the security/rank-link-frames branch from f73e87e to 3c7b2a9 Compare November 21, 2026 23:50
@ashhart
ashhart force-pushed the security/rank-link-key branch from 85da6c9 to bf1d50b Compare November 23, 2026 19:43
@ashhart
ashhart force-pushed the security/rank-link-frames branch 2 times, most recently from 1c79eff to 784c302 Compare November 23, 2026 21:34
…records

The proof showed which process connected, and then the ROCm ranks' command link ran in clear text: a host
on the path read rank 0's words and could change them. Both ends now seal every byte after the proof in
ChaCha20-Poly1305 records under keys derived from the proof's session key, one for each direction, with
the record's place in its direction as the nonce. A record altered, replayed, moved, sent back or sealed
under another key does not open, and the link closes. rank_seal.zig holds the record layer for the other
rank links to use. The CUDA control links and the NCCL, RCCL and RDMA traffic are still clear.
@ashhart
ashhart force-pushed the security/rank-link-frames branch from 784c302 to ca9dfc3 Compare November 23, 2026 22:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant