Skip to content

flashnext ranks: every byte after the key proof crosses the pair's link in sealed records - #3076

Draft
ashhart wants to merge 8 commits into
security/rank-link-framesfrom
security/rank-link-frames-flashnext
Draft

ashhart wants to merge 8 commits into
security/rank-link-framesfrom
security/rank-link-frames-flashnext

Conversation

@ashhart

@ashhart ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What this changes

Before: after the key proof the Flash Next pair's control link ran in clear text, so a host on the path read the frame headers and the forward frames' token ids and could change them. After: both ranks send every byte after the proof in the rank seal's ChaCha20-Poly1305 records, and a record that does not open ends the link.

Checks on this head

  • Head commit: 4ebf3565973d77a366cd0defa195d639a4ea4827
  • 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 check-native-cuda-host compile-flashnext-mtp-parity-host compile-glm-native-open: 11/11 steps succeeded
    • zig build test-cuda-host: 391/391 steps succeeded; 6268/6309 tests passed (41 skipped)
    • zig build native: 66/66 steps succeeded
    • zig build test-rank-auth-host test-tp: 18/18 steps succeeded
    • zig build test-golden test-server-security test-pull-security: 76/76 steps succeeded
    • the link's tests are Linux-only: built for aarch64 Linux and run in a throwaway VM, all 4 passed
  • New tests:
    • security: the pair's frames cross sealed, and a bit changed on the way ends the link
  • CI: runs on this push.
  • Not run, and why: Nothing ran on a GPU 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 two CUDA hosts.
  • Boxes it reaches: the Flash Next pair on CUDA, both ranks.
  • 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 in a Linux VM. On macOS they compile and skip.
  • Exactness: not measured. One sealed record for each send. No kernel, no arithmetic and no frame's content 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 the parent's head, in the same VM, the new relay test fails: the host on the path sees the frame magic and the payload in clear (3 of 4 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

  • A test's socket pair, on which no proof ran, has no seal and stays clear. Every link open returns has one.
  • zig/src/families/flashnext/cuda_rank_wire.zig is a pinned serving source. Its hash on this head is d1fb41b640a7eb6b30d272b9bc95e55a1a11fb0f2f115037243170a4788c22d6, for the re-pin after merge.
  • Still clear after this: the tensor-parallel bootstrap, plan and liveness links, and the NCCL traffic.
  • The lean count is against ranks: every rank connection proves a shared key before its first protocol byte #3041's head.

Suggested changelog line

Flash Next on CUDA: every byte after the key proof crosses the pair's control link in sealed records.

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Review: the same record layer as #3075, on the Flash Next pair's link. The Seal is held by pointer, so the link's copy inside Collective shares its counters. A failed record returns RankDisconnected. On cost, about 13 µs per command round trip on the critical path, about 50 µs a round, under 0.5% of a GB10 round.

Before landing:

  1. Rebase onto the fixed hip ranks: every byte after the key proof crosses the link in sealed records #3075 and ranks: every rank connection proves a shared key before its first protocol byte #3041's current head. There is a real conflict in cuda_rank_wire.zig proven(), where ranks: every rank connection proves a shared key before its first protocol byte #3041 added peer-address logging; keep both that logging and the ?auth.Key return.
  2. Lengthen the test secret. At :469 it is 22 bytes; it needs at least 32.
  3. Re-pin the serving-source hash after the rebase.
  4. Run it on two GB10s at TP=2 with a key on both. Base is ranks: every rank connection proves a shared key before its first protocol byte #3041, new is ranks: every rank connection proves a shared key before its first protocol byte #3041 plus hip ranks: every byte after the key proof crosses the link in sealed records #3075 and this, with T=0 tokens byte-identical to base and speed level.

We'll do the first three and the run.

  • 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 force-pushed the security/rank-link-frames-flashnext branch from 4ebf356 to bed1a8a Compare November 12, 2026 23:39
@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto the fixed #3075 and #3041's current head, now at bed1a8a:

Results:

  • check-native-cuda-host and compile-cuda-tests for Linux: 16/16 steps.
  • test-rank-auth-host, test-tp and test-stage: 224/227 tests (3 skipped).
  • test-gradient-serving: fails only on the cuda/experts.zig row, which is already stale on main and is fixed by ci: the serving pins run on every PR; re-pin experts.zig after #2843 #3011.
  • The Flash Next wire tests run only on Linux, so here they were compiled but not run.

Next: the two-GB10 run at TP=2 with a key on both, against #3041. This lands after #3041 and #3075.

  • Synthena (Ash's Agent)

…tocol byte

The TCP links between the ranks of a multi-GPU group took whichever host connected first. Both ends now
send a fresh nonce and an HMAC-SHA256 over the nonces, the link, the rank and the group size, on the
bootstrap, the liveness lines, the HIP link and the Flash Next pair. A connection that fails is closed
and cannot stop the group. Ranks with no key meet on one host only. TF_RANK_SECRET_FILE or --rank-secret
names the key file. Later frames are not signed and the links are not encrypted.
… gets 2 s

- The key file opens through symbolic links, as secret mounts give it; the type and
  mode checks still run on the opened file, so a link to a file others can read is
  refused.
- Rank keys need 32 bytes after trailing whitespace. The shared loader takes the
  minimum from its caller: rank links pass 32 and the stage ring keeps its 16, so
  every stage ring that starts today keeps starting.
- A missing, different or short key's error names serve --rank-secret FILE and a
  one-line command that makes a key.
- Rank 0 logs each refused connection with the peer's address and the reason.
- An acceptor waits 2 s for the hello, so a silent connection no longer holds the
  serial accept for the whole 10 s budget.
- The Flash Next CUDA rank device test passes the new secret argument to Link.open.
…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.
…nk in sealed records

After the proof the Flash Next pair's control link ran in clear text, so a host on the path read the frame
headers and the forward frames' token ids and could change them. Both ranks now send every byte after the
proof in the rank seal's ChaCha20-Poly1305 records. A record that does not open ends the link. A test's
socket pair, on which no proof ran, has no seal and stays clear. The tensor-parallel bootstrap, plan and
liveness links and the NCCL traffic are still clear.
@ashhart
ashhart force-pushed the security/rank-link-frames branch 3 times, most recently from 3c7b2a9 to 1c79eff Compare November 23, 2026 19:47
@ashhart
ashhart force-pushed the security/rank-link-frames branch 2 times, most recently 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