-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(cli): add OpenAI Codex OAuth support #10756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add openai-codex to supported providers list - Implement OAuth authentication flow for OpenAI Codex - Create credentials storage for OpenAI Codex tokens - Add CLI commands: auth openai-codex:login, auth openai-codex:logout, auth openai-codex:status - Update provider settings to handle openai-codex without API key - OAuth uses PKCE flow with local callback server on port 1455
Review complete. Found 2 issues in the OAuth implementation:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| <html> | ||
| <head><title>Authentication Failed</title></head> | ||
| <body> | ||
| <h1>Authentication failed: ${error}</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OAuth error parameter is interpolated directly into HTML without escaping. An attacker could craft a malicious OAuth callback URL with an XSS payload in the error parameter (e.g., ?error=<script>alert(1)</script>). The error value should be HTML-escaped before embedding in the response.
| <h1>Authentication failed: ${error}</h1> | |
| <h1>Authentication failed: ${error.replace(/</g, '<').replace(/>/g, '>')}</h1> |
Fix it with Roo Code or mention @roomote and request a fix.
| const data = await response.json() | ||
| const tokenResponse = data as TokenResponse | ||
|
|
||
| const expiresAt = Date.now() + tokenResponse.expires_in * 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike exchangeCodeForTokens (lines 159-161), refreshAccessToken doesn't validate that required fields (access_token, expires_in) exist in the token response before using them. If the token endpoint returns a malformed response, expires_in * 1000 could result in NaN, and access_token could be undefined. Consider adding validation similar to exchangeCodeForTokens:
if (!tokenResponse.access_token || !tokenResponse.expires_in) {
throw new Error("Invalid token refresh response: missing required fields")
}Fix it with Roo Code or mention @roomote and request a fix.
Adds support for the OpenAI - ChatGPT Plus/Pro provider in the CLI using OAuth authentication instead of API keys.
Changes
openai-codexto supported providers list in CLIroo-code auth openai-codex:login- Authenticate with OpenAI Codexroo-code auth openai-codex:logout- Log out from OpenAI Codexroo-code auth openai-codex:status- Show authentication statusUsage
Testing
View task on Roo Code Cloud
Important
Adds OAuth support for OpenAI Codex in CLI with new login, logout, and status commands, and updates provider settings for OAuth handling.
openai-codexto supported providers intypes.ts.openai-codex-oauth.tsusing PKCE.openai-codex:login,openai-codex:logout, andopenai-codex:statuscommands inindex.ts.openaiCodexLogin(),openaiCodexLogout(), andopenaiCodexStatus()in respective files.openai-codex-credentials.tsfor storing and managing OpenAI Codex tokens.storage/index.ts.provider.tsto handleopenai-codexwithout API key.auth/index.tsto export new OpenAI Codex command modules.This description was created by
for 6a4d54d. You can customize this summary. It will automatically update as commits are pushed.