Repository navigation
feat: verify GitHub installation access outside sign-in - #46
Merged
Merged
Conversation
Recording which GitHub App installations a user can reach no longer depends on the sign-in library, which @convex-dev/auth 2.0 needs because its GitHub sign-in keeps the user token to itself. - "Verify GitHub access": an authenticated action starts a GitHub App user authorization (state stored only as a hash, PKCE S256, 10-minute expiry); the /github/access/callback route exchanges the code, records the installations only for the GitHub account linked to that user, revokes the token and returns to a path on Gitdog's site. - The redirect URI uses the same host as the sign-in callback (CUSTOM_AUTH_SITE_URL or CONVEX_SITE_URL); both callbacks are documented for the GitHub App. - The connect page starts it and reports cancelled, failed or mismatched accounts; the consent page's sign-in re-authorization path is removed. - CLI: new github verify command; github recover points to it. - Sign-in and the new flow share one attestation save and linked-account lookup.
|
Visit the preview URL for this PR (updated for commit cf492c3): https://codeyou-df251--pr46-feat-github-access-v-1ild3inm.web.app (expires Fri, 27 Nov 2026 10:42:45 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 844dad9c62537d028cabc21008e4e2e4031ce4e5 |
hyochan
added a commit
that referenced
this pull request
Nov 20, 2026
## Summary Follow-ups found reviewing today's auth 2.0 work (#46, #47, #48) and own-key cost UI (#45). - **Connect page**: after 2.0, installation recovery reports `reauth_required` whenever no fresh attestation exists, so a brand-new user saw "Finishing GitHub connection" instead of Install. Users without an installation now see Install, with "Already installed? Verify GitHub access" as a secondary action. The verification screen is shown only while an installation callback is pending. Screen choice moved into `resolveConnectScreen` with a table test. - **Usage**: the own-key section said reviews run on Gitdog tokens whenever no key worked, but saved keys never fall back. It now distinguishes no key / no working key / temporary outage. The page waits for own-key cost before rendering. - **Consent page**: shows why a GitHub sign-in failed (`useOauth().flowError`). - **CLI**: `github verify` reuses `validateAuthRedirect` (also handles a missing URL); install hints mention `github verify` before `github recover`. - **Smaller**: `getTicketUsage` and recent own-key runs respect `githubLifecycleOnly`; long-context price note in the model picker; per-provider "this period" wording; shared `actionTypeLabel`; screen-reader request count on the usage chip; unused `repositories[].actions` removed. - **Docs**: `getAuthUserId` import path, CLI fixed ports, verify-access architecture line, `CUSTOM_AUTH_SITE_URL` comment. - **Tests**: session auth rejects a bare user-id subject and a revoked session; sign-in redirect allow/deny at the mutation; CLI port fallback and all-ports-busy; consent flow errors. `CONVEX_CLOUD_URL` moved to test setup. ## Verification `bun run lint`, `typecheck`, `build`, `format:check`, `check:api`, `typecheck:cli`, `test:cli` (118 pass), `vitest run` (2124 pass). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Summary
Gitdog records which GitHub App installations a user can reach (
githubOAuthInstallationAttestations, valid 15 minutes) from the user's own GitHub token. Today that happens only inside sign-in.@convex-dev/auth2.0 keeps the GitHub token inside its component, so this moves the check into its own flow first; the 2.0 migration follows in a separate PR.Verify GitHub access
github/action:startAccessVerification({ returnPath })(signed in): creates a random OAuth state (stored only as a SHA-256 hash) and a PKCE verifier, and returns the GitHub App authorize URL. A user has at most one pending verification; it expires after 10 minutes.GET /github/access/callback: consumes the state once, exchanges the code with the client secret and verifier, reads/userand/user/installations, saves the installations only if the GitHub account is the one linked to that user, revokes the token, and redirects to the return path on Gitdog's site with?githubAccess=verified|account_mismatch|cancelled|failed.CUSTOM_AUTH_SITE_URL, elseCONVEX_SITE_URL), so production useshttps://auth.gitdog.dev/github/access/callback. Both callbacks are now documented indocs/github-app-setup.md./..//evil.exampleis refused) and the final redirect must stay onSITE_URL.Web and CLI
gitdog github verify;github recoverpoints to it instead oflogin.Shared
saveInstallationAttestationand onereadLinkedGitHubAccountId, the single place to change when accounts move into the auth component.Before merging
Both GitHub Apps must list the new callback URL, or GitHub stops the flow with a redirect_uri error:
gitdogbot-dev:https://fortunate-chihuahua-679.convex.site/github/access/callbackgitdogai:https://auth.gitdog.dev/github/access/callbackChecks
bun run lint,bun run typecheck,prettier --check .,bun run build,bun run test(2122 passed),bun run check:api,bun run test:cli(116 passed)github verify.🤖 Generated with Claude Code