Skip to content

integration-proxy 0.2: Atomic v2 signed requests, agent-owned connections, delegations and frame capabilities (#54) - #122

Merged
michielbdejong merged 2 commits into
mainfrom
claude/issue-54-proxy-auth
Sep 24, 2026
Merged

michielbdejong merged 2 commits into
mainfrom
claude/issue-54-proxy-auth

Conversation

@michielbdejong

Copy link
Copy Markdown
Contributor

Implements the proxy side of the interim #54 decision (the "Proposal: integration-proxy auth redesign" comment). It supersedes draft #72.

  • Identities: one parse function (src/agent_id.rs) accepts atomic:agent: and did:ad:agent:, in either base64 alphabet, and always stores and returns canonical atomic:agent:<base64url>.
  • Atomic v2 request signatures:
    • The signed message is atomic-request-v2\n{METHOD}\n{full URL}\n{ts}\n{sha256(body)}.
    • Version 2 only, ±5 min clock skew, each signed request accepted once, and the agent must equal atomic:agent:<pubkey>.
    • The full URL is built from BASE_URL plus the path and query, never from Host.
  • Routes:
    • /proxy/{connection_id}/{platform}/{path};
    • /connect, with no login and no user_id, plus the consent page;
    • a signed POST /connect/redeem, where the signer becomes the owner;
    • GET /connections and DELETE /connections/{id};
    • POST/DELETE /connections/{id}/agents for delegations;
    • POST /runtimes and DELETE /runtimes/{agent}.
      Delegations and runtimes are checked on every request.
  • Frame capability v2: Authorization: Capability <payload>.<sig>, signed by the owner, with cnf naming the frame key, aud the proxy origin, and exp at most 15 min ahead. The request itself must be signed by the cnf key.
  • Flag day:
    • removed: OIDC/APP_AUTH_*, tenant:v1:, tenant secrets and SERVER_SECRET, /session, the legacy /connect and /oauth/{platform}/start, and rotating connection codes;
    • the connection_codes and oauth_states tables are left in place, and the README gives the DROP TABLE line.
  • Access: an AccessPolicy trait (build_app_with_access). The default allows everyone except agents in REVOKED_SUBJECTS, with an optional ALLOWED_AGENTS list. The atomic.place account lookup (atomic-saas#138) plugs in here later.
  • Kept from integration-proxy: persistent DID-bound connections, signed requests and capabilities (candidate for #54) #72: sealed per-row credentials, 90-day idle expiry, one token refresh at a time per connection, and the single-use record of signed requests.
  • Errors: JSON {error, message} with stable codes, for example capability_expired, not_delegated, unknown_connection, capability_key_mismatch.

Tests: 106 pass against Postgres 16. They cover every verification step and failure mode, replay, expiry, revocation, capability misuse (stolen, wrong audience, expired, too long, wrong scope) and canonicalisation. There's also an end-to-end test: consent → OAuth (mock provider) → signed redeem → delegation → proxied call. atomic-server's shared v2 test vectors verify. fmt, clippy, cargo package and the Heroku wrapper build are clean.

Deployment:

  • The crate goes to 0.2.0, and the wrapper template now requires "0.2".
  • Production doesn't change until localthought/integration-proxy bumps to 0.2 and the Heroku env is updated:
    • BASE_URL=https://localthought.io, the exact public origin;
    • unset APP_AUTH_* and SERVER_SECRET;
    • REVOKED_SUBJECTS now holds agent ids.
  • Existing connections stop working at that point, so deploy it together with the atomic-server release that signs requests.

Not yet: the client side in integrations/ (browser.ts, github-issues proxy.mjs, the mock proxy, and the specs) is phase 2 of #54.

Refs #54. Supersedes #72.

🤖 Generated with Claude Code

Michiel de Jong and others added 2 commits September 24, 2026 13:31
…rame capabilities (#54)

Implements the proxy side of the interim #54 design ("Proposal:
integration-proxy auth redesign"), porting what is still valid from draft
PR #72 (persistent connection rows with row-bound sealed credentials,
90-day idle expiry, refresh lease, single-use signed-message replay store).

- Agent ids: one parse function accepts atomic:agent: and did:ad:agent:
  in both base64 alphabets and canonicalizes to atomic:agent:<base64url>.
- Atomic v2 request signatures (x-atomic-* headers,
  x-atomic-signature-version: 2, message atomic-request-v2 / METHOD /
  full URL / ts ms / sha256 hex body), v2 only, +/-5 min, single use,
  agent must be atomic:agent:<public key>. The signed URL is built from
  BASE_URL, never the Host header (TLS termination on Heroku).
- Routes: /proxy/{connection_id}/{platform}/{path}; /connect without
  login or user_id (https, loopback http or atomic:// return); signed
  POST /connect/redeem makes the signer the owner; GET /connections;
  DELETE /connections/{id}; POST/DELETE /connections/{id}/agents;
  POST /runtimes, DELETE /runtimes/{agent}. Delegations and runtimes are
  checked on every request.
- Frame capability v2 (Authorization: Capability <payload>.<sig>, owner-
  signed, aud = proxy origin, cnf = frame agent, exp <= 15 min), with the
  request itself signed by the cnf key. #72's v1 bearer capability is gone.
- AccessPolicy trait asked about the owner at redeem and on every signed
  request; default EnvAccessPolicy (REVOKED_SUBJECTS, ALLOWED_AGENTS).
- Flag day (decision 6): removes OIDC APP_AUTH_* login, tenantIdentity
  API login, tenant:v1, tenant secrets / SERVER_SECRET, /session, legacy
  signed /connect and /oauth/{platform}/start, the /proxy tenant check and
  rotating connection codes (Bearer / X-Connection-Code).
- JSON {error, message} bodies with stable codes (capability_expired etc).
- Crate 0.1.0 -> 0.2.0; Heroku wrapper template now depends on "0.2".

Tests: unit tests for every verification step, plus PostgreSQL tests for
replay, expiry, delegation/runtime revocation, capability misuse, access
policy, management, refresh lease, and an end-to-end OAuth connect ->
signed redeem -> delegate -> proxy flow. atomic-server's v2 golden vectors
are copied to tests/fixtures and verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oku 0.2 env changes (#54)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michielbdejong
michielbdejong merged commit 5312c14 into main Sep 24, 2026
17 checks passed
michielbdejong pushed a commit that referenced this pull request Sep 24, 2026
The e2e mock proxy now checks what the real proxy (integration-proxy/src,
#122) checks on the surface a client sees: Atomic v2 request signatures
(method, full URL under the mock's BASE_URL, timestamp, body hash; +-5 min;
single use), agent ids in both prefixes and alphabets, frame capabilities
(owner-signed, aud, exp <= 15 min, scope, delegation, cnf signs the
request), connections owned by the redeem signer, delegations, runtimes,
and the proxy's {error, message} codes. No login and no user_id at
/connect; API-key platforms take the key on the consent page, as
templates.rs does. Rotating connection codes, Bearer and X-Connection-Code
are gone.

Fixtures, their drivers (/__fixture/..., /fixture/<platform>/<driver>) and
failure injection are unchanged: the mock rewrites /proxy/{id}/{platform}/
to the /proxy/{platform}/ paths fixtures already match. New test-side
introspection: GET /__mock/connections and POST /__mock/revoke.

mock-proxy.test.mjs verifies the shared v2 vectors
(integration-proxy/tests/fixtures/atomic-request-v2-vectors.json) and
atomic-server's capability vector against the mock's verifier.

Kept the mock rather than running the real binary: the real proxy only
accepts https upstreams and catalogs, needs a provider OAuth server per
platform and Postgres per lane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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