Skip to content

Drift deploy v0.1.71

Choose a tag to compare

@kidproquo kidproquo released this 02 Jul 23:37
· 2 commits to main since this release

v0.1.71

Terminal modal now accepts file drop, ⌘V file paste, and ⌘V clipboard-image paste — files land on the device at /var/tmp/drift-uploads/<session_id>/<name> with sane permissions and a UI chip appears above the terminal showing the path with a one-click copy button.

Why

Operators debugging on a remote device often need to shuttle a small file over — a fresh config to try, a captured log to analyze, a script to run, a screenshot to compare. Before this release the only option was pasting text into the shell or fetching from a URL the device could reach. Neither is great for binary content, unreadable-as-text logs, or arbitrary clipboard images.

What changed

edge-agent/terminal-bridge.py (v0.1.71 bridge; devices auto-update via SHA on next terminal open — no install.sh rerun):

  • WS max_size raised from 1 MiB → 10 MiB so a base64-encoded file up to ~7 MB fits in a single frame.
  • New {"type":"upload","name":<str>,"data":<base64>} control frame from browser: decodes, writes to /var/tmp/drift-uploads/<session_id>/<sanitized name> via nsenter -m -t 1 tee (host mount namespace, so the operator's login shell can see it).
  • Filename sanitized: printable ASCII only, no path separators, basename-only, 255 char cap. Malformed names fall back to a deterministic upload_<hash> so a hostile client can't traverse out of the session dir.
  • File permissions on write: 0644 (rw-r--r--), no execute, no setuid/setgid/sticky. A pre-rm of the target defends against a stale symlink under the session dir redirecting the write. Pasted scripts don't run until the operator explicitly chmod +x.
  • New {"type":"upload_ok"} / {"type":"upload_error"} control frames back to the browser so the modal can render a status chip. Also echoes [drift] uploaded: <path> (<bytes> bytes) into the pty so it's in scrollback for cat/mv/chmod.
  • Per-session scratch dir cleaned up on bridge exit (device isn't left with one dir per closed session forever). Files uploaded during the session are gone after the modal closes; move them elsewhere from the shell first if you want them to persist.

src/components/TerminalModal.tsx:

  • Drag-and-drop onto the terminal container — one upload per file dropped.
  • ⌘V / Ctrl+V paste — inspects clipboardData.files (Finder/Explorer file paste) AND clipboardData.items for image/* blobs (screenshot / image-copied-from-browser). Only intercepts when a file is present; plain text paste keeps working through xterm normally.
  • Clipboard images get a synthesized filename pasted-<timestamp>.<ext> since the browser doesn't attach a name to them.
  • Upload chip stack renders above the "Log in as drift" helper line — one row per recent upload (last 4). Green tint + document icon for success, red tint + error icon for failure. Success rows show name (bytes) → /path with a copy-path icon button + dismiss. Failure rows show the reason (too large, invalid base64, write failed, etc.).
  • Per-file cap enforced client-side: 7 MB, error chip on overflow. Larger files would need chunking — deferred to a later release; 7 MB covers configs, scripts, small logs, screenshots, most zips.

Operator action

Apply via Software Updates modal. Both drift-agent and drift-frontend images rebuild. The edge-agent's terminal-bridge.py self-updates via SHA comparison on the next terminal-modal open — no per-device install.sh rerun.

Migration / breaking changes

None.

Cache impact

No system prompt or tool registry changes.