Skip to content
Snippets Groups Projects
Commit c74e008c authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

hotline #67693 : php files forbidden

parent fdfa2e55
Branches
Tags
4 merge requests!2420Hotline master,!2415Master,!2414Hotline master,!2412Hotline#67693 core five filemanager rendre impossible l envoi de fichier htaccess
Pipeline #2946 failed with stage
in 25 minutes and 6 seconds
......@@ -35,7 +35,9 @@ class Class_FileManager {
protected function _isForbidden($part) {
return $this->_isHtaccess($part) || $this->_isDotsOnly($part);
return $this->_isHtaccess($part)
|| $this->_isDotsOnly($part)
|| $this->_isPhpFile($part);
}
......@@ -49,4 +51,10 @@ class Class_FileManager {
? '' == trim(str_replace('.', '', $part))
: false;
}
protected function _isPhpFile($part) {
return $part
? 1 === preg_match('/\.php[1-9]*$/i', $part)
: false;
}
}
......@@ -123,4 +123,16 @@ class FileManagerAuthAsAdminTest extends FileManagerTestCase {
public function dotHtaccessShouldNotBeAuthorized() {
$this->assertFalse($this->_filemanager->isAuthorized(USERFILESURL . '/.htaccess'));
}
/** @test */
public function phpFileShouldNotBeAuthorized() {
$this->assertFalse($this->_filemanager->isAuthorized(USERFILESURL . '/anything.php'));
}
/** @test */
public function php5FileShouldNotBeAuthorized() {
$this->assertFalse($this->_filemanager->isAuthorized(USERFILESURL . '/anything.php5'));
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment