Skip to content

fix(security): [HIGH] resolve host header injection vulnerability#30

Merged
Tugamer89 merged 3 commits into
mainfrom
fix/host-header-injection-1446097122364347027
May 26, 2026
Merged

fix(security): [HIGH] resolve host header injection vulnerability#30
Tugamer89 merged 3 commits into
mainfrom
fix/host-header-injection-1446097122364347027

Conversation

@Tugamer89
Copy link
Copy Markdown
Owner

Severity: HIGH
Vulnerability: Host Header Injection. The request.base_url was being used to construct password reset and account verification links. An attacker could craft a request with a malicious Host header, 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_url configuration variable retrieved from APP_BASE_URL. In routes/auth.py, the code now prioritizes this configured URL over the user-provided Host header when building links.
Verification: The change was verified using a script crafting a mock request with an evil.com host header. It was confirmed that if app_base_url is configured, it is used instead of the malicious header.


PR created automatically by Jules for task 1446097122364347027 started by @Tugamer89

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Comment thread routes/auth.py
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add import of settings

Comment thread core/config.py
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", "")
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@Tugamer89 Tugamer89 temporarily deployed to fix/host-header-injection-1446097122364347027 - booklib PR #30 May 26, 2026 08:00 — with Render Destroyed
@Tugamer89 Tugamer89 merged commit 31eecf9 into main May 26, 2026
1 check passed
@Tugamer89 Tugamer89 deleted the fix/host-header-injection-1446097122364347027 branch May 26, 2026 08:01
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant