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: add notifications table, and push notification on upload and crawl #1125

Merged
merged 5 commits into from
Sep 7, 2023

Conversation

mamadoudicko
Copy link
Contributor

@mamadoudicko mamadoudicko commented Sep 6, 2023

  • Add notification table
  • Create notification at the beginning of an upload and a crawl
  • Update notification at the end of upload or crawl pocess

Screenshot 2023-09-06 at 16 17 37

@vercel
Copy link

vercel bot commented Sep 6, 2023

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Sep 6, 2023 2:17pm
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2023 2:17pm

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

Risk Level 2 - /home/runner/work/quivr/quivr/backend/routes/crawl_routes.py

The changes involve adding new functionality to the crawl_endpoint function. This is a medium risk change as it involves interacting with a database and handling HTTP requests. There is a potential risk of SQL injection if the inputs are not properly sanitized. However, from the provided code, it seems that the inputs are being handled properly. The use of HTTPException for error handling is a good practice.


Risk Level 2 - /home/runner/work/quivr/quivr/backend/models/databases/supabase/notifications.py

The new code introduces a new class Notifications that extends Repository. The methods in this class interact with a database, so there is a potential risk of SQL injection if the inputs are not properly sanitized. However, from the provided code, it seems that the inputs are being handled properly. The use of HTTPException for error handling is a good practice.


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

  1. The openai_api_key is being fetched from the request headers and used in the filter_file function. This could potentially be a security risk if the key is not properly validated. Consider validating the key before using it.

  2. The add_notification and update_notification_by_id functions are being used without any error handling. If these functions fail for any reason, it could cause the entire upload_file function to fail. Consider adding error handling around these function calls.

  3. The get_user_identity function is being called without any error handling. If this function fails for any reason, it could cause the entire upload_file function to fail. Consider adding error handling around this function call.

Example:

try:
    upload_notification = add_notification(
        CreateNotificationProperties(
            action=\"UPLOAD\",
    )
except Exception as e:
    # handle exception
try:
    openai_api_key = get_user_identity(current_user.id).openai_api_key
except Exception as e:
    # handle exception

🔒📁🐛


Powered by Code Review GPT

@gozineb gozineb merged commit 575d988 into main Sep 7, 2023
11 of 12 checks passed
StanGirard pushed a commit that referenced this pull request Sep 12, 2023
…awl (#1125)

* feat: add notifications table

* feat: add Notification model

* feat: add notification repositories

* feat: add upload and crawl notifications

* feat: update notification message
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