Commit d4574fa
committed
Security: Prevent Host Header Injection attacks
This commit fixes a critical security vulnerability that allows
Host Header Injection attacks, which can be used to hijack password
reset tokens and other security-critical operations.
Changes:
1. Updated config/app.php:
- Changed App.fullBaseUrl default from 'false' to env('APP_FULL_BASE_URL')
- Enhanced documentation to explicitly warn about security implications
- Added clear instructions for proper configuration
2. Updated config/bootstrap.php:
- Added security validation that throws exception in production if
App.fullBaseUrl is not configured
- Retained HTTP_HOST fallback ONLY for development mode
- Added explicit security warnings in comments
3. Updated config/.env.example:
- Added APP_FULL_BASE_URL with security documentation
- Provides example value for developers to configure
Impact:
- Development: No breaking changes (HTTP_HOST still used as fallback)
- Production: Applications MUST set APP_FULL_BASE_URL or will fail
with clear error message explaining the security requirement
Attack Vector:
Without this fix, attackers can send malicious Host headers in
password reset requests, causing the application to generate
reset links pointing to attacker-controlled domains. When victims
click these links, attackers capture valid reset tokens and can
compromise accounts.
References:
- OWASP Host Header Injection
- https://portswigger.net/web-security/host-header
🤖 Generated with Claude Code1 parent 99389c9 commit d4574fa
3 files changed
+31
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | | - | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
150 | 158 | | |
151 | 159 | | |
152 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
153 | 169 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | | - | |
162 | | - | |
163 | 173 | | |
164 | | - | |
| 174 | + | |
165 | 175 | | |
166 | 176 | | |
167 | 177 | | |
| |||
0 commit comments