Device authentication v2 for offline direct and relay Atems - #13
Conversation
Authenticate loopback, LAN, and identity-relay Atem clients with challenge proofs before registration or credential delivery. Add real WebSocket coverage, private storage, recursive log redaction, and an honest rollout/security specification. 🤖 Built with SMT <smt@agora.build>
Claude Code ReviewCode Review: Device Authentication v2Overall this is a well-structured, security-focused change with strong test coverage. Below are concrete findings. Security / Logic Findings1. Loopback scope classification ignores IPv4-mapped and other loopback forms inconsistently
case "127.0.0.1", "::1", "0:0:0:0:0:0:0:1", "::ffff:127.0.0.1":
self = .loopbackThe IPv4 loopback range is More importantly, 2.
|
Require the explicit local proof method, fail closed if secure randomness is unavailable, redact secrets from malformed log payloads, and cover legacy binding and cross-scope token rejection. 🤖 Built with SMT <smt@agora.build>
Deliver hub broadcasts across both authenticated transports, normalize camelCase secret keys during log redaction, cover truncated payloads, and log legacy session claims. 🤖 Built with SMT <smt@agora.build>
Run direct socket access on the NIO event loop, serialize relay broadcasts and pairing UI on main, and sanitize untrusted device labels before display or persistence. 🤖 Built with SMT <smt@agora.build>
Codex Code ReviewFindings
Residual Risk
|
Make direct and relay state confinement explicit, keep legacy session verification behind authentication, and reject oversized or malformed authentication fields before proof, persistence, or UI processing. 🤖 Built with SMT <smt@agora.build>
Validate bootstrap ownership, type, and permissions before reuse; replace insecure or symlinked tokens; and bound pending relay authentication challenges by count and lifetime. 🤖 Built with SMT <smt@agora.build>
Require the relay envelope identity to match the authenticated Atem, preserve established authentication across repeated hello messages, and serialize pairing prompts. Keep protocol fields and UTF-8 bounds consistent across transports. 🤖 Built with SMT <smt@agora.build>
Assign each relay WebSocket a server-generated connection ID, reject stale sockets and responses, and bind Astation authentication and delayed replies to that exact generation. Document the coordinated relay rollout and cover replacement cleanup. 🤖 Built with SMT <smt@agora.build>
🤖 Built with SMT <smt@agora.build>
🤖 Built with SMT <smt@agora.build>
What changed
Practical coverage
Verification
swift test(148 passed)cd relay-server && cargo test(180 passed)node --test --test-concurrency=1 .github/scripts/*.test.mjs(32 passed)git diff --checkCoordinated rollout
Requires Agora-Build/Atem#15. Merge both repositories before releasing either client. Old clients that send a session ID without proof cannot authenticate against v2.
Security status
Direct LAN still uses plaintext
ws://. HMAC prevents session-ID-only impersonation, but it does not protect first pairing or application traffic from LAN inspection/MITM. Do not call LAN production-ready until WSS certificate pinning lands. Relay-owner authentication, authenticated Voice/LLM/Vault/RTC APIs, direct unauthenticated connection/pairing admission bounds, and device revocation/rotation remain tracked blockers.Generated with SMT smt@agora.build