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

Command create-project fails on plugins #10935

Closed
janpecha opened this issue Jul 11, 2022 · 8 comments
Closed

Command create-project fails on plugins #10935

janpecha opened this issue Jul 11, 2022 · 8 comments
Labels
Milestone

Comments

@janpecha
Copy link

janpecha commented Jul 11, 2022

Hello, create-project fails if it found composer.json with plugin in current working directory.

$ composer require frontpack/composer-assets-plugin

It creates this composer.json:

{
    "require": {
        "frontpack/composer-assets-plugin": "^0.11.1"
    },
    "config": {
        "allow-plugins": {
            "frontpack/composer-assets-plugin": true
        }
    }
}

Now if I run create-project in same directory (I used it on Github Actions) it fails:

$ composer create-project janpecha/code-checker _temp/code-checker --no-interaction

In PluginManager.php line 762:
                                                                                                                                                                                           
  frontpack/composer-assets-plugin contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.                           
  You can run "composer config --no-plugins allow-plugins.frontpack/composer-assets-plugin [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)  
  See https://getcomposer.org/allow-plugins 

With option --no-plugins it works fine:

$ composer create-project janpecha/code-checker _temp/code-checker --no-interaction --no-plugins

Creating a "janpecha/code-checker" project at "_temp/code-checker"
Installing janpecha/code-checker (v1.0.1)
Plugins have been disabled.
  - Installing janpecha/code-checker (v1.0.1): Extracting archive
...
janpecha added a commit to janpecha/actions that referenced this issue Jul 11, 2022
@ihor-sviziev
Copy link

ihor-sviziev commented Jul 11, 2022

Moved to #10928 (comment)

@Seldaek
Copy link
Member

Seldaek commented Jul 12, 2022

Thanks - that was actually a great find thanks to the plugin security feature, as plugins from the CWD had no business being loaded here when running create-project.

@Seldaek Seldaek added the Bug label Jul 12, 2022
@Seldaek Seldaek added this to the 2.2 milestone Jul 12, 2022
@secretsayan
Copy link

secretsayan commented Jul 12, 2022

We are also experiencing the exact same issues in the exact same scenario for composer validate command. Moreover, with other commands provided by composer-plugins like composer-normalize we are facing the exact same issue, wherein the plugins declared in the CWD is trying to get loaded and disrupting the process.

@Seldaek
Copy link
Member

Seldaek commented Jul 12, 2022

Keeping open until I had time to investigate further what @secretsayan reported. In the meantime feel free to try with composer self-update --snapshot if the latest version fixes things for you on the create-project side.

@Seldaek
Copy link
Member

Seldaek commented Jul 13, 2022

@secretsayan can you describe some more what you are seeing with validate? If it fails because you are missing an allow-plugins in the project you are validating that makes sense to me and it is correct behavior IMO. Running validate loads plugins (as do most commands).

composer-normalize also works with the CWD's composer.json AFAIK, so not sure what you were referring to.

Anyway I'll close this again.. If you have a clear repro case for either of these issues please open a new issue with details.

@Seldaek Seldaek closed this as completed Jul 13, 2022
Seldaek added a commit that referenced this issue Jul 13, 2022
Seldaek added a commit that referenced this issue Jul 13, 2022
@Seldaek
Copy link
Member

Seldaek commented Jul 13, 2022

@secretsayan sorry I spoke too fast - I dug into ergebnis/composer-normalize#865 and realized the problem could be dealt with internally much better. 0e59fbb should resolve your issues with validate command as well as normalize.

@secretsayan
Copy link

Thanks @Seldaek, this will solve a lot of issues we are currently facing :)

@secretsayan
Copy link

@Seldaek I have checked with Composer 2.3.10 and I found that composer validate is fixed now.

But issue still remains with composer normalize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants