feat(agent-bff): mode 1 oauth session core (issue tokens)#1715
Open
Tonours wants to merge 20 commits into
Open
Conversation
4 new issues
|
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (13) 🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
bb33f7e to
8724553
Compare
…uts and store bounds
… token and session copies
…ing and session purge
6e349be to
a35a769
Compare
…equired refresh token
…ken request retriable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fixes PRD-664
What this adds
Mode 1 OAuth session core for the BFF (
packages/agent-bff): the browser completes the authorization-code flow and the BFF issues its own session — a short-lived BFF access JWT + an opaque refresh token. The upstream Forest server tokens stay server-side; the browser never sees one.Builds on the PRD-649 spike (S2S code-exchange), promoted to production with hardening.
Scope
Two endpoints + the supporting layer:
GET /oauth/authorize— validates the request (client registered, redirect_uri match,response_type=code, mandatorycode_challenge_method=S256) and forwards client-owned PKCE + state to the Forest server.POST /oauth/token(grant_type=authorization_code) — exchanges the code, resolves identity, creates a session, returns{ access_token, token_type, expires_in, refresh_token }.type: bff_access,sid, whitelisted identity claims +tags,expiresIn = min(15m, remaining server-token lifetime), signedHS256.BFF_TOKEN_ENCRYPTION_KEY).ensureFreshServerAccess, single-flight per session) — wired into the request path by Slice 3.What does NOT change
No refresh-token grant (T5), no CORS/timezone/edge wiring (T6), no real agent call (Slice 3), no cross-origin proof (G1). No other package touched.
Security
client_idpercent-encoded into the S2S URL (no path injection); registry outage surfaces as a server error, not a misleadinginvalid_client.How to test
Boot with full OAuth config (incl.
BFF_TOKEN_ENCRYPTION_KEY, base64 32 bytes) to enable the routes; drop any required var → routes disabled, server still boots (/healthdegraded).Definition of Done
General
Security