You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This is a BC mode for lock files created pre-Composer-2.2 where the expectation of
692
+
// an allow-plugins config being present cannot be made.
686
693
if ($rules === null) {
687
694
if (!$this->io->isInteractive()) {
688
-
if (!isset($warned['all'])) {
689
-
$this->io->writeError('<warning>For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins</warning>');
690
-
$this->io->writeError('<warning>You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.</warning>');
691
-
$warned['all'] = true;
692
-
}
695
+
$this->io->writeError('<warning>For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins</warning>');
696
+
$this->io->writeError('<warning>This warning will become an exception once you run composer update!</warning>');
697
+
698
+
$rules = array('{}' => true);
693
699
694
700
// if no config is defined we allow all plugins for BC
$this->io->writeError('<warning>'.$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins</warning>');
717
-
$attempts = 0;
718
-
while (true) {
719
-
// do not allow more than 5 prints of the help message, at some point assume the
720
-
// input is not interactive and bail defaulting to a disabled plugin
721
-
$default = '?';
722
-
if ($attempts > 5) {
723
-
$default = 'd';
724
-
}
725
-
726
-
switch ($answer = $this->io->ask('Do you trust "<fg=green;options=bold>'.$package.'</>" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [<comment>y,n,d,?</comment>] ', $default)) {
727
-
case'y':
728
-
case'n':
729
-
case'd':
730
-
$allow = $answer === 'y';
731
-
732
-
// persist answer in current rules to avoid prompting again if the package gets reloaded
$this->io->writeError('<warning>'.$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins</warning>');
722
+
$attempts = 0;
723
+
while (true) {
724
+
// do not allow more than 5 prints of the help message, at some point assume the
725
+
// input is not interactive and bail defaulting to a disabled plugin
726
+
$default = '?';
727
+
if ($attempts > 5) {
728
+
$this->io->writeError('Too many failed prompts, aborting.');
729
+
break;
730
+
}
731
+
732
+
switch ($answer = $this->io->ask('Do you trust "<fg=green;options=bold>'.$package.'</>" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [<comment>y,n,d,?</comment>] ', $default)) {
733
+
case'y':
734
+
case'n':
735
+
case'd':
736
+
$allow = $answer === 'y';
737
+
738
+
// persist answer in current rules to avoid prompting again if the package gets reloaded
'y - add package to allow-plugins in composer.json and let it run immediately',
753
+
'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts',
754
+
'd - discard this, do not change composer.json and do not allow the plugin to run',
755
+
'? - print help',
756
+
));
757
+
break;
757
758
}
758
-
} else {
759
-
$this->io->writeError('<warning>'.$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins</warning>');
760
-
$this->io->writeError('<warning>You can run "composer '.($isGlobalPlugin ? 'global ' : '').'config --no-plugins allow-plugins.'.$package.' [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)</warning>');
761
759
}
762
-
$warned[$package] = true;
763
760
}
764
761
765
-
returnfalse;
762
+
thrownew \UnexpectedValueException(
763
+
$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.'.PHP_EOL.
764
+
'You can run "composer '.($isGlobalPlugin ? 'global ' : '').'config --no-plugins allow-plugins.'.$package.' [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)'.PHP_EOL.
Copy file name to clipboardExpand all lines: src/Composer/Util/GitHub.php
+2-2
Original file line number
Diff line number
Diff line change
@@ -101,9 +101,9 @@ public function authorizeOAuthInteractively(string $originUrl, string $message =
101
101
$this->io->writeError(sprintf('Tokens will be stored in plain text in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
0 commit comments