fix: prevent path traversal in development server rewrite script - #10526
Closed
gr8man wants to merge 1 commit into
Closed
fix: prevent path traversal in development server rewrite script#10526gr8man wants to merge 1 commit into
gr8man wants to merge 1 commit into
Conversation
gr8man
force-pushed
the
fix/rewrite-path-traversal
branch
from
September 5, 2026 21:09
deedfda to
48615f2
Compare
michalsn
reviewed
Sep 6, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Could you provide an HTTP-level reproduction showing a file outside the document root being served before this change, including the PHP version and OS? Returning false delegates handling to PHP built-in server, it does not directly serve the resolved path. I couldn't reproduce the issue on PHP 8.2 or 8.5.
This also blocks intentional public symlinks pointing outside the document root. Without a reproduction, I'm not convinced the additional restriction and compatibility impact are justified for the development server.
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.
Description
Validates that requested paths in
system/rewrite.phpstay withinDOCUMENT_ROOTusingrealpath(), preventing the built-in development server (php spark serve) from serving files outside the public directory via path traversal.Checklist: