feat(wsserver): E2E PAKE handshake — X25519 ECDH + AES-256-GCM - #102
Merged
Conversation
The Test job in release.yml was failing because HERMES_NODES_TOKEN_KEY is required by the internal auth token system but was not set in CI. Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Server-side counterpart to Go client E2E handshake: - New e2e.py: X25519 keygen, ECDH, HKDF-SHA256 key derivation, HMAC proof verification, AES-256-GCM encrypt/decrypt - server.py: ECDH exchange in hello_ack, proof verification in auth, session key derivation after auth_ok - Encrypted send/receive wrappers in message dispatch loop - Ping/pong responses encrypted via local _send wrapper - Old clients without e2e flag fall back to plaintext auth - All 14 existing tests still pass Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
Add End-to-End Encryption section: token never on wire, forward secrecy, MITM resistance, backward compatibility. Link to full e2e-spec.md. Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
…e.UTC) `ruff check --fix` resolved 63 auto-fixable issues: - I001 import block sorting - RUF022 __all__ alphabetical ordering - UP017 datetime.UTC alias - UP035 collections.abc imports - UP041 asyncio.TimeoutError → builtin TimeoutError 59 remaining (BLE001 blind exceptions, S110 try-pass, N999 module names) are pre-existing patterns and need manual review. Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
- Add [tool.ruff.lint] config: ignore BLE001 (codebase pattern), N999 (hyphens) - Add per-file-ignores for scripts/run_server.py EXE001 (shebang) - Fix S110: add noqa to intentional try-except-pass blocks - Fix PYI045: __iter__ returns Iterator not Iterable - Fix TRY401: remove redundant exc from logger.exception() - Fix TRY004: ValueError → TypeError for type check - Fix SIM103: return condition directly - Fix DTZ005: add tz= argument to datetime.now() - Fix RUF022: sort __all__ alphabetically - Fix F401: remove unused Iterable import All 14 tests pass. Ruff: clean. Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Server-side counterpart to the Go client E2E handshake. Implements the full PAKE-style handshake: X25519 ECDH → HKDF with pairing token → HMAC mutual auth → AES-256-GCM encryption for all operational messages.
Changes
wsserver/e2e.py(new) — X25519 keygen, ECDH, HKDF-SHA256 key derivation, HMAC proof generation/verification, AES-256-GCM encrypt/decryptwsserver/server.py— ECDH exchange inhello_ack, proof verification inauth, session key derivation afterauth_ok. Encrypted send/receive wrappers in message dispatch loop. Ping/pong responses encrypted via local_sendwrapper. Old clients withoute2eflag fall back to plaintext authdocs/e2e-spec.md(new) — Full protocol specification: handshake flow, cryptographic primitives, message structures, error codes, MITM/replay analysisREADME.md— Document E2E encryption with security properties table.github/workflows/release.yml— Fernet key for release workflowSecurity properties
auth_err(4001)e2e: truefall back to legacy plaintext authTest plan
All 14 existing tests still pass. The handshake is backward compatible — old clients without
e2e: truenegotiate plaintext auth.