Skip to content

fix(crypto): no expect() in StreamSession::derive — unblock the no-panic gate (canary red) - #1267

Merged
joelteply merged 1 commit into
canaryfrom
fix/session-kdf-no-expect
Jun 20, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/session-kdf-no-expect

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Unblocks canary

#1264's session.rs used hk.expand(...).expect("infallible"), which the workspace clippy::expect_used gate denies in --lib — canary went red, dinging every PR's gate (caught by BigMama on #8).

Fix: propagate instead of panic. expand_key + StreamSession::derive return Result (SessionError::KeyDerivation); the handshake maps to HandshakeError::KeyDerivation. HKDF-Expand of a fixed 32-byte output is genuinely unreachable-fail, but a Result is the gate-clean + future-proof shape. Tests .unwrap() (tests exempt from --lib).

Verified: 87 airc-protocol tests green, LAN proof green, clippy -p airc-protocol --lib clean.

🤖 Generated with Claude Code

…nic gate

#1264 landed session.rs with `hk.expand(...).expect("infallible")`, which the
workspace clippy gate denies (clippy::expect_used in --lib) — turning canary RED
and dinging every PR's gate. Caught by BigMama.

Propagate instead of panic: `expand_key` and `StreamSession::derive` now return
Result (SessionError::KeyDerivation); the handshake maps it to
HandshakeError::KeyDerivation. HKDF-Expand of a fixed 32-byte output is
genuinely unreachable-fail, but a Result is the gate-clean + future-proof
shape (no silent panic if the output size ever changes). Tests use .unwrap()
(tests are exempt from the --lib gate).

87 airc-protocol tests green, LAN proof green, `clippy -p airc-protocol --lib` clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 89c2bed into canary Jun 20, 2026
11 of 12 checks passed
@joelteply
joelteply deleted the fix/session-kdf-no-expect branch June 20, 2026 22:03
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