feat: Add GitHub Account Binding, One-click Sync & Security Updates#112
feat: Add GitHub Account Binding, One-click Sync & Security Updates#112Che-Zhu merged 11 commits intoFullAgent:mainfrom
Conversation
Implement GitHub OAuth binding functionality that allows users (e.g., password-authenticated users) to link their GitHub accounts to their existing sessions. Changes: - Add GitHub binding status API (GET /api/user/github) - Add GitHub unbind API (DELETE /api/user/github) - Add OAuth initiation endpoint (GET /api/user/github/bind) - Add OAuth callback handler (GET /api/auth/github/callback) - Add GitHub tab to Settings Dialog with binding UI - Implement popup-based OAuth flow with postMessage communication Technical details: - Use CSRF protection with state parameter stored in httpOnly cookie - Store GitHub credentials in UserIdentity.metadata (token, login, avatar) - Prevent unbinding if GitHub is the only login method - Set isPrimary=false for binding (not primary authentication) - State expires after 10 minutes for security The binding flow uses a popup window to avoid disrupting the main application, with automatic status refresh upon successful binding.
- Integrate pushToGithub into initializeRepo and commitChanges workflows to ensure code syncs to remote. - Add router.refresh() in RepoStatusIndicator to update UI state immediately after initialization. - Refactor RepoStatusIndicator to use semantic button elements for accessibility. - Enhance UI with better loading states and adjusted icon sizes.
|
Please hold off on merging this PR. I have one more change to make. It's missing one edge case: attempting to sync a project to GitHub without a linked GitHub account. |
✅ PR Check Results: PassedBuild Checks
✨ Great work!All checks passed successfully. Your PR is ready for review. Details:
🔗 View Details: |
Update repoService to propagate 'GITHUB_NOT_BOUND' error code when identity is missing. Update RepoStatusIndicator to catch this error and trigger the local SettingsDialog, streamlining the authentication flow.
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive GitHub integration features including OAuth account binding, one-click repository synchronization, and AI-enhanced git commits. It also addresses critical security vulnerabilities by updating Next.js from 16.0.7 to 16.0.10 to patch CVE-2025-55184 (DoS) and CVE-2025-55183 (source code exposure).
Key changes include:
- GitHub OAuth binding flow with CSRF protection for secure account linking
- Automated repository creation and code synchronization via WebSocket-based command execution
- UI improvements with auto-prompt for GitHub binding and real-time repository status indicator
- Security-focused error propagation for
GITHUB_NOT_BOUNDstates
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates Next.js and related packages from 16.0.7 to 16.0.10 for security patches |
| package.json | Specifies Next.js version 16.0.10 as dependency |
| lib/util/ttyd-exec.ts | Adds optional timeout parameter to execCommand for longer-running git operations |
| lib/services/repoService.ts | New service implementing git repository initialization, GitHub repo creation, commit/push operations with ownership validation |
| components/layout/status-bar.tsx | Integrates RepoStatusIndicator component and makes project prop required |
| components/layout/repo-status-indicator.tsx | New component providing GitHub sync UI with loading states and Settings dialog integration |
| components/dialog/settings-dialog.tsx | Adds GitHub tab for account binding/unbinding with OAuth popup flow |
| app/api/user/github/route.ts | New API endpoints for retrieving GitHub binding status and unbinding accounts |
| app/api/user/github/bind/route.ts | Initiates GitHub OAuth flow with state parameter for CSRF protection |
| app/api/auth/github/callback/route.ts | Handles OAuth callback, validates state, exchanges code for token, and creates UserIdentity |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
This PR introduces full GitHub integration capabilities, enabling users to bind their GitHub accounts via OAuth and synchronize their project code to a remote GitHub repository with a single click. It also includes critical security updates and UX improvements for a seamless authentication flow.
It addresses the need for users to easily backup their work and manage version control without leaving the application interface or manually using the command line.
Key Features
1. GitHub Account Binding (OAuth) & UX Improvements
2. One-click Repository Synchronization
git initand GitHub repository creation process.claudeCLI to automatically generate descriptive commit messages for staged changes.ttyd-exec) to run git commands directly in the user's sandbox environment.Security Updates
nextto16.0.10to address security vulnerabilities CVE-2025-55184 (DoS via malicious HTTP request) and CVE-2025-55183 (Source code exposure).repoServiceto strictly propagateGITHUB_NOT_BOUNDerror codes, ensuring precise frontend handling and preventing silent failures.Technical Details
ttyd-exec): reliable command execution via WebSocket connection to the sandbox's ttyd instance, handling authentication and output parsing.RepoService): Encapsulates all git logic includingcreateGithubRepo(via GitHub API) andpushToGithub(via git remote operations).getTtydContext, ensuring users can only execute commands on projects they explicitly own.Verification Plan