Repository navigation
ogar-encryption: sealed two-direction session stream - #360
Conversation
The generic form of a2ui-server's sealed frame transport, moved here so any consumer (MedCare first) can encrypt a live session without depending on a2ui-server. It sees bytes only; the caller supplies the associated data. Same wire form: [direction:1][counter:8 LE][ciphertext || tag], nonce [direction][counter LE][zero]. One change against the a2ui original: open refuses a message whose direction byte is not the one this half receives. Both directions share the key, so the original would accept a sender's own message reflected back to it. Also: the send counter refuses to wrap, and the key is wiped on drop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What
ogar_encryption::stream::SealedStream: one endpoint of a sealed, two-direction session stream. It is the generic form of a2ui-server's sealed frame transport, moved here so other consumers (MedCare first) can encrypt a live session without depending on a2ui-server. It handles bytes only; the caller passes the associated data.Wire form (unchanged from a2ui)
[direction:1][counter:8 LE][ciphertext || 16-byte tag], nonce[direction][counter LE][zero:15], XChaCha20-Poly1305 via the existingaeadre-export.One fix against the a2ui original
a2ui's
open_frametakes the direction from the blob and never checks it against the receiver. Both directions use the same key, so a sender's own message reflected back to it opens and is accepted as if the peer had sent it.SealedStream::openrefuses that (StreamError::WrongDirection). a2ui-server will move onto this module in a follow-up PR, which closes it there too.Also
CounterExhausted) instead of overflowing.Precondition (in the module docs)
One key per session. Counters restart at 0, so a key shared between two sessions reuses every nonce. Derive it from a fresh random salt.
Tests
8 new tests: round trip both ways, reflection, replay and reorder, wrong key / tamper / different AAD, forged counter, truncated / unknown direction, counter exhaustion, wire prefix layout. Disable runs: dropping the direction check fails the reflection test; allowing an equal counter fails the replay test.
🤖 Generated with Claude Code
https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Generated by Claude Code