Avoid running shell scripts as CGI

There is really no reason for that besides misconfigured servers.

This is followup for PMASA-2016-54

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2016-12-08 11:39:32 +01:00
parent 5f558b0a1d
commit f2bfa7d745
14 changed files with 87 additions and 2 deletions

View File

@ -3,6 +3,12 @@
# vim: expandtab sw=4 ts=4 sts=4:
#
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
# More documentation about making a release is available at:
# https://wiki.phpmyadmin.net/pma/Releasing

View File

@ -1,4 +1,10 @@
#!/bin/sh
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
if [ x$1 = x--quiet ] ; then
stats=""
shift

View File

@ -1,6 +1,12 @@
#!/bin/sh
# vim: expandtab sw=4 ts=4 sts=4:
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
# Check for proper number of command line args.
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` {path_to_pma_root_folder}"

View File

@ -4,6 +4,12 @@
#
# Script for removing language selection from phpMyAdmin
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
if [ $# -lt 1 ] ; then
echo "Usage: lang-cleanup.sh type"
echo "Type can be one of:"

View File

@ -1,4 +1,11 @@
#!/bin/bash
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
cat > js/line_counts.php <<EOF
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */

View File

@ -1,4 +1,10 @@
#!/bin/sh
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
for x in po/*.po ; do
grep 'Team' $x | sed 's/.*: \(.*\)<.*/\1/'
git shortlog -sne --no-merges -- $x | grep '^ [ 0-9][0-9]\{3\}'

View File

@ -3,6 +3,12 @@
# Removes mo files for incomplete translations
#
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
set -e
#

View File

@ -7,10 +7,16 @@
# $2: MIMESubtype
# $3: Transformation Name
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
if [ $# != 3 ]
then
echo -e "Usage: ./generator_main_class.sh MIMEType MIMESubtype TransformationName\n"
exit 65
fi
./generator_plugin.sh "$1" "$2" "$3" "--generate_only_main_class"
./generator_plugin.sh "$1" "$2" "$3" "--generate_only_main_class"

View File

@ -11,6 +11,12 @@
# $3: Transformation Name
# $4: (optional) Description
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
echo $#
if [ $# -ne 3 -a $# -ne 4 ]; then
echo -e "Usage: ./generator_plugin.sh MIMEType MIMESubtype TransformationName [Description]\n"
@ -61,4 +67,4 @@ if [ $GenerateAbstractClass -eq 1 ]; then
echo "Created $AbstractClassFile"
fi
echo ""
echo ""

View File

@ -2,6 +2,12 @@
# vim: expandtab sw=4 ts=4 sts=4:
export LC_ALL=C
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
# Exit on failure
set -e

View File

@ -1,5 +1,11 @@
#!/bin/sh
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
set -e
set -u

View File

@ -1,5 +1,11 @@
#!/bin/sh
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
set -e
set -x

View File

@ -1,5 +1,11 @@
#!/bin/bash
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
if [ "$TRAVIS_PHP_VERSION" = "nightly" -o "$TRAVIS_PHP_VERSION" = "hhvm" -o "$TRAVIS_PHP_VERSION" = "7.0" ] ; then
exit 0
fi

View File

@ -1,5 +1,11 @@
#!/bin/sh
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
set -e
set -x