Make extra sure that search results are under allowed paths

This commit is contained in:
Jamie Cameron
2026-09-20 12:15:21 -07:00
parent 2402ed97d7
commit dedf55cba2

View File

@@ -24,6 +24,15 @@ else {
"find ".quotemeta($cwd).
" $criteria ".
quotemeta("*$in{'query'}*")));
if (&test_allowed_paths()) {
foreach my $path (@allowed_paths) {
my $slashed = $path;
$slashed .= "/" if ($slashed !~ /\/$/);
@list = grep { $_ eq $path ||
$_ =~ /^\Q$slashed\E/ } @list;
}
@list = &unique(@list);
}
@list = map {
[$_, stat($_), &clean_mimetype($_), -d $_]
} @list;