Commit Graph

130 Commits

Author SHA1 Message Date
Vantz Stockwell
4d66849035 feat: xterm.js terminal with fit addon and Wails binding bridge
Add useTerminal composable wrapping xterm.js with fit, search, and
web-links addons. TerminalView component mounts into a container div
and auto-fits on resize. SessionContainer now renders TerminalView
for SSH sessions using v-show to keep terminals alive across tab
switches. MobaXTerm Classic-inspired color theme. Data input and
resize events are placeholder TODOs for Wails SSHService bindings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 07:04:31 -04:00
Vantz Stockwell
8c902876e7 feat: wire SSH, SFTP, and credential services into Wails app
Add SSHService, SFTPService, and CredentialService to the WraithApp
struct. SSH service uses a no-op output handler (Wails event emission
will be wired at runtime). CredentialService is created lazily after
vault unlock. Both SSH and SFTP services are registered with Wails
in main.go.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 07:04:15 -04:00
Vantz Stockwell
d05639ef4c Merge branch 'worktree-agent-a14ceeb8' into feat/phase2-ssh-sftp
# Conflicts:
#	go.mod
#	go.sum
2026-03-17 06:56:11 -04:00
Vantz Stockwell
539198d353 Merge branch 'worktree-agent-a7ec88be' into feat/phase2-ssh-sftp 2026-03-17 06:56:05 -04:00
Vantz Stockwell
6e25a646d3 feat: SFTP service + credential service with encrypted key/password storage
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:55:18 -04:00
Vantz Stockwell
cab286b4a6 feat: SSH host key verification + OSC 7 CWD tracker
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:52:59 -04:00
Vantz Stockwell
c48c0de042 feat: SSH service — connect, PTY, shell I/O with goroutine pipes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:51:30 -04:00
Vantz Stockwell
fad5692c00 docs: Phase 2 implementation plan — SSH + SFTP with 12 tasks 2026-03-17 06:48:58 -04:00
Vantz Stockwell
fe19ee73e2 ci: build + sign workflow for Windows release (Azure Key Vault + jsign)
Add Gitea Actions workflow that builds wraith.exe for Windows amd64,
signs it with an Azure Key Vault certificate via jsign, and uploads
the signed binary with a version.json manifest.

Also adds a `version` var to main.go for -ldflags injection at build time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:38:49 -04:00
Vantz Stockwell
cb4b8ec136 docs: comprehensive README with architecture, build, and plugin guide
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:35:21 -04:00
Vantz Stockwell
d42f000f8f spike: multi-window and RDP frame transport research results
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:35:00 -04:00
Vantz Stockwell
d57cd6cfbb feat: main layout — sidebar connection tree, tab bar, status bar
Three-panel layout with 240px sidebar, tabbed session area, and
status bar. Sidebar has Connections/SFTP toggle, search input, and
collapsible group tree with protocol-colored dots. Tab bar shows
active sessions with color-coded indicators and close buttons.
Status bar displays connection info, theme, encoding, and terminal
size. All backed by connection and session Pinia stores with mock
data until Wails bindings are connected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:32:17 -04:00
Vantz Stockwell
d67e183d72 feat: master password unlock UI with first-run vault creation
Add the unlock screen that gates entry to the main app. Includes
app store (unlocked state, firstRun flag), a centered dark-themed
unlock card with WRAITH branding, password validation for first-run
vault creation, and conditional rendering in App.vue.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:32:10 -04:00
Vantz Stockwell
8b891dca00 feat: wire all services into Wails app entry point
Create WraithApp struct in internal/app that initializes SQLite,
runs migrations, seeds themes, and exposes vault management methods
(IsFirstRun, CreateVault, Unlock, IsUnlocked) to the frontend.
Register WraithApp, ConnectionService, ThemeService, and SettingsService
as Wails v3 bound services.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:28:32 -04:00
Vantz Stockwell
19288940e1 chore: exclude .claude worktrees from git 2026-03-17 06:22:18 -04:00
Vantz Stockwell
714b92292d Merge branch 'worktree-agent-a866869e' into feat/phase1-foundation
# Conflicts:
#	go.mod
#	go.sum
2026-03-17 06:22:06 -04:00
Vantz Stockwell
3f8035ac72 Merge branch 'worktree-agent-adaf01c0' into feat/phase1-foundation 2026-03-17 06:21:25 -04:00
Vantz Stockwell
5179f5ab76 feat: plugin interfaces + window-agnostic session manager with detach/reattach
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:21:07 -04:00
Vantz Stockwell
ab5a5c7ae2 feat: connection search by name/hostname/tag with json_each filtering
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:21:03 -04:00
Vantz Stockwell
41613586c5 feat: theme service with 7 built-in terminal color schemes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:20:57 -04:00
Vantz Stockwell
995e81de3b Merge branch 'worktree-agent-a36e902e' into feat/phase1-foundation 2026-03-17 06:17:52 -04:00
Vantz Stockwell
7fa4e62cbc Merge branch 'worktree-agent-a9763668' into feat/phase1-foundation 2026-03-17 06:17:52 -04:00
Vantz Stockwell
e8ed0139b3 feat: connection + group CRUD with JSON tags and options
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:17:31 -04:00
Vantz Stockwell
4c32694a52 feat: vault service — Argon2id key derivation + AES-256-GCM encrypt/decrypt
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:16:23 -04:00
Vantz Stockwell
4de47352cd feat: settings service — key-value store with upsert
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:15:55 -04:00
Vantz Stockwell
62133d8966 feat: SQLite database layer with WAL mode and schema migrations
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:13:51 -04:00
Vantz Stockwell
381d142a73 feat: Wails v3 + Vue 3 project scaffold with Tailwind dark theme
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:11:19 -04:00
Vantz Stockwell
c64ddac18b docs: Phase 1 implementation plan — 15 tasks with TDD
Foundation plan covering: Wails v3 scaffold, SQLite+WAL, vault encryption,
connection/group CRUD, search, themes, settings, plugin interfaces,
session manager, master password UI, main layout shell, multi-window
spike, RDP frame transport spike, README, and license audit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:01:34 -04:00
Vantz Stockwell
98e3556cc7 docs: post-MVP Claude Code plugin spec — AI-assisted terminal operations
Claude Code integration as the first Wraith plugin: terminal I/O, SFTP
file access, CodeMirror handoff, and session context awareness. Proves
the plugin architecture and serves as the reference implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 05:41:54 -04:00
Vantz Stockwell
850e8e492e docs: spec hardening — Wails fallback plans, crash recovery, resource mgmt
- Wails v3: defined Plan A/B/C for multi-window with Phase 1 spike
- Crash recovery: workspace snapshot persistence + restore-on-restart
- Resource management: session limits, memory budgets, idle handling
- DPAPI: designed-for upgrade path in vault (post-MVP)
- RDP frame transport spike moved to Phase 1 (don't discover late)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 05:39:35 -04:00
Vantz Stockwell
587b5396fd docs: spec refinements — RDP key pass-through, SQLite WAL, tab transitions
- RDP input: Windows key + Alt+Tab pass-through toggle per connection
- SQLite: WAL mode + busy_timeout for concurrent read/write safety
- UI: 0.5s CSS transitions on tab active/background state changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 05:36:33 -04:00
Vantz Stockwell
0641ce34c8 docs: Wraith Desktop design spec — Go + Wails v3 native app
Complete design specification for rebuilding Wraith as a native Windows
desktop application replacing MobaXTerm. Covers architecture, data model,
SSH/SFTP/RDP flows, vault encryption, UI layout, MobaXTerm config
importer, plugin interface, and phased build plan.

Stack: Go + Wails v3 + Vue 3 + SQLite + FreeRDP3 (purego)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 05:27:32 -04:00
Vantz Stockwell
a75e21138e fix: RDP keyboard capture yields to form elements in modals and toolbars
Keyboard events now check if focus is on an input, textarea, select, or
contenteditable element and let the browser handle them normally. Also
fixes connectRdp type (Awaited<>) and async onMounted in RdpCanvas.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 12:49:30 -04:00
Vantz Stockwell
8d4ee04285 fix: SSH host key verification — send verifyId, track pending clients, guard stale callbacks
Frontend sends verifyId with host-key-accept so backend can correlate the
verification response. Backend tracks pre-ready connections in pendingClients
map, destroys on error/disconnect, and guards against calling verify() after
the connection has already timed out or errored (_destruct crash fix).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 12:49:22 -04:00
Vantz Stockwell
63315f94c4 test: backend test suite — 8 spec files covering vault encryption, credentials, SSH keys, auth service, controller, guards
63 tests across 8 spec files, all passing. Removes 2 stale stub files from
backend/test/ that were incompatible with the current async EncryptionService
and 3-argument AuthService constructor. New suite lives in src/ co-located
with source files per NestJS convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 19:10:12 -04:00
Vantz Stockwell
f01e357647 test: frontend test suite — Vitest infrastructure, auth/connection stores, vault composable, admin middleware
28 tests across 4 spec files. Vitest + happy-dom configured with Nuxt auto-import
shims ($$fetch, navigateTo, defineNuxtRouteMiddleware) so stores and composables
resolve cleanly outside the Nuxt runtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 19:06:14 -04:00
Vantz Stockwell
5abbffca9b feat(ui): add color accents across the connection manager
- Default protocol color strips on all host cards (wraith-blue for SSH, purple for RDP)
- Deterministic tag colors from 8-color palette (teal, amber, violet, rose, emerald, sky, orange, indigo)
- Last-connected recency coloring (green=today, amber=this week, gray=older)
- Section header dots (wraith-400 for Recent, gray for All Hosts)
- Active nav link highlighting (wraith-400)
- Group headers get subtle wraith-500 left border accent
- Tree host dots default to protocol color instead of gray
- Fixed rogue modal using hardcoded #1a1a2e/#e94560 — now uses design system
- Fixed sky-600 save buttons → wraith-600 for brand consistency
- Credential type badges: SSH Key=wraith, Password=amber (was purple/blue)
- Colored tags in right sidebar detail panel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 16:01:58 -04:00
Vantz Stockwell
adbfd854a6 fix: skip default admin seed if any admin account exists 2026-03-14 15:52:35 -04:00
Vantz Stockwell
48755ecacd fix: move cookie-parser to main.ts for guaranteed execution before JWT strategy 2026-03-14 15:36:35 -04:00
Vantz Stockwell
ce0c04e7fa fix: relax helmet CSP for Nuxt inline scripts and WebSocket connections 2026-03-14 15:27:53 -04:00
Vantz Stockwell
795e8646df fix: remove keyType reference from decryptForConnection return type 2026-03-14 14:35:36 -04:00
Vantz Stockwell
93811b59cb fix(security): auth hardening — httpOnly cookies, Argon2id passwords, TOTP encryption, rate limiting
C-2: JWT moved from localStorage to httpOnly cookie (eliminates XSS token theft)
C-3: WebSocket auth via short-lived single-use tickets (JWT no longer in URLs)
H-1: JWT expiry reduced from 7 days to 4 hours
H-3: TOTP secrets encrypted at rest with vault EncryptionService (auto-migrates plaintext)
H-6: Rate limiting via @nestjs/throttler (60 req/min global, tighten on auth)
H-8: Constant-time login — Argon2id verify runs against dummy hash for non-existent users
H-9: Password hashing upgraded from bcrypt(10) to Argon2id (auto-upgrades on login)
H-10: Credential list API no longer returns encrypted blobs
H-16: Admin pages use Nuxt route middleware instead of client-side guard
Plus: auth bootstrap plugin, cookie-parser middleware, all frontend Authorization headers removed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 14:24:35 -04:00
Vantz Stockwell
39825f5295 fix(security): terminal logging cleanup, session ownership, host key verification, shell injection opt-in
- H-5: Redact keystroke data from WS message logs — log type/sessionId/bytes only
- H-4: Remove private key content/length/passphrase logging, replace with safe single line
- H-14: Remove username@hostname from password auth log, use hostId only
- M-1: Enforce session ownership in data/resize/disconnect handlers via clientSessions map
- C-5: Real host key verification flow — MITM protection blocks changed keys immediately,
  new hosts ask user via host-key-verify WS message with 30s timeout, pending map resolves on
  host-key-accept/host-key-reject response
- H-13: Shell PROMPT_COMMAND/precmd injection is now opt-in via options.enableCwdTracking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 14:15:23 -04:00
Vantz Stockwell
74cba6339c fix(security): SFTP session ownership + Guacamole instruction validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 14:14:31 -04:00
Vantz Stockwell
a88c164ac4 fix(security): infrastructure hardening — guacd network isolation, drop DB port, helmet, non-root container
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 14:13:28 -04:00
Vantz Stockwell
b11efce6ed feat(security): Argon2id key derivation for vault encryption
BREAKING CHANGE (forward-only): New credentials/keys encrypted with v2
(Argon2id-derived AES-256-GCM). Existing v1 records decrypt transparently.

- Argon2id params: 64 MiB memory, 3 iterations, 4 parallelism (OWASP)
- Per-record 16-byte salt stored in ciphertext format
- v2 format: v2:<salt>:<iv>:<authTag>:<ciphertext>
- Backwards compatible: v1 records still decrypt with raw key
- Admin endpoint POST /api/credentials/migrate-v2 upgrades all v1→v2
- Added docs/FUTURE-FEATURES.md with remaining spec gaps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 13:40:41 -04:00
Vantz Stockwell
37781a4791 fix: replace popup Monaco editor with fullscreen overlay
Monaco can't mount in a popup window — it references document.activeElement
from the main window context, causing cross-window DOM errors.

Replaced with a fullscreen overlay teleported to <body>:
- Same dark theme toolbar with save/close/dirty indicator
- Ctrl+S to save, Esc to close
- Status bar shows language and keyboard shortcuts
- File tree stays visible underneath (overlay dismisses to it)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 13:28:56 -04:00
Vantz Stockwell
e1be07f34c feat: session tabs with home nav, popup Monaco editor, drag-and-drop upload
Multi-session tabs + home navigation:
- Tab bar with Home button persists above sessions
- Clicking Home shows the underlying page (hosts, vault, etc.)
- Clicking a session tab switches back to that session
- Header nav links also trigger home view
- Sessions stay alive in background when viewing home

Monaco editor in popup window:
- Opening a file in SFTP launches a detached popup with Monaco
- Full syntax highlighting, minimap, Ctrl+S save
- File tree stays visible while editing
- Toolbar with save/close buttons and dirty indicator

Drag-and-drop upload:
- Drop files anywhere on the SFTP sidebar to upload
- Visual overlay with dashed border on drag-over
- Supports multiple files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 13:20:40 -04:00
Vantz Stockwell
733fe6aca1 feat: admin user management UI
- Add admin-only "Users" nav link in header
- Create /admin/users page with full CRUD:
  create user, edit, delete, reset password, reset TOTP
- Matches existing wraith dark theme
- Client-side admin guard redirects non-admins

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 13:07:20 -04:00
Vantz Stockwell
6d76558bc3 feat: multi-user isolation with admin/user roles
Full per-user data isolation across all tables:
- Migration adds userId FK to hosts, host_groups, credentials, ssh_keys,
  connection_logs. Backfills existing data to admin@wraith.local.
- All services scope queries by userId from JWT (req.user.sub).
  Users can only see/modify their own data. Cross-user access returns 403.
- Two roles: admin (full access + user management) and user (own data only).
- Admin endpoints: list/create/edit/delete users, reset password, reset TOTP.
  Protected by AdminGuard. Admins cannot delete themselves or remove own role.
- JWT payload now includes role. Frontend auth store exposes isAdmin getter.
- Seed script fixed: checks for admin@wraith.local specifically (not any user).
  Uses upsert, seeds with role=admin. Migration cleans up duplicate users.
- Connection logs now attributed to the connecting user via WS auth.
- Deleting a user CASCADEs to all their hosts, credentials, keys, and logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 12:57:38 -04:00