Skip to content
Snippets Groups Projects
Commit de85ed31 authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

Issue #3454866 by c-logemann: file check is problematic "green" when not test with chmod

parent 88a68055
No related branches found
Tags 8.x-1.0-rc1
No related merge requests found
Pipeline #342454 passed with warnings
......@@ -99,18 +99,24 @@ class FilePermissions extends SecurityCheckBase {
// Write a file with the timestamp.
$file = './' . $directory . '/file_write_test.' . date('Ymdhis');
$dirperms = octdec(substr(sprintf('%o', fileperms($directory)), -4));
chmod($directory, 0755);
if ($file_create = @fopen($file, 'w')) {
$create_status = fwrite($file_create, date('Ymdhis') . ' - ' . $append_message . "\n");
fclose($file_create);
unlink($file);
}
chmod($directory, $dirperms);
// Try to append to our IGNOREME file.
$file = './' . $directory . '/IGNOREME.txt';
$fileperms = octdec(substr(sprintf('%o', fileperms($file)), -4));
chmod($file, 0755);
if ($file_append = @fopen($file, 'a')) {
$append_status = fwrite($file_append, date('Ymdhis') . ' - ' . $append_message . "\n");
fclose($file_append);
}
chmod($file, $fileperms);
}
if (!empty($findings) || $create_status || $append_status) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment