-
Notifications
You must be signed in to change notification settings - Fork 318
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
up #1787
up #1787
Conversation
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.
❌ Changes requested. Reviewed everything up to d44ea19 in 2 minutes and 39 seconds
More details
- Looked at
884
lines of code in10
files - Skipped
1
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. py/core/database/users.py:301
- Draft comment:
Settinghashed_password
to an empty string ifNone
can lead to confusion or errors. Consider handling this more explicitly to ensure clarity and correctness. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The code is handling a valid use case - OAuth users don't have passwords, so hashed_password needs some default value. Empty string is a reasonable choice since: 1. The code validates password requirements for password accounts 2. OAuth accounts are clearly marked with account_type 3. Empty string is a clear signal that there is no password 4. The database column is NOT NULL so we need some value
Could storing NULL be better than empty string to make the lack of password more explicit? Could this cause issues if the code assumes hashed_password is always valid?
The NOT NULL constraint on the column means NULL isn't an option. The account_type field already makes it explicit when a user has no password. The code checks account_type before using the password.
The comment should be deleted. The current approach of using empty string is reasonable given the database constraints and the code already handles the OAuth vs password distinction properly through account_type.
2. py/core/providers/auth/r2r_auth.py:583
- Draft comment:
Marking the user as verified based on the OAuth provider's email assumes the email is trustworthy. Ensure this assumption is documented and validated to avoid security issues. - Reason this comment was not posted:
Comment did not seem useful.
3. py/core/main/api/v3/users_router.py:1853
- Draft comment:
Thestate
parameter ingithub_callback
is not validated. Ensure it is checked against a stored value to prevent CSRF attacks. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_zPA7gJvmE628Kw36
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
account_type="google", | ||
google_id=oauth_id | ||
) | ||
elif provider == "github": |
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 handling for the GitHub provider in oauth_callback_handler
is incomplete. Implement the logic similar to the Google provider to ensure correct functionality.
# In a real app, you might return a RedirectResponse(google_auth_url) | ||
|
||
@self.router.get("/users/oauth/google/callback") | ||
async def google_callback(request: Request, code: str = Query(...), state: str = Query(...)): |
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 state
parameter in google_callback
is not validated. Ensure it is checked against a stored value to prevent CSRF attacks.
Important
This pull request adds OAuth support for Google and GitHub, updates user account management, and modifies the database schema and SDK accordingly.
oauthGoogleAuthorize
andoauthGithubAuthorize
methods inusers.ts
andusers.py
for OAuth authorization.users_router.py
.account_type
,google_id
, andgithub_id
columns to theusers
table inusers.py
.google_id
andgithub_id
inusers.py
.create_user
andupdate_user
methods inusers.py
to handle OAuth accounts.register
andlogin
methods inr2r_auth.py
to support OAuth.UsersSDK
inusers.py
.google-auth
andgoogle-auth-oauthlib
topyproject.toml
.This description was created by for d44ea19. It will automatically update as commits are pushed.