Skip to content

[6.x] Fix files outside the root being treated as within it - #15886

Merged
jasonvarga merged 2 commits into
6.xfrom
fix-is-within-root
Nov 13, 2026
Merged

jasonvarga merged 2 commits into
6.xfrom
fix-is-within-root

Conversation

@jasonvarga

Copy link
Copy Markdown
Member

FilesystemAdapter::isWithinRoot() didn't resolve .. segments, so paths like ../file.txt or relative/../../file.txt were considered inside the root. It also compared prefixes without a trailing separator, so a sibling directory like <root>-old/file.txt passed too.

This affected {{ theme:output }}, which is meant to only output files inside resources/.

The path and root are now resolved before comparing, and the check requires either an exact match or the root followed by a /. A .. that climbs above the filesystem root returns false instead of throwing.

Side effect: getFiles() uses isWithinRoot() to decide between relative and absolute output paths, so getFiles('../outside') now returns absolute paths instead of ../-relative ones.

jasonvarga and others added 2 commits November 13, 2026 06:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he root

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasonvarga
jasonvarga enabled auto-merge (squash) November 13, 2026 12:18
@jasonvarga
jasonvarga merged commit 23753e8 into 6.x Nov 13, 2026
64 checks passed
@jasonvarga
jasonvarga deleted the fix-is-within-root branch November 13, 2026 12:20
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