-
Notifications
You must be signed in to change notification settings - Fork 14
add USE_DEMO_PATIENT env variable toggle and safe session handlers #212
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,7 +49,10 @@ def chat(): | |||||||||
| message = data.get("message") | ||||||||||
| user_name = session['name'] | ||||||||||
| #user_id = session['google_id'] | ||||||||||
| user_email = os.getenv("DEMO_PATIENT_EMAIL", "john.doe@gmail.com") | ||||||||||
| if os.getenv("USE_DEMO_PATIENT", "true").lower() in ["true", "on", "1"]: | ||||||||||
| user_email = "john.doe@gmail.com" | ||||||||||
| else: | ||||||||||
| user_email = session.get('email', "john.doe@gmail.com") | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When USE_DEMO_PATIENT is set to false, falling back to the demo email (john.doe@gmail.com) if the session email is missing might be confusing and lead to unexpected behavior. It is safer to handle the missing email case explicitly to ensure the agent uses the correct user identity.
Suggested change
|
||||||||||
| access_token = session.get('access_token') | ||||||||||
| refresh_token = session.get('refresh_token') | ||||||||||
|
|
||||||||||
|
|
||||||||||
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.
Constructing SQL queries using f-strings with user identifiers like
patient_keyis a security risk (SQL injection). Furthermore, avoid hardcoding or manually passing user identifiers in queries. Instead, use dynamic values from the session or callback context (e.g.,callback_context.session.user_id) to ensure the application functions correctly and securely for different users.References