Skip to content

Implement 004-mvp-hardening: secure credentials, access control, terminal package#3

Open
raphaeltm wants to merge 2 commits intomainfrom
004-mvp-hardening
Open

Implement 004-mvp-hardening: secure credentials, access control, terminal package#3
raphaeltm wants to merge 2 commits intomainfrom
004-mvp-hardening

Conversation

@raphaeltm
Copy link
Owner

Summary

Implements the 004-mvp-hardening feature with comprehensive security and UX improvements:

  • Secure Credential Delivery: Bootstrap tokens with AES-GCM encryption and 5-minute TTL
  • Workspace Access Control: Ownership validation with 404 responses (prevents info disclosure)
  • Provisioning Timeout: Automatic error status for stuck workspaces (10 min timeout)
  • Shared Terminal Package: Reusable xterm.js component with reconnection logic
  • WebSocket Reconnection: Exponential backoff with user-friendly retry UI
  • Idle Deadline Display: Real-time countdown to auto-shutdown

Test plan

  • pnpm lint passes
  • pnpm typecheck passes
  • pnpm test passes (74 tests)
  • pnpm build succeeds
  • Manual testing of terminal reconnection
  • Manual testing of workspace access control

Security Notes

Security audit identified items for follow-up:

  • VM callback endpoints should validate callback tokens
  • JWT issuer values need alignment between API and VM agent
  • Bootstrap token visible in systemd logs (consider metadata service)

🤖 Generated with Claude Code

raphaeltm and others added 2 commits January 28, 2026 01:35
…inal package

Phase 1-2: Setup & Foundational
- Add bootstrap token types to shared package
- Add D1 migration for errorReason, shutdownDeadline columns
- Add cron trigger configuration in wrangler.toml

Phase 3: Secure Credential Delivery (US1)
- Add bootstrap service with one-time token generation
- Add bootstrap route for VM token redemption
- Implement AES-GCM encryption for credentials in KV
- 5-minute TTL for bootstrap tokens

Phase 4: Workspace Access Control (US2)
- Add requireWorkspaceOwnership middleware
- Return 404 (not 403) to prevent information disclosure
- Add workspace ownership tests

Phase 5: Provisioning Timeout (US3)
- Add timeout service to detect stuck workspaces
- Update workspace status to 'error' after 10 minutes
- Add cron trigger for periodic timeout checks

Phase 6: Shared Terminal Package (US6)
- Create @simple-agent-manager/terminal package
- Add Terminal component with xterm.js integration
- Add useWebSocket hook with exponential backoff reconnection
- Add useIdleDeadline hook for countdown display
- Add StatusBar and ConnectionOverlay components

Phase 7: WebSocket Reconnection (US4)
- Integrate terminal package into web app
- Add reconnection UI with retry button
- Display connection state (connecting, connected, reconnecting, failed)

Phase 8: Idle Deadline Display (US5)
- Update Go idle detector to deadline-based tracking
- Add GetDeadline() method with thread-safe access
- Update heartbeat to include shutdownDeadline
- Add shutdown deadline display in WorkspaceCard

Phase 9: Polish
- Update CLAUDE.md and README.md documentation
- Fix lint errors across test files
- Run security audit and coverage verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ng notes

- Agents should use docs/notes/ for ephemeral working notes
- All markdown files should be kebab-case (except README, LICENSE, etc.)
- Never put documentation in package roots

Co-Authored-By: Claude Opus 4.5 <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