Securecookie cookies + Cookie key (BYO + leader-generated) #33

Closed
opened 2026-09-15 23:27:01 +00:00 by ginjiruu · 0 comments
Owner

Parent

#31 — Spec: public-client support + replace hand-rolled protocol code with the x/oauth2 + go-oidc + hstern trio

What to build

The Session and State cookies become signed+encrypted gorilla/securecookie blobs. The Session blob holds {idToken, refreshToken}; the State blob holds {appKey, nonce, returnTo}. A single bridge-level Cookie key (an HMAC hashKey + an AES blockKey) is shared by all replicas: if a key Secret already exists (BYO) the bridge uses it; otherwise the leader generates a strong random key and writes it create-if-absent. A cookie set by one replica must decode on any other.

Acceptance criteria

  • The Session and State cookies are encoded/decoded as securecookie blobs (signed + encrypted) and round-trip.
  • A tampered cookie, or one signed with a different key, is rejected (treated as no Session / no state).
  • The leader creates the Cookie key Secret when absent, leaves a BYO key Secret untouched, and is idempotent across re-runs.
  • All replicas share the same key (a cookie written by one replica decodes on another).
  • make test passes (serve cookie round-trip tests + leader key-authoring envtest).

Blocked by

  • None — can start immediately.
## Parent #31 — Spec: public-client support + replace hand-rolled protocol code with the x/oauth2 + go-oidc + hstern trio ## What to build The **Session** and **State** cookies become signed+encrypted `gorilla/securecookie` blobs. The Session blob holds `{idToken, refreshToken}`; the State blob holds `{appKey, nonce, returnTo}`. A single bridge-level **Cookie key** (an HMAC hashKey + an AES blockKey) is shared by all replicas: if a key Secret already exists (**BYO**) the bridge uses it; otherwise the **leader** generates a strong random key and writes it **create-if-absent**. A cookie set by one replica must decode on any other. ## Acceptance criteria - [ ] The Session and State cookies are encoded/decoded as securecookie blobs (signed + encrypted) and round-trip. - [ ] A tampered cookie, or one signed with a different key, is rejected (treated as no Session / no state). - [ ] The leader creates the Cookie key Secret when absent, leaves a BYO key Secret untouched, and is idempotent across re-runs. - [ ] All replicas share the same key (a cookie written by one replica decodes on another). - [ ] `make test` passes (serve cookie round-trip tests + leader key-authoring envtest). ## Blocked by - None — can start immediately.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lab/authz-bridge#33
No description provided.