docmost icon indicating copy to clipboard operation
docmost copied to clipboard

feat(integrations): reusable OAuth2 framework, with Linear as the first provider

Open nateships opened this issue 5 months ago • 1 comments

Adds a generic, provider-agnostic OAuth2 framework for third-party integrations and ships Linear as the first provider built on it.

The framework

A reusable OAuth2 layer (provider registry + signed-state authorize/callback/refresh/disconnect + encrypted token storage) so future integrations don't re-implement the connection lifecycle. A new provider supplies its endpoints/scopes/identity lookup and its data calls; everything else (per-workspace admin app config, per-user connect/status/disconnect, token refresh) comes for free.

  • Per-user OAuth: each member connects their own account and only sees what their permissions allow
  • Admin configures the workspace OAuth app once in Settings → Integrations (UI only, no env vars)
  • Tokens encrypted at rest (AES-256-GCM), auto-refreshed; CSRF-protected via signed state bound to provider/user/workspace
  • Generic IntegrationCard + connection hooks on the client

First provider: Linear

  • Mention / insert an issue via slash command or by pasting a Linear URL (auto-converts to an issue chip)
  • Hover preview with live status, assignee, priority, and rendered description
  • Create an issue from selected text via the bubble menu
  • Global search surfaces matching Linear issues alongside pages

The linearIssue node is registered in the server tiptap schema so chips survive save, export, and search indexing; all issue URLs run through sanitizeUrl.

Verification

  • Server + client typecheck clean
  • Unit tests for token encryption (round-trip, unique IV, tamper rejection) and OAuth signed-state (forged/tampered/expired/mis-bound rejection)
  • Exercised end-to-end locally (connect, mention, preview, create, search, disconnect)

nateships avatar Jun 13 '26 19:06 nateships

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 13 '26 20:06 CLAassistant