Skip to content

feat(hub): a store for the secrets of upstream MCP servers (ADR-0069) - #325

Merged
7schmiede merged 1 commit into
mainfrom
feat/hub-upstream-secrets
Oct 27, 2026
Merged

7schmiede merged 1 commit into
mainfrom
feat/hub-upstream-secrets

Conversation

@7schmiede

Copy link
Copy Markdown
Member

First part of ADR-0069 (Refs #316): where the hub keeps the secrets of the user's upstream MCP servers. Nothing uses it yet; nothing user-visible, so no changelog entry.

What

  • crates/devstack-hub/src/secrets.rs: Secrets::open(dir) → get / set / delete per upstream, kind() (Keychain | File).
  • Keychain via keyring 4 (service devstack, account upstream:<name>): Windows Credential Manager, macOS Keychain, Linux Secret Service.
  • Linux without a Secret Service: a probe entry fails → secrets.json in the hub's state directory, 0600 (the hub's write_private). Windows and macOS never fall back: a refusing keychain is said when a secret is used.
  • No route hands a secret out (no token passthrough).
  • ADR-0069 amended with the spike's result.

Spike

  • keyring 4.2.0 and its store crates: MIT OR Apache-2.0, Rust ≤ 1.88 (ours 1.98). All 128 crates of its tree, every platform, are on deny.toml's licence list (checked with cargo metadata; this PR's deny job checks bans too).
  • Windows: written, read, deleted in the Credential Manager (spike and this PR's test).

Tests

a_secret_is_kept_given_back_and_forgotten against the machine's real store, under a service of its own per run (Windows and macOS: the keychain; Linux CI: whichever the probe finds); the_file_is_the_users_alone (0600 on Unix). macOS and Linux run them in CI here.

🤖 Generated with Claude Code

The first part of ADR-0069: `secrets::Secrets` keeps a secret per
upstream in the OS keychain (`keyring` 4: Windows Credential Manager,
macOS Keychain, the Linux Secret Service). A Linux machine without a
Secret Service gets a `secrets.json` in the hub's state directory,
readable by the user alone; a probe entry decides. Nothing uses it yet
and no route hands a secret out.

ADR-0069 amended with the spike: the crate, its licences, the Linux
fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit a1d11e5 into main Oct 27, 2026
13 checks passed
@7schmiede
7schmiede deleted the feat/hub-upstream-secrets branch October 27, 2026 18:19
7schmiede added a commit that referenced this pull request Oct 27, 2026
…he hub (ADR-0069) (#329)

The first part of ADR-0069 (card on #316, approved 2026-10-27, points
1, 4, 7): `upstreams.toml` per user in the hub's state directory, no
secret in it; the hub's own OAuth login (RFC 9728 and RFC 8414
discovery, RFC 7591 registration where offered, PKCE S256, RFC 8707
resource, a one-time `state` for ten minutes, the browser back at
`/oauth/upstream/callback` on the hub's port); a static token the user
gives the hub; credentials in the keychain store of #325; refresh before
expiry with rotation. The dashboard's page *MCP upstreams* (sidebar)
adds, changes, logs in and out, and removes them. No route returns a
secret. Their tools in `devstack mcp` follow.

The OAuth flow is written against `ureq` rather than the `oauth2` crate
(another HTTP client); `base64` added for PKCE, `sha2` was there.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede 7schmiede mentioned this pull request Oct 27, 2026
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