-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Composer update: filter packages with security advisories from pool #11956
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
Composer update: filter packages with security advisories from pool #11956
Conversation
|
Cool thanks, not sure either how to answer your questions yet. But I'd say probably needs to be optional, and probably abandoned filtering should also be an option at that level? Maybe like Does it work on install too btw if an insecure package already made its way into the lock file? As install runs through the pool builder etc as well, I am thinking it might just work, but it'd be good to test.. And I'm not sure if that should be additionally opt-in behavior as it might break pipelines whenever an advisory is released. |
|
Having this as separate config options sounds like a good idea! Applied this already. Blocking on install doesn't work yet as the repository list during the composer install command currently only contains the platform/lock/local repositories and none of the once configured in the repositories section in the composer.json file. So the repository set will always return 0 advisories. Still need to figure out how to pass those through. |
90151cb to
185a2f0
Compare
|
I wonder what the benefit of this PR is over already working things like https://github.com/Roave/SecurityAdvisories |
|
An install from lock should not filter out vulnerable packages IMO as it would totally break the usage of that lock file when new advisories are released. And this should definitely stay opt-in (blocking all vulnerable package could harm projects using a package which has a vulnerability for a specific case that does not impact the project by forcing them to update that package before being able to do anything else) |
|
The main benefits are:
Yes, failing composer installs should definitely be a separate config option and all options should be opt-in by default. |
d504581 to
123ab17
Compare
|
Adjusted the PR to incorporate the feedback. New audit config options have been added. Removed the part that filtered out versions from the install command. Kept the feature on by default for update commands but added more info on why the update fails and instructions on how to ignore the advisories. |
09cff65 to
10227fa
Compare
10227fa to
86e4662
Compare
…poser-schema with new config options
86e4662 to
05ff9a8
Compare
.../Composer/Test/Fixtures/installer/update-security-advisory-matching-indirect-dependency.test
Show resolved
Hide resolved
Co-authored-by: Jordi Boggiano <[email protected]>
…endency has advisory and 'block-insecure' is set to true
…angeable and run optimizer before security advisory filter
|
Thanks! |
Please note, this is still a very rough draft missing tests, cleanup and taking a few shortcuts. However, feedback is already appreciated.
Idea
Composer already has an audit functionality that reports any package used by a project with security advisories as part of an install/update/audit command. This PR takes this one step further and filters any packages with security advisories from the pool of available packages during a
composer updatecommand before the pool get optimized.The functionality uses cached metadata files wherever possible. However, it is possible that it will trigger a call to the security advisories API endpoint on packagist.org if multiple Composer repositories are defined and not all packages were looked up before on packagist.org.
This could potentially replace the need for projects to install a special package defining conflicts with packages that have security advisories.
Sample composer.json
How this currently looks in Composer with verbose output
Implementation
The PR introduces two new audit config flags.
block-insecure(default: true) which removes any version affected by security advisories from the pool andblock-abandoned(default: false) which removes all abandoned packages from the pool. The changes have no impact on thecomposer installcommand.What else does this PR provide
Happy to extract any feature into a separate PR if this helps