From 5b41eaad3aecab692cbafc2b9cf720ed6bde74a0 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 25 Jan 2016 19:35:11 +0000 Subject: [PATCH] Bundle pubkeys and fail hard if validation can not happen --- src/Composer/Command/SelfUpdateCommand.php | 68 +++++++++++++++------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 3f456862c..7d868da06 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -144,29 +144,53 @@ EOT $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub'); if (!file_exists($sigFile)) { - $io->write('You are missing the public keys used to verify Composer phar file signatures'); - if (!$io->isInteractive() || getenv('CI') || getenv('CONTINUOUS_INTEGRATION')) { - $io->write('As this process is not interactive or you run on CI, it is allowed to run for now, but you should run "composer self-update --update-keys" to get them set up.'); - } else { - $this->fetchKeys($io, $config); - } + file_put_contents($home.'/keys.dev.pub', <<isInteractive()) { - throw new \RuntimeException('Public keys are missing and can not be fetched in non-interactive mode, run this interactively or re-install composer using the installer to get the public keys set up'); + throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively'); } $io->write('Open https://composer.github.io/pubkeys.html to find the latest keys');