@ -133,10 +133,10 @@ class Application extends BaseApplication
$input->setInteractive(false);
$input->setInteractive(false);
}
}
if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_DISABLE_ROOT_WARN')) {
if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
if (function_exists('posix_getuid') && posix_getuid() === 0) {
if (function_exists('posix_getuid') && posix_getuid() === 0) {
if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
$io->writeError('<warning>Running composer as root is highly discouraged as packages, plugins and scripts cannot always be trusted</warning>');
$io->writeError('<warning>Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted</warning>');
}
}
if ($uid = getenv('SUDO_UID')) {
if ($uid = getenv('SUDO_UID')) {
// Silently clobber any sudo credentials on the invoking user to avoid privilege escalations later on
// Silently clobber any sudo credentials on the invoking user to avoid privilege escalations later on