Patch against host header injection and host-based redirect poisoning#830
Merged
Fraenkiman merged 2 commits intoflatpressblog:masterfrom Mar 1, 2026
Merged
Conversation
- Prevents host header injection and host-based redirect poisoning when determining the BLOG_BASEURL. - wp_redirect() previously broke IPv6 redirects (it strips [ ]). This has now been adjusted so that IPv6 URLs remain valid in redirects. - We do not use host allowlists + 400 for mismatches and switching to relative URLs in templates so that FlatPress works correctly and optimally on as many web server platforms and web hosts as possible.
Fraenkiman
added a commit
to Fraenkiman/flatpress
that referenced
this pull request
Mar 1, 2026
- The setup must also be adjusted, otherwise no valid URLs will be output.
Fraenkiman
added a commit
that referenced
this pull request
Mar 1, 2026
- The setup must also be adjusted, otherwise no valid URLs will be output.
Fraenkiman
added a commit
to Fraenkiman/flatpress
that referenced
this pull request
Mar 1, 2026
- With empty general [‘www’] and Request Host: evil.example, /admin.php still delivered Location: http://evil.example/login.php. - It should now be fixed.
Fraenkiman
added a commit
that referenced
this pull request
Mar 1, 2026
- With empty general [‘www’] and Request Host: evil.example, /admin.php still delivered Location: http://evil.example/login.php. - It should now be fixed.
Fraenkiman
added a commit
to Fraenkiman/flatpress
that referenced
this pull request
Mar 1, 2026
- canonical_server_host() could unbracketed IPv6 in SERVER_NAME (::1) – but bracketed ([::1]) was converted back to localhost due to subsequent validation. - general[‘www’] is now always set to the public canonical URL.
Fraenkiman
added a commit
that referenced
this pull request
Mar 1, 2026
- canonical_server_host() could unbracketed IPv6 in SERVER_NAME (::1) – but bracketed ([::1]) was converted back to localhost due to subsequent validation. - general[‘www’] is now always set to the public canonical URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wp_redirect()previously broke IPv6 redirects (it strips [ ]). This has now been adjusted so that IPv6 URLs remain valid in redirects.