Skip to content

Platform Bridge Connections

Connections use the authenticated Operations transport, an encrypted per-teacher cookie jar, and a separate Supabase Vault reader. They are outside the sync rail and offline stores. The initial implementation supports paste, verify, reconnect and revoke. Xuexitong password login and captcha relay remain unavailable pending the protocol and coexistence checks in ADR-0067.

Apply the additive migrations through the normal migration workflow. The custody migration requires Supabase Vault and pgcrypto in the extensions schema. It creates two NOLOGIN roles:

Role Privileges
bridge_session_writer Execute the narrow key-provisioning and unused-key cleanup functions. No decrypted-secret read.
bridge_session_reader Read the mapped bridge_private.session_secret view. No general Vault read, key provisioning or canonical table writes.

The operator supplies the environment-owned login credentials and role memberships. For a nonowner API login, grant the writer role to the actual role used by DATABASE_URL. Create a separate login inheriting the reader role; keep that connection separate from the API and credential signing connections. A database owner already has inherent privileges. Role membership alone does not grant the API’s canonical table access.

-- Operator privilege DDL; replace placeholders with the actual environment roles.
GRANT bridge_session_writer TO <configured_api_login>;
CREATE ROLE <bridge_reader_login> LOGIN INHERIT PASSWORD '<environment-owned-secret>';
GRANT bridge_session_reader TO <bridge_reader_login>;
Variable Purpose
DATABASE_URL Existing API connection; reservations, encrypted rows, audit and key lifecycle share its transactions.
BRIDGE_SESSION_DATABASE_URL Separate reader login, pointing to the same database; used only to read mapped Bridge keys.

Supply the reader URL through the deployment’s secret mechanism. The application does not create login credentials or widen signer privileges. Browser clients receive neither URL, key references nor encrypted jars. Client roles have no direct Bridge table grants; native owner SELECT RLS provides an additional boundary.

Open /connections, select the configured platform deployment, and paste a Cookie header or literal DevTools Copy-as-cURL. The server extracts cookies and probes its own fixed read endpoint; pasted request destinations, methods and other headers do not select an action. Pasted cookies initially apply only to the approved host because the copied header does not preserve their original Domain, Path or expiry attributes.

Verify checks a stored session. Reconnect names the current Connection and version, preserving its stable ID. A rejected replacement leaves the existing jar intact. If an interrupted probe remains pending, reload after its 120-second lease expires and retry. A late result from the old attempt cannot overwrite the retry or recreate a revoked Connection.

An authenticated listing proves session access; the current probes do not establish the platform’s self-account identity. The page reports identity as unavailable. An explicit unknown-to-unknown reconnect is accepted; a known account cannot become unknown or different. Future Pull/Push must verify their actual target and ownership after session replacement.

Current live teaching authority is required for new sessions and verification, including explicit teacher/assistant grants on personal Offerings. A Person whose teaching authority has ended retains authenticated access to list and revoke their own Connections. Revoke deletes local custody and the last Connection’s exact mapped Vault key; it does not delete remote content or sign the browser out of the external platform. Person erasure uses the same key cleanup.

Native SQL tests exercise the production key provider, store, encryption, roles, cleanup and erasure against a clearly marked Vault fixture. HTTP/MCP tests exercise sensitive refusals and audit omission with fictional secret values. These checks do not prove actual Vault extension encryption, a physically separate reader connection, current undocumented platform endpoints, login coexistence or captcha behavior. Exercise those separately in the isolated integration/live proof lanes before claiming the complete login slice.