i2goSignals

goSignals

22. Rotate-on-GET bearer rotation: possession-proof trigger, deferred revocation, unconditional masking

Date: 2026-06-12

Status

Accepted (design settled in GH #152 triage; implementation tracked there)

Context

The SSF spec expects a GET of a stream’s configuration to return a freshly-minted delivery bearer (rotate-on-GET). goSignals had never implemented it, and a naive implementation has two traps:

  1. Rotating on every GET breaks administration. Admin reads of stream config would invalidate the live credential each time, and admins would see (and could leak) live secrets they never need.
  2. Revoking the old bearer instantly bricks unlucky clients. A request racing the rotation gets a spurious 401, and a client whose rotation response is lost on the wire is left holding only a dead credential, with no self-service recovery.

Three callers can reach the config read surface: the credential holder (receiver/peer presenting the stream’s delivery bearer), management sessions, and admin tokens. Only the holder should be able to rotate; nobody else should see the live value.

Decision

Trigger — proof of possession. Rotation fires only when the GET is authenticated by the stream’s current server-issued bearer: after normal JWT validation, the presented Authorization value is constant-time-compared to the credential stored on the stream record (PollTransmitMethod / PushReceiveMethod / SSTP responder SstpMethod). Exact match → mint replacement, persist, return live value, schedule old for revocation. Anything else that is authorized to read → masked value, no rotation. Two explicit guards ride on top of the string match:

Revocation — deferred, with idempotent re-read. At rotation the old bearer’s token record gets revoked_at = now + grace (I2SIG_BEARER_ROTATE_GRACE, default 1h, 0 = immediate). IsRevoked changes from “revoked_at is set” to “revoked_at is set and in the past” — admin revocation (revoked_at = now) behaves exactly as before. During the window the old bearer still validates, and a GET presenting it returns the same current bearer again without minting a third credential — this is the self-service recovery path for a lost rotation response. No cluster cache is involved: every node already checks revocation against Mongo per validation, so deferral is pure policy, not cache coherence.

Masking — unconditional, sentinel ***. Every credential field (authorization_header in all delivery methods, SstpMethod’s bearer, tx_token) reads as the literal *** on every read surface (config GET, state listings). No env var disables masking. The live value appears exactly twice in a credential’s life: the create response and the rotation response. The update path treats an incoming *** as “leave unchanged” so read-edit-write round-trips cannot clobber live credentials. Masking is applied to a deep copy, never the stored record.

Gating. Rotation itself is gated by I2SIG_BEARER_ROTATE_ON_GET, default false for the first release (existing receivers that re-read config without persisting the response would otherwise be revoked out from under themselves). Masking is not gated.

Considered alternatives

Consequences

Positive

Negative / accepted trade-offs