-
Notifications
You must be signed in to change notification settings - Fork 19.6k
fix: web app login code encrypt #30705
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
Conversation
Summary of ChangesHello @douxc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the security posture of the web application's login mechanisms. By implementing client-side encryption for both email verification codes and user passwords, it ensures that sensitive authentication data is protected from potential interception during transit, thereby bolstering user data privacy and system integrity. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces client-side encoding for the web app login verification code and password. However, the implementation uses Base64 encoding, which is a form of data obfuscation, not cryptographic encryption. This is a significant concern as it can create a false sense of security, and the function names (encrypt...) are misleading. My review comments highlight this security issue and recommend either using proper encryption or renaming the functions to accurately reflect their behavior (e.g., encode...) to avoid security misconceptions.
web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx
Show resolved
Hide resolved
GareArc
left a comment
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.
lgtm
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.
Pull request overview
This pull request attempts to add password and verification code encryption to the web app login flow using Base64 encoding. However, it introduces critical breaking changes that will prevent all web app logins from working.
- Adds
encryptPassword()call to password field in web app email/password login - Adds
encryptVerificationCode()call to code field in web app email code login - Imports encryption utilities from
@/utils/encryption
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx |
Encrypts password before sending to backend |
web/app/(shareLayout)/webapp-signin/check-code/page.tsx |
Encrypts verification code before sending to backend |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| setIsLoading(true) | ||
| const ret = await webAppEmailLoginWithCode({ email, code, token }) | ||
| const ret = await webAppEmailLoginWithCode({ email, code: encryptVerificationCode(code), token }) |
Copilot
AI
Jan 8, 2026
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.
This change breaks email code login functionality. The frontend now encrypts the verification code using Base64 encoding, but the backend web app email code login endpoint at /email-code-login/validity (in api/controllers/web/login.py) does not have the @decrypt_code_field decorator to decrypt it. The console email code login endpoint uses this decorator, but it's missing for web app login. This will cause all email code login attempts to fail because the backend will compare the Base64-encoded string against the actual code.
| const loginData: Record<string, any> = { | ||
| email, | ||
| password, | ||
| password: encryptPassword(password), |
Copilot
AI
Jan 8, 2026
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.
This change breaks web app login functionality. The frontend now encrypts the password using Base64 encoding, but the backend web app login endpoint at /login (in api/controllers/web/login.py) does not have the @decrypt_password_field decorator to decrypt it. The console login endpoint uses this decorator, but it's missing for web app login. This will cause all web app login attempts to fail because the backend will try to authenticate using the Base64-encoded string instead of the actual password.
Important
Fixes #<issue number>.Summary
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods