Skip to content

fix: enforce token expiry mid-session + macOS deploy reliability - #16

Open
jamierpond wants to merge 1 commit into
mainfrom
jp/fixes
Open

fix: enforce token expiry mid-session + macOS deploy reliability#16
jamierpond wants to merge 1 commit into
mainfrom
jp/fixes

Conversation

@jamierpond

Copy link
Copy Markdown
Owner

Summary

  • Token expiry enforcement: Server now re-checks device token expiry on every WebSocket message, not just during initial auth. Expired sessions are force-closed with code 4005.
  • Auth gate on list_projects: The list_projects WebSocket handler now requires authentication (was previously open to any connected device).
  • Client-side cleanup: WebSocket is immediately closed and nulled when device_expired is received, preventing any further communication during the 3s redirect delay.
  • macOS deploy reliability: Replaced PID-file based process management with port-based detection (lsof). Adds _kill_server and _wait_port_free Make targets for more reliable stop/start cycles.

Test plan

  • Verify normal auth flow still works (connect, PIN, send messages)
  • Verify expired token gets rejected mid-session (server closes WS with 4005)
  • Verify client redirects to server list on device_expired without leaving stale WS
  • Verify list_projects is rejected before authentication
  • Verify make deploy, make restart, make stop work on macOS

🤖 Generated with Claude Code

Previously, device token expiry was only checked during the initial auth
handshake. An active WebSocket session would remain authenticated
indefinitely even after the token expired. Now the server re-checks
token expiry on every message and force-closes expired sessions.

Also gates the list_projects WS handler behind authentication, and
immediately closes the client WebSocket when device_expired is received
instead of leaving it open during the redirect delay.

Makefile: replace PID-file process management with port-based detection
for more reliable deploys on macOS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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