Skip to content

Add the Dropbox off-site backup destination (bring-your-own-credentials) - #245

Merged
9mtm merged 1 commit into
mainfrom
backup/cloud-dropbox
Nov 28, 2026
Merged

9mtm merged 1 commit into
mainfrom
backup/cloud-dropbox

Conversation

@9mtm

@9mtm 9mtm commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Dropbox off-site backup destination (BACKUP-02, cloud phase 1)

Adds Dropbox as an owner-controlled off-site backup destination, the first cloud target after local folder / SFTP / WebDAV / S3. Bring-your-own-credentials: the owner registers their own Dropbox app once; we store nothing server-side and relay nothing.

What's new

  • Secret-less PKCE loopback OAuth (net/oauth-loopback.ts): S256 challenge, state check, fixed loopback redirect http://localhost:53682/ on 127.0.0.1 only. Reusable by Google Drive / OneDrive later.
  • Dropbox REST client (net/dropbox-client.ts) over the shared HTTP transport: token exchange + on-demand refresh with an in-memory cache, single and chunked (upload-session) upload, download, list, delete. Own code — no SDK, no new packages.
  • Owner-gated connect flow (cloud-connect.ts): start / poll / cancel. Opens the browser, exchanges the code, stores the token in the existing encrypted credential vault, and returns only an opaque reference — never a token.
  • Dropbox adapter on the existing destination interface (ensure/put/get/list/remove): App-folder scope, ciphertext only, remote read-back verify.
  • Settings UI: Dropbox is now a selectable destination with an inline connect step (app-key field, "how to get this" help, browser sign-in, folder). Google Drive and OneDrive stay "Coming".

Guards

Owner-gated · loopback-only (127.0.0.1) · ciphertext-only · tokens never leave the device, never logged, never echoed in a response.

Tests

Backend tsc clean; backend backup suite 25/25 (OAuth and all Dropbox HTTP faked — no live network call); core-ui typecheck + build + full suite 1999/1999 (source-boundary guard carved for the loopback-redirect help literal).

Not covered here

  • A live Dropbox round-trip against a real scoped app — needs a real app + sign-in, to run manually.
  • MCP parity for destinations is absent for every type (not just Dropbox); separate follow-up.

…ls) [skip ci]

Dropbox becomes a connectable cloud place for off-site backups, built on
the owner's own Dropbox app so Girru registers nothing, hosts nothing and
pays nothing. The sign-in is secret-less PKCE OAuth on a loopback redirect
(127.0.0.1), owner-gated; only a refresh token and the owner's app id live
in the credential vault on this computer. The provider receives only the
AES-256-GCM ciphertext the backup archive produces.

Backend
- net/oauth-loopback.ts: generic secret-less PKCE loopback flow (fixed port
  the owner registers once; state-checked; browser opened through a seam).
- net/dropbox-client.ts: Dropbox REST over the shared HTTP transport — token
  exchange/refresh with an in-memory access-token cache, account email,
  upload (single shot or a chunked upload session for large archives),
  download, list, delete. Own code, no SDK.
- services/cloud-connect.ts: owner-gated start/poll/cancel flow manager that
  runs the loopback OAuth and stores the token in the vault, handing back
  only a flow id and an opaque connection reference — never a token.
- backup-destinations.ts: a Dropbox adapter on the existing ensure/put/get/
  list/remove interface (App-folder scope, ciphertext-only, remote-verify);
  a cloud place reuses the stored connection instead of a pasted secret.
- routes: POST /api/backups/cloud/connect, GET/POST .../:flowId(/cancel).

UI
- Settings › Backups: Dropbox is a selectable kind with a Connect step — a
  one-time app-key field with inline setup help, a browser sign-in with a
  connecting/cancel state, then folder + Test + Add. Google Drive and
  OneDrive stay "Coming". Errors are inline and recoverable.

Contract keeps secrets and tokens off the wire: the connect responses carry
only status + an opaque reference, and a Dropbox place projects its account
only. Tests drive the OAuth and all Dropbox HTTP with in-memory fakes, so no
real network and no live Dropbox call.
@9mtm
9mtm force-pushed the backup/cloud-dropbox branch from fe2fbf1 to e7a2730 Compare November 28, 2026 20:44
@9mtm
9mtm merged commit 6a8ea1c into main Nov 28, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Agent Player Nov 28, 2026
@9mtm
9mtm deleted the backup/cloud-dropbox branch November 28, 2026 21:36
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