Skip to content

docs(adr): draft ADR-0021 — Phase 1 KEXINIT negotiation profile - #46

Merged
gonzafg2 merged 12 commits into
mainfrom
docs/adr-0021-negotiation-profile
Jun 11, 2026
Merged

gonzafg2 merged 12 commits into
mainfrom
docs/adr-0021-negotiation-profile

Conversation

@gonzafg2

@gonzafg2 gonzafg2 commented Jun 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds ADR-0021, which assembles the complete ten-name-list SSH_MSG_KEXINIT profile that RFC-0003's greenfield transport advertises in Phase 1. This is the single authoritative reference the kex module (TBD) and the ADR-0020 interop assertions point at, instead of the profile being scattered across RFC-0003, the README, and the threat model.

Motivation

RFC-0003 chose the stack; the README and threat model §6.1 state pieces of the wire posture; but nothing assembled the exact strings, order, and failure behaviour an implementer must hard-code. ADR-0021 does that. It re-opens no algorithm choice — it fixes the operational detail.

The profile, in brief:

Name-list Value
kex_algorithms mlkem768x25519-sha256, [email protected]
server_host_key_algorithms ssh-ed25519
encryption_* (both) [email protected], [email protected]
mac_* (both) [email protected] (nominal only)
compression_* (both) none
languages_* (both) empty

Non-hybrid client → SSH_DISCONNECT_KEY_EXCHANGE_FAILED, no fallback. The same disconnect applies to a failed intersection on any other required name-list, and to a missing [email protected] in the client's initial KEXINIT.

Two points that need your eye as reviewer

  1. Divergence from RFC-0003's crate list. RFC-0003 §"Guide-level explanation" lists nine primitive crates including hmac. ADR-0021 decides to omit hmac from the Phase 1 Cargo.toml: with an AEAD-only cipher list, MAC selection is structurally skipped (per the [email protected] and OpenSSH AES-GCM specs), so HMAC code never runs. This is an operational refinement of the RFC, not a contradiction. The nominal MAC name stays aligned with RFC-0003 ([email protected]), so no algorithm choice is re-opened. hmac returns only if a non-AEAD cipher is ever added (an RFC-gated change).
  2. SSH_MSG_EXT_INFO scope. Phase 1 honours it minimally and gated on the client: one SSH_MSG_EXT_INFO with server-sig-algs = ssh-ed25519, sent only when the client's initial KEXINIT offers ext-info-c (RFC 8308). The server does not advertise ext-info-s — that marker would oblige it to accept client extensions Phase 1 makes no use of, and it is not what enables the server's send. Justified by the ADR-0020 interop gate depending on a clean OpenSSH handshake.

Review changes (32851ab)

The first review pass (15 inline threads) was addressed in 32851ab: selection rule corrected to RFC 4253 §7.1 (client's list wins), ext-info-s dropped and the EXT_INFO send gated on ext-info-c, marker pseudo-algorithms excluded from selection and the failure predicate, kex-strict-c scoped to the initial KEXINIT with per-NEWKEYS sequence resets and the unexpected-packet rule, the strict-kex rejection bound to reason code 3, the nominal MAC aligned with RFC-0003 (512), MAC-under-AEAD stated as skip-and-ignore, the threat-model §5.2 invariants carried as binding decisions, and the future-artefact references tightened.

Type of change

  • Documentation only

Checklist

  • Commits signed off under the DCO (git commit -s).
  • Conventional Commits.
  • Documentation updated (this ADR is the change).

Security considerations

This ADR is the cryptographic-posture-on-the-wire decision. It encodes: hybrid PQ KEX only, no downgrade (SSH_DISCONNECT_KEY_EXCHANGE_FAILED), strict-kex required (Terrapin / CVE-2023-48795 defence) including the unexpected-packet termination rule, AEAD-only ciphers, no compression, no legacy, abort on either hybrid half failing, and KEXINIT payloads bound into the exchange hash. Aligned with threat model §5.2 and §6.1.

Notes for reviewers

Status is Proposed; it advances to Accepted when the first Phase 1 crate lands, matching ADR-0016–0020. Numbering assumes 0021 is free — main's CLAUDE.md already links this exact path, so the number is effectively reserved.

Related issues

Assembles the complete ten-name-list SSH_MSG_KEXINIT profile that
RFC-0003's greenfield transport advertises: mlkem768x25519-sha256 as
the only key exchange, ssh-ed25519 host keys, chacha20-poly1305 +
aes256-gcm AEAD ciphers, no compression, strict-kex required, and
SSH_DISCONNECT_KEY_EXCHANGE_FAILED on a non-hybrid client.

Settles two fine points: (1) because both ciphers are AEAD the MAC
name-list is never exercised, so [email protected] is
nominal and the `hmac` crate is omitted from the Phase 1 Cargo.toml
until a non-AEAD cipher is ever introduced; (2) ext-info-s is honoured
minimally with server-sig-algs = ssh-ed25519 for clean OpenSSH interop.

Refines RFC-0003's primitive-crate list (which named `hmac`) at the
operational level; enforced end-to-end by ADR-0020's interop gate.

Signed-off-by: Gonzalo Fleming <[email protected]>
Copilot AI review requested due to automatic review settings June 11, 2026 01:06
@gonzafg2 gonzafg2 added documentation Improvements or additions to documentation security Security-sensitive issue or change labels Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new ADR (0021) that centralizes and fixes the Phase 1 SSH_MSG_KEXINIT negotiation profile as the single authoritative reference for the project’s on-the-wire cryptographic posture.

Changes:

  • Introduces ADR-0021 describing the complete ten name-lists for Phase 1 KEXINIT, including required strict-kex behavior and explicit failure semantics.
  • Documents AEAD-only cipher posture, nominal MAC list handling, and the resulting Phase 1 dependency implications (e.g., omitting hmac).
  • Specifies minimal ext-info-s handling to support clean OpenSSH interop expectations referenced by ADR-0020.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gonzafg2 added 3 commits June 10, 2026 21:46
Three precision/consistency fixes from the PR #46 review:

1. Related header — `transport.rs`/`kex.rs` were referenced as if they
   already exist. Reworded as "Planned implementation (TBD)" since the
   first crate has not landed.
2. Context — "mac_algorithms negotiation skipped entirely" could read
   as "the field is not sent". Clarified: the MAC name-lists ARE sent
   in KEXINIT; under an AEAD cipher the negotiation result is discarded
   (no MAC computed or applied).
3. Links — "Code that implements this decision" pointed at non-existent
   paths. Aligned with ADR-0020's "Implementation: TBD" pattern.

No change to the decision itself.

Signed-off-by: Gonzalo Fleming <[email protected]>

@gonzafg2 gonzafg2 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — perfil de negociación KEXINIT

El ADR está bien armado como assembly y la mayoría de sus referencias cruzadas verifican. Encontré 15 hallazgos (comentarios inline): 4 de severidad alta — errores de protocolo que, hard-codeados tal cual en kex.rs, rompen interop real o abren la clase de bug accept-and-branch (líneas 18, 58, 59, 60) —, 6 medios (consistencia con RFC-0003 / threat model / CLAUDE.md y semántica de specs) y 5 menores (claridad y mantenibilidad de un documento que será inmutable). Todos los hallazgos de protocolo fueron verificados contra las fuentes primarias: RFC 4253, RFC 8308, OpenSSH PROTOCOL (§1.9/1.10 strict-kex, §1.6 AES-GCM), draft-miller-sshm-aes-gcm, draft-ietf-sshm-chacha20-poly1305 y kex.c de openssh-portable.

Sobre los dos puntos que flaggeaste en la descripción:

  1. Omisión del crate hmac: el lane ADR es correcto — docs/rfcs/README.md ruta las decisiones subsidiarias de dependencias a ADRs, y reducir la base de confianza no gatilla ningún trigger RFC. Lo que sí encontré en ese cluster es otra cosa: el nombre del MAC cambia respecto del RFC-0003 aceptado (HMAC-SHA2-512-ETM en rfcs/0003:86, texto vigente de «What does not change») y ese delta no está declarado en ninguna parte (comentario en línea 42).
  2. Scope de ext-info-s: el problema resultó ser más profundo que el de fase — la semántica está invertida respecto de RFC 8308 (comentario en línea 59). Mi sugerencia: dropear ext-info-s de la lista KEX y gatear el envío de SSH_MSG_EXT_INFO en el ext-info-c del cliente, que es lo que realmente lo habilita; eso además reduce el scope que te preocupaba.

Verificado y descartado (no hace falta tocar): draft-ietf-sshm-mlkem-hybrid-kex-10 es la revisión vigente; el claim del default KEX de OpenSSH 10.x es verbatim de sus release notes; «small attack surface» es el título exacto del compromiso #4 en README.md:48; el issue #42 sí cubre ML-KEM-1024 y la política de ciphers; reason code 3, secciones del threat model, nombres de archivos ADR/RFC y los IDs de test de ADR-0020 coinciden.

- State the RFC 4253 §7.1 selection rule correctly (client's list wins)
- Drop ext-info-s; gate the EXT_INFO send on the client's ext-info-c
- Exclude marker pseudo-algorithms from selection and the failure check
- Scope kex-strict-c to the initial KEXINIT; reset both sequence
  numbers after every NEWKEYS; add the unexpected-packet rule
- Fix the disconnect reason code for the strict-kex rejection path
- Align the nominal MAC with RFC-0003 ([email protected])
- State MAC-under-AEAD as skip-and-ignore, never a connection failure;
  extend the explicit-failure rule to host-key and cipher lists
- Carry the threat-model §5.2 invariants (hybrid-half abort, KEXINIT
  binding + mutation test)
- Tighten claims and future references (ADR-0020 scope, kex module TBD,
  supersede-not-touch, RFC-gated lane for a non-AEAD cipher)

Signed-off-by: Gonzalo Fleming <[email protected]>
gonzafg2 added a commit that referenced this pull request Jun 11, 2026
…gs (#56)

The plugin's command is explicit (step 7): 'If --comment argument was
NOT provided, stop here. Do not post any GitHub comments.' Our prompt
never passed it, so every review ran to completion and printed its
findings only to the job log — confirmed by the PR #46 run transcript
(run 27358953209), which ends with 'No --comment flag provided — no
GitHub comments posted' right after compiling four findings.

Companion to #55: that PR mounted the github_inline_comment MCP server
the posting step needs; this one flips the plugin's own posting switch.

Signed-off-by: Gonzalo Fleming <[email protected]>
@claude

claude Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

…time exclusion

Two refinements from the CI reviewer's transcript (run 27358953209):

- State explicitly that a first_kex_packet_follows guessed packet is
  announced by the flag and therefore not an 'unexpected packet' under
  the strict-kex termination rule — two reviewer runs read the previous
  wording in opposite ways, so the ambiguity was real even though the
  behaviour (OpenSSH skips the wrong guess with strict kex active) was
  correct as written.
- Carry MANIFIESTO #3's 'compiled out, not merely configured off'
  obligation as an explicit binding decision: the advertised name-lists
  are the complete compiled-in algorithm set.

Signed-off-by: Gonzalo Fleming <[email protected]>
@gonzafg2
gonzafg2 merged commit 4e93f3c into main Jun 11, 2026
7 checks passed
@gonzafg2
gonzafg2 deleted the docs/adr-0021-negotiation-profile branch July 18, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation security Security-sensitive issue or change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants