Add checks for allowed .htaccess file path
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled

This commit is contained in:
Jamie Cameron
2026-09-18 16:57:34 -07:00
parent 5f020599de
commit 08d9ef3cd0

View File

@@ -1871,15 +1871,14 @@ return @rv;
}
# allowed_auth_file(file)
# Returns 1 if a .htaccess file can be edited by the current user
sub allowed_auth_file
{
local $_;
my ($file) = @_;
return 0 if ($file =~ /\.\./);
my $f = &server_root($file);
return 1 if ($access{'dir'} eq '/');
return 0 if ($_[0] =~ /\.\./);
local $f = &server_root($_[0]);
return 0 if (-l $f && !&allowed_auth_file(readlink($f)));
local $l = length($access{'dir'});
return length($f) >= $l && substr($f, 0, $l) eq $access{'dir'};
return &is_under_directory($access{'dir'}, $f);
}
# directory_exists(file)