[ticket/12693] Extract exceptions, bin/* must be executable

PHPBB3-12693
This commit is contained in:
Tristan Darricau 2014-06-24 19:28:40 +02:00
parent ae9c1cddc8
commit ffcc1e9d94

View file

@ -16,40 +16,51 @@ path="$3"
if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ] if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
then then
# Get the list of the executables files under a given path # Check the permissions of the files
# The part "-name 'develop' -o -name 'vendor'" defines a set
# of ignored directories.
# The part "-path '*/bin/phpbbcli.php' -o -name 'composer.phar'"
# defines a whitelist.
executables_files=$( \ # Directories to skip
directories_skipped="-path ${path}develop -o -path ${path}vendor"
# Files to skip
files_skipped="-name composer.phar"
# Files which have to be executable
executable_files="-path ${path}bin/*"
incorect_files=$( \
find ${path} \ find ${path} \
'(' \ '(' \
'(' \ '(' \
-name 'develop' -o \ ${directories_skipped} \
-name 'vendor' \
')' \ ')' \
-a -type d -prune -a -type f \ -a -type d -prune -a -type f \
')' \ ')' -o \
-o '(' \ '(' \
-type f -a \
-not '(' \ -not '(' \
-path '*/bin/phpbbcli.php' -o \ ${files_skipped} \
-name 'composer.phar' \ ')' -a \
')' \
-a '(' \
'(' \ '(' \
-type f -a \ '(' \
-perm +111 \ '(' \
')' -o \ ${executable_files} \
-not -perm -600 \ ')' -a \
-not -perm -100 \
')' -o \
'(' \
-not '(' \
${executable_files} \
')' -a \
-perm +111 \
')' \
')' \
')' \ ')' \
')' \ )
)
if [ "$executables_files" != '' ] if [ "${incorect_files}" != '' ]
then then
ls -la $executables_files ls -la ${incorect_files}
echo "MUST NOT be executable and MUST be readable and writable by the owner."; echo "does not have the proper permissions.";
exit 1; exit 1;
fi fi
fi fi