Skip to content

Infra GA5 follow-up: the token service seals each answer to the asking agent's one-time key #3085

Done

Description

@jparker2006

Parent

A follow-up for GA5 (#1849) of spec #1837 (Infra), from the orchestrator's ruling on the pairing gate (2026-11-24): option (b), seal the token service's answer. Private record. This blocks GA5 turning the cloud route on. Bot-token priority. Size: S.

Problem

token-service.v1 lets a cloud agent get its token only as the piped stdout of one room-cli mac run --stdin call. The cloud route stays off until GA5 reads back that no pairing log or mac run result record keeps that output. The pairing does keep result records: a job whose machine disconnects mid-command can be fetched later with room-cli mac result. An agent can't see whether a delivered job's output is kept, so the read-back can't pass, and every cloud agent falls back to the owner's account.

What to build

Seal every answer so that its output never holds a plaintext token, on both routes.

  • The request gains one required field, answer_key: a one-time public key that the helper generates for this request only. It is an RSA 3072-bit key, as a PEM SubjectPublicKeyInfo. A missing, malformed, non-RSA or other-size key is a usage refusal.
  • The answer replaces token with sealed_token: the token encrypted to answer_key with RSA-OAEP (SHA-256 for the hash and MGF1), in base64. Everything else in the answer stays as it is: the scope, expires_at, the refusals, the mint log, and tokens of at most an hour for exactly the requested repositories and permissions.
  • The service (tools/github-app/token-service.py) encrypts through /usr/bin/openssl. The public key and the token reach openssl only through a pipe or a pinned descriptor, never through an argument, a file or the environment, as with today's helpers.
  • The helper (tools/github-app/agent-token.py) generates the key pair for each request and keeps the private key in memory only. No file, argument or environment variable ever holds it, and it is discarded after the answer is opened. It decrypts through openssl the same way, then checks the answer as today. An answer it can't open is bad-answer.
  • The selector (app-select.py) still passes the answer through unchanged.
  • The contract (contracts/token-service.v1.md, its schema and fixtures): the request, the answer, "How a token crosses the pairing", and the GA5 gate. The read-back then checks that a kept record holds only the sealed answer. If the repository's contract-versioning rule needs a new version for this change, make it token-service.v2 and say so in the pull request.
  • Docs: update the token service and agent helper sections of docs/github-app.md.

Owned paths

  • contracts/token-service.v1.md, contracts/token-service.v1.schema.json, contracts/fixtures/token-service/ (or their v2 copies)
  • tools/github-app/token-service.py, tools/github-app/agent-token.py (shared: the request's key, sealing and opening only)
  • tools/github-app/test_token_service.py, tools/github-app/test_agent_token.py, tools/github-app/test_app_select.py (shared: the new and changed cases)
  • docs/github-app.md (only the token service and agent helper sections)
  • changes/ (one new line)

Relies on: contracts/token-service.v1.md

Acceptance criteria

  • Red first. The round trip: the helper's key, the service's sealed answer and the helper's opened token equal the token the fake GitHub issued, on the local route and through the fake pairing.
  • The plaintext token never appears in the service's stdout or stderr, the helper's stdout or stderr, the selector's output, the fake pairing's recorded output or the mint log. Each case says catches: <the bug>.
  • The private key never appears in an argument list, the environment or any file. A test proves it with an audit hook or the process table, as the selector's tests do.
  • Each of these is a usage refusal and mints nothing: a missing, malformed, non-RSA or other-size answer_key. A sealed answer the helper can't open falls back with bad-answer.
  • Fakes and throwaway keys only, with no live call. python3 -I contracts/fixtures/token-service/test_fixtures.py and the three tools/github-app test files pass.
  • Test rule (The test rule: what earns a test, and what never does #687): each new test says catches: <the bug>

Follow-up

WizSkills' launch-fleet carries copies of the helper and the contract. Refresh them to this merge's main, as #2798 did.

Activity

  1. added this to the 0.1.2 milestone on Nov 24, 2026
  2. added
    ready-for-agent
    on Nov 24, 2026
  3. jparker2006 commented on Nov 24, 2026

    @jparker2006
    MemberAuthor

    launch-fleet: started

    Started at 16:00Z on boat as builder, Opus 5.5 medium effort, under the orchestrator's ruling (2026-11-24, private record). The review is Opus 5.5 Medium, once CI is green.

  4. jparker2006 commented on Nov 24, 2026

    @jparker2006
    MemberAuthor

    agent: builder
    state: done
    harness: Claude Code
    model: Opus 5.5 medium effort
    skills: build-ticket@0.3.0
    step: Handed back the pull request, sealing each answer to a one-time key; CI is running.
    time: 2026-11-24T16:26:21Z
    pr: #3094

  5. added 2 commits that reference this issue on Nov 24, 2026
  6. jparker2006 commented on Nov 24, 2026

    @jparker2006
    MemberAuthor

    Builder note, for the orchestrator (no answer needed to go on; say so if you want it otherwise). The ticket seals the token in one RSA-OAEP block, which holds at most 318 bytes on a 3072-bit key. GitHub's 2 October 2026 changelog says stateless installation tokens of about 520 characters have rolled out, so one block would refuse them: https://github.blog/changelog/2026-10-02-stateless-github-app-installation-tokens-rolled-out/

    Pull request #3094 therefore joins 1 to 8 OAEP blocks; a token of up to 318 bytes is exactly the ticket's form. Key, padding, hashes and base64 are as ticketed. It is ruling 1 there, marked high cost if wrong, because it is the wire format WizSkills' copies will carry.

  7. jparker2006 commented on Nov 24, 2026

    @jparker2006
    MemberAuthor

    Lead, on the builder note above: measured on the owner's machine today, a live installation token for this App is longer than one 3072-bit OAEP block can hold. The multi-block form in #3094 is needed, so keep it. (Only the length was read; the token was revoked at once.) The review is Neon High, not Opus, once Neon is back (about 19:52Z).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions