Skip to content

docs(oauth): correct where upstream OAuth tokens are stored - #1887

Merged
Dumbris merged 6 commits into
mainfrom
docs/oauth-token-storage-facts
Nov 11, 2026
Merged

Dumbris merged 6 commits into
mainfrom
docs/oauth-token-storage-facts

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 11, 2026

Copy link
Copy Markdown
Member

Summary

The docs said upstream OAuth tokens are stored encrypted in the OS keyring. They are not. This PR makes every such claim say what the code does today. It is PR-1 of Spec 123 (#1886) and contains no behaviour change.

Refs #1697. Reported by @james-crowley.

What the code does

  • Upstream OAuth records (access token, refresh token, DCR client secret) are plain JSON in the oauth_tokens bucket of config.db.
  • The only protection is file permissions: data directory 0700, config.db 0600.
  • The OS keyring is used only for ${keyring:NAME} config references.

Changes

  • docs/features/oauth-authentication.md: flow step 6, the Token Storage section (keyring table removed), Security Best Practices item 3.
  • docs/docker-isolation.md, docs/features/docker-isolation.md, docs/features/sandbox-isolation.md: config.db holds the tokens in readable form.
  • docs/mcp-go-oauth.md: "secure storage" replaced with "persistence in config.db".
  • specs/023-oauth-state-persistence/plan.md, specs/039-security-scanner-plugins/spec.md: the false "encrypted BBolt" claims are struck through.
  • internal/storage/bbolt.go: comment only.

Not changed

  • docs/features/auth-broker.md and Spec 029: these describe the server-edition broker store, which is AES-encrypted.
  • Text about ${keyring:} references: accurate.

Testing

  • cd website && npm ci && npm run build passes, including the link verification step.
  • go build ./internal/storage/ and gofmt are clean. The only Go change is a comment.

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: docs/oauth-token-storage-facts

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 (25 MB)
  • smart-mcp-proxymcpproxy-goP4ZW4S.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 43081992149 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

Dumbris added a commit that referenced this pull request Nov 11, 2026
…ck port descriptions (#1889)

## Summary

Four statements in the OAuth and Docker isolation docs did not match the
code. A cross-model review of #1887 found them in the same files; they
are unrelated to token storage, so they are fixed here. Docs only.

## Changes

- `docs/mcp-go-oauth.md`: refreshed tokens are persisted (access token,
refresh token and expiry), not kept in memory only. A successful tool
call alone does not prove a refresh happened.
- `docs/mcp-go-oauth.md`: the callback listener is cached per server and
reused across flows, with callbacks dispatched by `state`. A pinned port
that is unavailable is an error. The "unique port per flow" and "zero
port conflicts" claims are reworded.
- `docs/features/oauth-authentication.md`: OAuth endpoints are
discovered by default but can be overridden with
`authorization_endpoint`, `token_endpoint` and `registration_endpoint`.
- `docs/features/docker-isolation.md`: the Docker argument example now
shows key-only `-e API_KEY -e DEBUG` flags. Values travel in the Docker
CLI environment, not in argv.

## Verified against

- `internal/oauth/persistent_token_store.go` (`SaveToken`, reactive
refresh path)
- `internal/oauth/config.go` (`StartCallbackServerOnHost`)
- `internal/config/config.go` and `internal/oauth/transport_wrapper.go`
(endpoint overrides)
- `internal/upstream/core/connection_docker.go` (`dockerEnvKeyFlags`)

## Testing

`cd website && npm ci && npm run build` passes, including the link
verification step.
@Dumbris
Dumbris merged commit ad52034 into main Nov 11, 2026
72 of 77 checks passed
Dumbris added a commit that referenced this pull request Nov 16, 2026
…n macOS runners (#1890)

## Summary

Two `internal/server` tests failed on macOS runners on unrelated PRs
(#1885, #1887). Both are races in the tests, not in production code.
This PR fixes them. Test-only.

## Causes and fixes

**`TestSearchTools_WithholdsApprovalLockedHits`** returned only
`cedar:pending_item` when `orchid:read_item` was also expected.

- After `PhaseReady` the runtime starts background tool indexing, whose
first step deletes index entries for servers the upstream manager does
not know.
- The test seeds two hand-made servers into the index right after
`PhaseReady`, so the cleanup could delete a seeded document mid-seeding.
- Reproduced locally with `GOMAXPROCS=1 go test -race -count=40`: failed
within the first two runs.
- Fix: a `newSettledConsistencyServer` fixture waits for `PhaseReady`
and for the cleanup's completion log line before the test seeds
anything. `TestSearchTools_AnnotationsSurviveToTier` seeds the same way
and now uses it too.

**`TestTPAFetchLifecycle_ActivatesReprotectsAndRefusesBadReleases`**
failed with "exactly one cycle reported activated: expected 1, actual
0".

- The test waited for the bundle source to flip, which happens inside
the fetch leg. The telemetry counter is incremented later, by the
observer that runs after the cycle is recorded.
- Reproduced deterministically by delaying that observer by 400 ms (not
part of this PR).
- Fix: poll until the counter reaches 1, then keep the exact `== 1`
assertion.

## Not fixed here

The `test timed out after 40m0s` failure on #1886 was not a hang. The
whole `internal/server` package ran 40 minutes on a slow runner; the
same job passed in 20 minutes on retry. A healthy macOS run already uses
about half the 40-minute budget. Raising the timeout or trimming the
fixed 12-second waits in the upstream-add tests is a separate decision.

## Testing

- `GOMAXPROCS=1 go test -race -count=100 -run
TestSearchTools_WithholdsApprovalLockedHits ./internal/server/`: pass.
- Both search tests together, `-race -count=15`: pass.
- The fetch lifecycle test, `GOMAXPROCS=1 -race`: 15 of 15 runs passed.
- `golangci-lint` v2 on `./internal/server/...`: 0 issues.
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