Ask confirmation when is run as admin
parent
bf33eec912
commit
5548051977
|
@ -207,6 +207,12 @@ class Application extends BaseApplication
|
||||||
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>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
|
$io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
|
||||||
|
|
||||||
|
if ($io->isInteractive()) {
|
||||||
|
if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ', true)) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($uid = (int) getenv('SUDO_UID')) {
|
if ($uid = (int) 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
|
||||||
|
|
Loading…
Reference in New Issue