fix(security): [HIGH] resolve host header injection vulnerability#30
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| BREVO_EMAIL_FROM_ADDRESS: str = os.getenv("BREVO_EMAIL_FROM_ADDRESS", "noreply@example.com") | ||
| BREVO_EMAIL_FROM_NAME: str = os.getenv("BREVO_EMAIL_FROM_NAME", "BookLib") | ||
|
|
||
| app_base_url: str = os.getenv("APP_BASE_URL", "") |
There was a problem hiding this comment.
Isn't it possible to extract the base url from another place instead of a new ENV var?
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|



Severity: HIGH
Vulnerability: Host Header Injection. The
request.base_urlwas being used to construct password reset and account verification links. An attacker could craft a request with a maliciousHostheader, causing the application to send these links pointing to the attacker's server, leading to potential account takeover.Impact: Attackers can potentially take over accounts by capturing password reset tokens or verification tokens.
Fix: Added an
app_base_urlconfiguration variable retrieved fromAPP_BASE_URL. Inroutes/auth.py, the code now prioritizes this configured URL over the user-providedHostheader when building links.Verification: The change was verified using a script crafting a mock request with an
evil.comhost header. It was confirmed that ifapp_base_urlis configured, it is used instead of the malicious header.PR created automatically by Jules for task 1446097122364347027 started by @Tugamer89