Repository navigation
Connect: read-only Google sign-in for blocks that need OAuth - #156
Merged
Merged
Conversation
APEX_PLAN 6.8. The compiler binds Google's paired oauth2 schemes as one `oauth` binding, only for a read operation, only with its narrowest `.readonly` scope, and only when the API is on Google's own hosts; a write that needs a sign-in is refused (AGENTS.md stop condition 3). The server runs authorization code with PKCE through an owner-registered client (OMNI_GOOGLE_CLIENT_ID/SECRET), keeping no state: the verifier, scopes and nonce ride in a signed httpOnly cookie bound to `state`. It checks the granted scopes, requests no refresh token, and hands the token to the starting page over a same-origin BroadcastChannel from a callback page whose only script is allowed by hash. The token lives in the manifest's own slot for the session; the device vault never keeps it, and it is dropped a minute before it expires. The block shows "Sign in with Google" (or that the server has no client), and "Sign in again" on a refusal. Off in the public preview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sykosyber
enabled auto-merge
October 12, 2026 23:08
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2b2aca409
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This was referenced Oct 12, 2026
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.
Objective. APEX_PLAN 6.8: let a block that reads the person's own data from a provider that requires OAuth (Google first) sign in, without widening Flyspace's write surface and without keeping tokens anywhere but the session.
What changed
src/core/capabilities/connectProviders.ts: the providers the compiler may bind (Google:accounts.google.com, APIs on*.googleapis.com, read-only = scope ending.readonly).openapi.ts: a security requirement made only of oauth2 schemes (Google pairs an implicit and an authorizationCode scheme over the same scopes) binds as oneoauthauth. It requires: a connectable provider, the API on that provider's own hosts, a read operation, and an alternative whose scopes are all read-only. The narrowest such alternative is chosen. Writes are refused ("Signed-in operations are read-only in Flyspace"). Measured on the real Google Calendar v3 spec: 7 read operations compile withcalendar.readonlyonly, 26 writes are refused.events.listis still refused for an unrelated reason (an optional array query parameter), next package.src/core/services/server/oauthConnect.ts+src/app/api/oauth/**: authorization code + PKCE (S256) with the owner's client (OMNI_GOOGLE_CLIENT_ID/OMNI_GOOGLE_CLIENT_SECRET). The flow is stateless: verifier, scopes and the opener's nonce ride in an httpOnly, SameSite=Lax cookie HMAC-signed with a key derived from the client secret, bound tostate, valid 10 minutes, cleared on callback. The server refuses non-read-only scopes at start, checks the granted scopes, usesaccess_type=online(no refresh token), passes no provider error text on, and stores and logs nothing.GET /api/oauthlists configured providers (names only). The start route refusesSec-Fetch-Site: cross-site.BroadcastChannel(which survives the provider's COOP, unlikewindow.opener). Its CSP isdefault-src 'none'with the one inline script allowed by sha256. JSON is escaped against</script>.src/core/capabilities/connect.ts: opens the window synchronously from the click, accepts only its own nonce and exactly the manifest's scopes, and puts the token in the manifest's slot (per origin and scope set) withsessionOnly. The token is dropped 60 s before expiry.secrets.ts:set(..., { sessionOnly });refs()(used only by the device vault) omits session-only slots, so "Remember keys" never stores a sign-in.OMNI_GOOGLE_CLIENT_SECRETadded toSECRET_ENV_VARS(bundle scan and scrubber)..env.example,DEPLOYMENT.md"Connect (OAuth sign-in)",DESIGN.md,APEX_PLAN.md6.8 status.What did not change. No write or destructive operation can be compiled with OAuth (stop condition 3). OAuth never rides the server broker (existing rule). The public preview offers no sign-in (
OMNI_PUBLIC_DEMO=1→ no providers, start 503).public/api-index.jsonis not rebuilt, so search still lists Google APIs as blocked untilnpm run catalog:buildruns. AGENTS.md is not edited: a sign-in token follows its existing rule for credentials (browser memory, session only, attached to the capability's own request).Tests run
npm run typecheck0 errors;npm run lint0 errors (8 existing warnings).npm test: 1619 passed, 1 failed (fieldHarness.test.ts, the known Windows-only CRLF failure).connect.compile.test.ts(6),oauthConnect.test.ts(11: config gating and preview, write scope refused, PKCE challenge matches verifier, client secret only in the token request, missing/forged cookie, state mismatch, expiry, unticked scope, provider error text not echoed, CSP hash, script break-out),connect.test.ts(5: re-pointed manifest gets no sign-in, nonce filtering, scope mismatch, blocked popup, expiry, vault exclusion),SignIn.component.test.tsx(3),redirectUri.test.ts(2). Fixtures and stubs only.npm run build+npm run scan:bundle: PASS.npm run build:next+npm run test:e2e: 9 passed.next startwith a dummy client:GET /api/oauth→{"providers":["google"]}; start → 302 toaccounts.google.com/o/oauth2/v2/authwithredirect_uri=http://127.0.0.1:3123/...and aHttpOnly; SameSite=lax; Path=/api/oauthcookie; a write scope → 400; a callback without the cookie → 400 page with the hashed CSP. The smoke caught thatnext startreportslocalhostfor127.0.0.1, which would have split the cookie from the callback. Fixed: the redirect URI uses the browser's Host (orOMNI_OAUTH_ORIGIN).Measurements. Google Calendar v3 compile counts above. No live sign-in.
Known failures.
fieldHarness.test.tson Windows only.Claim ceiling. Implemented and tested with fixtures and stubs. No live Google sign-in has been run: no OAuth client is registered.
Architectural decisions introduced
connectProviders.ts), independent of whether a client is configured.Evidence that could falsify it. A compiled manifest with
oauthauth for a non-GET, a non-.readonlyscope, or a non-Google host. A token reaching a slot for any other origin. The device vault holding a sign-in token. A callback succeeding without the start cookie. The client secret appearing in a redirect, a cookie, a page, or.next/static.Owner action. Register a Google OAuth client (DEPLOYMENT.md, Connect), then do the first real sign-in, e.g. Calendar
calendarList.list.Next permissible package. Compile optional compound query parameters by leaving them out (unblocks Calendar
events.list), then rebuild the API index.🤖 Generated with Claude Code