Skip to content

OpenSecret: remove Transport V1 - #1647

Merged
AnthonyRonning merged 3 commits into
masterfrom
remove-transport-v1
Nov 19, 2026
Merged

AnthonyRonning merged 3 commits into
masterfrom
remove-transport-v1

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Removes Transport V1 from the OpenSecret backend. Transport V2 is now the only way to reach the application.

Both in-tree SDKs, Research, the proxy and the Agent have spoken only V2 since September 14 (Research 3.4.0, SDK 4.0). The backend still served V1 beside it: the application router was mounted on the listener as well as behind the V2 gateway, and most boundaries carried a second, weaker branch for V1 callers.

What a deploy of this changes

Clients older than Research 3.4.0 or SDK 4.0, including older proxy builds, stop working against a backend built from this commit. They can neither start a session (POST /key_exchange is gone and the attestation document carries no key) nor use one they already hold (application routes return 404 in plaintext). V1 access and refresh tokens are accepted nowhere. API keys are unaffected.

GET /attestation/{nonce} stays, because the apps' verification page and deployment checks read it. It is now a public attestation document rather than a handshake: it attests no key (public_key is null) and stores no state.

Change

The listener serves /health-check, /attestation/{nonce}, /v1/remote/relay-access and the two /v2 endpoints, and nothing else. Application routes are mounted only inside the gateway. Each one also refuses a request the gateway did not decrypt: only the gateway can attach the in-process session marker, and authentication reads only the credential the envelope carried, never an outer Authorization header.

Removed:

  • POST /key_exchange, the per-nonce ephemeral keys, the V1 session store (lease_aware_cache.rs) and its maintenance task, per-field request and response encryption, and per-event SSE encryption.
  • The V1 token audiences (access, refresh, platform_access, platform_refresh). Nothing issues or accepts them. They stay reserved so a third-party token can never carry one.
  • Unbound OAuth authorization URLs and state. Every redirect is bound to its initiating session with PKCE (GitHub, Google) or the nonce (Apple), and the callback now treats a missing binding as an internal error instead of exchanging without it.
  • The fallback provider cache namespaces for callers with no cache root, including Tinfoil's SHA-256(user UUID). A completion without a cache root is refused.
  • The lenient end-of-stream rule that accepted a provider stream with no [DONE] after a finish signal. V2 already required [DONE].
  • The route and handler gates that existed only to turn V1 sessions away from recovery, password-reset, native-handoff and remote routes.

Handler call sites keep their names (decrypt_request, encrypt_response, TransportSession), so branches in flight do not conflict in every handler. encrypt_response and the SSE helpers now only serialize, since the gateway encrypts the whole response.

Two things moved rather than disappeared:

  • The relay admission route was merged into the application router, so it was reachable both in plaintext and inside V2. It is a service-to-service plaintext route and is now mounted only on the listener; inside an envelope it is now a 404.
  • bounded_ttl_cache.rs loses the take and retire methods only the V1 pending-key store used. Sticky routes still use the rest.

Docs: transport-v2-protocol.md gets a "Transport V1 is retired" section in place of "V1 compatibility", and the skills and smaller docs that said the two transports coexist are corrected.

Tests

New or changed coverage for what replaced the V1 tests:

  • A request with no gateway session never reaches a handler (encryption_middleware).
  • A valid access token in an outer Authorization header is not a credential (recovery_route_tests).
  • The retired audiences are refused by every validator and stay reserved (jwt).
  • Through the real gateway against a database: the listener returns 404 for every recovery route, the application refuses the same request sent around the gateway, an OAuth callback from another session is refused without consuming state, and OAuth initiation sent around the gateway starts nothing.
  • A source invariant pins the listener to its four surfaces, main() to serving that router as built, and the application to the gateway.
  • A second invariant parses every router under src/web and requires a transport-boundary layer on each handler of each application route (over 100 handlers), so a router mounted in the wrong place still fails closed.

Checked locally

  • os-rust: cargo fmt --check, Clippy with -D warnings, and cargo test: 1,170 passed, 103 ignored.
  • disposable_db_tests.sh: 129 database-backed tests passed (27 AEAD, 2 OAuth, 6 callback, 21 compaction, 43 recovery). Its pinned counts change with the removed V1 cases: callback completion 4 to 2, recovery routes 31 to 30.
  • The os-sdk-e2e steps on free local ports: the TypeScript SDK's 87 integration tests and the Rust SDK's integration tests, including the native-handoff full-stack round trip, pass against this backend.
  • Against that running backend: /health-check and /attestation/<nonce> return 200; /key_exchange, /login, /protected/user, /v1/models and /v1/chat/completions return 404; /v1/remote/relay-access without its token returns 403.

Not checked: a built EIF, a hosted deployment, or a released V1 client against this backend.

Left for follow-up

  • Research still ships the hosted legacy desktop sign-in bundle (@opensecret/react-v1). It cannot sign anyone in once this is deployed.
  • Both SDKs still carry unused V1 handshake code and types.

🤖 Generated with Claude Code

AnthonyRonning and others added 3 commits November 19, 2026 11:56
Transport V2 has been the only transport the in-tree SDKs speak since
September 14 (Research 3.4.0, SDK 4.0). The backend still served V1 beside
it: the application router was mounted on the listener as well as behind the
V2 gateway, and nearly every boundary carried a second, weaker branch for
it. This removes that branch everywhere.

The listener now serves only /health-check, the public attestation
document, the relay fleet's admission check and the two /v2 endpoints.
Application routes are reachable only inside a V2 envelope, and each one
refuses a request the gateway did not decrypt: only the gateway can attach
the in-process session marker, and authentication reads only the credential
the envelope carried, never an outer header.

Removed with it:
- POST /key_exchange, the per-nonce ephemeral keys, the V1 session store
  and its maintenance task, per-field request and response encryption, and
  per-event SSE encryption;
- the V1 access and refresh token audiences. Nothing issues or accepts
  them; they stay reserved against third-party tokens;
- unbound OAuth authorization URLs and state. Every redirect is bound to
  its initiating session with PKCE or the Apple nonce;
- the operator-computable provider cache namespaces. A completion without
  a cache root is refused;
- the lenient end-of-stream rule that accepted a provider stream without
  [DONE] after a finish signal;
- the route and handler gates that existed only to reject V1 sessions on
  recovery, password-reset and remote routes.

GET /attestation/{nonce} stays, as a public attestation document rather
than a handshake: it attests no key and stores no state. The apps'
verification page and deployment checks read it.

Handler call sites keep their names (decrypt_request, encrypt_response,
TransportSession); only what is underneath them changed.

Clients older than Research 3.4.0 or SDK 4.0, including older proxy builds,
cannot use a backend built from this commit.

Co-Authored-By: Claude <noreply@anthropic.com>
Follow-ups from review of the Transport V1 removal.

- A source invariant now walks every router under src/web and requires
  a transport-boundary layer on each handler of each application route.
  The existing invariant also pins how main() serves the listener and
  the exact routes of the four plaintext routers.
- The OAuth redirect callback no longer has an exchange path without
  the PKCE verifier or a verification path without the Apple nonce: a
  missing binding is an internal error instead of a silent skip.
- Refresh request types are no longer deserializable, since a refresh
  token only ever arrives as the envelope's resumption credential.
- Drop the key_exchange diagnostics route class, rename the SSE event
  helper, and correct docs, comments and test names that still
  described per-session encryption.

Co-Authored-By: Claude <noreply@anthropic.com>
The test arrived on master after this branch was cut and still built
the cache policy through the variant and the user argument this branch
removes, so the rebased branch did not compile its tests.

Co-Authored-By: Claude <noreply@anthropic.com>
@AnthonyRonning
AnthonyRonning merged commit e54baf2 into master Nov 19, 2026
23 checks passed
@AnthonyRonning
AnthonyRonning deleted the remove-transport-v1 branch November 19, 2026 20:17
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