Skip to content
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

feat: the good user management #1158

Merged
merged 9 commits into from
Sep 13, 2023
Merged

feat: the good user management #1158

merged 9 commits into from
Sep 13, 2023

Conversation

StanGirard
Copy link
Collaborator

@StanGirard StanGirard commented Sep 12, 2023

Screen.Recording.2023-09-13.at.13.20.32.mp4

@StanGirard StanGirard temporarily deployed to preview September 12, 2023 16:39 — with GitHub Actions Inactive
@vercel
Copy link

vercel bot commented Sep 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2023 11:17am
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2023 11:17am

@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2023

Risk Level 2 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts

The code seems to be well written and follows good practices. However, there are a few areas that could be improved for better readability and maintainability:

  1. Avoid magic numbers: There's a setTimeout function with a delay of 50. It's not clear why this specific value is used. Consider storing such values in well-named constants to improve code readability.
const MODEL_UPDATE_DELAY = 50;
setTimeout(() => {
  if (brain.model !== undefined) {
    setValue(\"model\", brain.model);
  }
}, MODEL_UPDATE_DELAY);
  1. Error handling: There are several places where errors are caught but not handled appropriately. It's important to handle these errors in a way that doesn't leave the system in an inconsistent state and provides enough information for debugging.

  2. Use of any type: There's a @ts-expect-error comment indicating a bad type inference from TypeScript. Avoid using any type as it defeats the purpose of using TypeScript. Try to define a more specific type or refactor the code to avoid type issues.


Risk Level 5 - /home/runner/work/quivr/quivr/backend/routes/upload_routes.py

The openai_api_key is being used in plain text which is a high security risk. It should be encrypted and stored securely. Also, the openai_api_key is being passed around in multiple places which increases the risk of it being exposed. It would be better to centralize its usage.

userDailyUsage = UserUsage(
    id=current_user.id,
    email=current_user.email,
    openai_api_key=current_user.openai_api_key, # This should be encrypted and stored securely
)
if openai_api_key is None:
    openai_api_key = get_user_identity(current_user.id).openai_api_key # This should be encrypted and stored securely
message = await filter_file(
    file=file,
    enable_summarization=enable_summarization,
    brain_id=brain_id,
    openai_api_key=openai_api_key, # This should be encrypted and stored securely
)

Risk Level 5 - /home/runner/work/quivr/quivr/backend/routes/user_routes.py

The openai_api_key is being used in plain text which is a high security risk. It should be encrypted and stored securely.

userDailyUsage = UserUsage(
    id=current_user.id,
    email=current_user.email,
    openai_api_key=current_user.openai_api_key, # This should be encrypted and stored securely
)

📚🔒🚫


Powered by Code Review GPT

@mamadoudicko
Copy link
Contributor

#1161

@StanGirard StanGirard merged commit 322ee31 into main Sep 13, 2023
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants