Skip to content

fix: prevent Host Header Injection in image upload route#103

Open
Siddh2024 wants to merge 1 commit into
Canopus-Labs:mainfrom
Siddh2024:fix/host-header-injection
Open

fix: prevent Host Header Injection in image upload route#103
Siddh2024 wants to merge 1 commit into
Canopus-Labs:mainfrom
Siddh2024:fix/host-header-injection

Conversation

@Siddh2024
Copy link
Copy Markdown

Fixes #93

Bug

In backend/routes/authRoutes.js:24, the image URL was constructed using req.get("host") directly from the incoming request header, allowing Host Header Injection.

Fix

  • Replaced unsafe req.get("host") with a configurable BASE_URL environment variable
  • Added BASE_URL documentation to .env.example
  • Falls back to request-derived URL when BASE_URL is not set

The image URL construction used req.get('host') directly from the request
header, allowing attackers to inject malicious URLs via a crafted Host
header. Now uses a configurable BASE_URL environment variable, falling
back to the request host only when not set.

Fixes Canopus-Labs#93
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.

Bug: Host Header Injection vulnerability in auth routes

1 participant