Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Globally installed tools are not added to the allow-plugins option in composer.json #611

Closed
2 of 5 tasks
ste93cry opened this issue Jul 4, 2022 · 14 comments
Closed
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@ste93cry
Copy link

ste93cry commented Jul 4, 2022

Describe the bug
Since version 2.2, any Composer plugin that needs to run must be listed in the allow-plugins config of the composer.json. I added the symfony/flex plugin to such list in the composer.json of my project, but it doesn't work because the tool is installed globally. To solve the problem, the composer global config --no-plugins allow-plugins.symfony/flex true command should be ran as part of the setup step.

Version

  • I have checked releases, and the bug exists in the latest patch version of v1 or v2.
  • v2
  • v1

Runners

  • GitHub Hosted
  • Self Hosted

Operating systems
ubuntu-latest

PHP versions
8.1

To Reproduce

jobs:
  name: php
  on: [push]
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
         with:
           php-version: 8.1
           tools: flex

Expected behavior
The symfony/flex plugin is installed and allowed to run thanks to it being added to allow-plugins in composer.json. There should be no warning about the plugin being blocked.

Screenshots/Logs

symfony/flex (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
You can run "composer global config --no-plugins allow-plugins.symfony/flex [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)

Additional context
None

Are you willing to submit a PR?
I'm not familiar with how this action works under the hood, but I can try

@shivammathur
Copy link
Owner

Fixed in a863ab6

@shivammathur shivammathur added the awaiting-release Added/Fixed and tested, awaiting release label Jul 5, 2022
@ste93cry
Copy link
Author

ste93cry commented Jul 5, 2022

Just asking, is there any ETA for the release?

@shivammathur
Copy link
Owner

Done 2.20.0

@shivammathur shivammathur removed the awaiting-release Added/Fixed and tested, awaiting release label Jul 5, 2022
@Seldaek
Copy link

Seldaek commented Jul 5, 2022

Btw maybe flex as tool should be deprecated? I'm not sure what the use case is, but if it's about perf it does not bring any value anymore with composer 2 at least

@ste93cry
Copy link
Author

ste93cry commented Jul 5, 2022

Flex is not only about performance improvements, it's about a lot of other features like forcing the installation of the same version for all symfony/* packages and managing the so-called Symfony recipes 😄

@shivammathur
Copy link
Owner

@Seldaek I will keep flex for the above reason.

Also, While plugin authentication is great for security in local environments, in CI the default in my opinion would be to allow the plugins.
Can we have an environment variable like COMPOSER_ALLOW_ALL_PLUGINS for this in non-tty environments?

@Seldaek
Copy link

Seldaek commented Jul 6, 2022

Flex is not only about performance improvements, it's about a lot of other features like forcing the installation of the same version for all symfony/* packages and managing the so-called Symfony recipes 😄

I'm well aware of that part but I don't understand the point of having it globally installed then. For those use cases, the project itself should really require symfony/flex in composer.json to ensure it's always present.

@Seldaek
Copy link

Seldaek commented Jul 6, 2022

Also, While plugin authentication is great for security in local environments, in CI the default in my opinion would be to allow the plugins.
Can we have an environment variable like COMPOSER_ALLOW_ALL_PLUGINS for this in non-tty environments?

You can set "composer global config allow-plugins true" to allow all global plug-ins that'd simplify/speed up your fix. That only applies to the globally installed ones tho.

"composer config -g allow-plugins true" should allow all plug-ins to run always, but IMO this isn't a decision you should make for users. There are security implications in CI as well, you may have sensitive tokens in env etc.

@eliashaeussler
Copy link
Sponsor

eliashaeussler commented Jul 20, 2022

Hi @shivammathur, I still have the problem that the allow-plugins option is not properly configured when installing the composer-unused tool in version 0.7.x. A verbose output can be seen here:

https://github.com/eliashaeussler/cache-warmup/runs/7429040918?check_suite_focus=true#step:3:159

It says:

Error: icanhazstring/composer-unused contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.

Edit: Tested with v2 and master, output is generated by using the verbose tag.

@shivammathur
Copy link
Owner

@eliashaeussler
Fixed in 66f2447, it is in develop right now. I will create a patch release later this week.

@eliashaeussler
Copy link
Sponsor

@eliashaeussler Fixed in 66f2447, it is in develop right now. I will create a patch release later this week.

@shivammathur Thanks for the quick fix! Works like a charm 🎉

@eliashaeussler
Copy link
Sponsor

@eliashaeussler Fixed in 66f2447, it is in develop right now. I will create a patch release later this week.

Hi @shivammathur, can you already say when there will be a new release?

@shivammathur
Copy link
Owner

@eliashaeussler Sorry for the delay, released 2.21.1 with the fix.

@eliashaeussler
Copy link
Sponsor

@shivammathur Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants