Skip to content

feat(auth): doctor section, auth tokens commands and login pre-flight for encrypted OAuth tokens - #1891

Merged
Dumbris merged 18 commits into
mainfrom
feat/oauth-token-encryption-tools
Nov 12, 2026
Merged

Dumbris merged 18 commits into
mainfrom
feat/oauth-token-encryption-tools

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 12, 2026

Copy link
Copy Markdown
Member

Summary

Spec 123 PR-3: the operator surfaces for the encrypted upstream OAuth rows that #1888 introduced. Refs #1697.

  • Doctor / diagnostics: mcpproxy doctor prints an OAuth Token Storage section, and GET /api/v1/diagnostics carries it as data.oauth_token_storage (row counts by class, key source, compaction advice, leftover config.db.bak, warnings). Each undecryptable server also appears once in the runtime warnings.
  • mcpproxy auth tokens status|encrypt [--dry-run]|decrypt --yes [--leave-undecryptable]: offline commands for the rows. Exit 3 when the core holds config.db, 4 with no or an unusable key, 1 when rows remain.
  • mcpproxy db compact --keep-backup=false clears the compaction-advised marker; a retained backup is reported separately.
  • Login pre-flight: auth login explains an undecryptable row instead of starting a flow that cannot be stored, standalone (reads the row) and through the daemon (matches the current row's bucket key). auth status shows the state distinctly.
  • Web UI: no sign-in button for a server whose stored token cannot be decrypted.
  • Docs: docs/features/oauth-token-encryption.md (doctor output, commands, rotation, compaction, packaged service, container, downgrade), docs/cli/command-reference.md, docs/cli/db-commands.md, docs/api/rest-api.md, docs/errors/MCPX_OAUTH_TOKEN_UNDECRYPTABLE.md.

No new dependencies.

Decisions worth a second look

  • auth tokens decrypt refuses up front when any row cannot be opened, unless --leave-undecryptable is passed (it then still exits 1).
  • auth tokens decrypt leaves the compaction marker untouched; only db compact --keep-backup=false clears it. The marker is cleared even when an older config.db.bak exists, as the spec says; the backup is reported on its own (stale_backup_path, warning backup_file_present).
  • A standalone auth login no longer falls back to in-memory storage when config.db cannot be opened; it stops with the open error (exit 3 for a locked database).
  • status and --dry-run are documented as "change no OAuth row" rather than read-only, because opening the database can run open-time maintenance.
  • The systemd-run ... LoadCredential= example for a credential-only key was written from the systemd documentation and has not been run on a live systemd host.

Testing

  • go test -race ./cmd/mcpproxy/ ./internal/management/... ./internal/storage/... ./internal/upstream/cli/... ./internal/httpapi/... ./internal/oauth/... ./internal/config/... ./internal/tokenseal/...
  • golangci-lint v2 with .github/.golangci.yml, bare and --build-tags server
  • ./scripts/test-oauth-token-encryption-e2e.sh (status / decrypt / encrypt / compact round trip with raw config.db scans, including a control that the token text is still in freed pages before the no-backup compaction)
  • frontend/tests/unit/oauth-undecryptable-signin.spec.ts

…eport a missing key before the database check, and correct the packaged-service and dry-run docs
…atch the daemon pre-flight on the current row's bucket key, and tighten the e2e raw scans
…ntrypoint overridden, and make the e2e key-leak scans immune to pipefail
…y key and place oauth_token_storage under data
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

@Dumbris
Dumbris enabled auto-merge (squash) November 12, 2026 01:47
@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: feat/oauth-token-encryption-tools

Available Artifacts

  • archive-darwin-amd64 (32 MB)
  • archive-darwin-arm64 (29 MB)
  • archive-linux-amd64 (20 MB)
  • archive-linux-arm64 (18 MB)
  • archive-windows-amd64 (32 MB)
  • archive-windows-arm64 (28 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (28 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goUSAVPE.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 43136852991 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris
Dumbris merged commit 1dab0af into main Nov 12, 2026
55 checks passed
Dumbris added a commit that referenced this pull request Nov 20, 2026
`roadmap.yaml` had no epics after Spec 117. This PR adds them and
regenerates `ROADMAP.md`.

- **Shipped:** 118 auto-rescan (#1689), 118 pin visibility boundary
(#1684, #1688, #1821), 119 (#1740), 120 (#1781), 122 (#1818) and 123
(#1886, #1887, #1888, #1891).
- **In review:** 121 install surfaces (#1711). There is no `spec:` link
yet because its folder exists only on the PR branch.
- **In progress:** 124 (PR-1 #1918 done; PR-2 CLI and PR-3 Web UI to do)
and 125 (spec plus PR-1..3 done; PR-4 Web UI to do). Merged PRs are
listed as done child tasks, so `--check-github` doesn't flag a merged PR
under an in-progress epic.
- **Spec-only PRs:** 127 (#1943), 128 (#1944) and 129 (#1945).

Merge this after #1943, #1944 and #1945. Until then, `--check-github`
reports their `spec:` links as unresolved; `--check`, the pre-commit
hook, passes.

Not covered: Spec 126 (#1940, open) and the unsynced tasks.md checkboxes
for 123 and 124.
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.

2 participants