Skip to content

Audit committed composer.lock files for security advisories #310

Closed

Description

@schlessera

Since Composer 2.9, Composer refuses to install package versions with known security advisories when it resolves dependencies (#308). That covers every repository without a committed lock file, because CI resolves their dependencies fresh on every run.

It does not cover a committed composer.lock. Installing from a lock file applies no blocking: a lock containing guzzlehttp/guzzle 7.4.0, which has several advisories, installs without an error. The Phar is built from wp-cli-bundle's composer.lock, so an advisory published after a dependency was locked goes unnoticed until someone happens to update that package. roave/security-advisories didn't catch this case either, since it only takes effect during resolution.

Proposal

Add a composer audit --locked job to reusable-code-quality.yml:

  • It runs only in repositories that commit a composer.lock, which today are wp-cli-bundle and wp-cli/dashboard, and is skipped everywhere else, like the other code quality checks.
  • It runs with the rest of the code quality checks: on every pull request, on pushes to the default branch, and on each repository's existing nightly schedule (02:17 UTC for wp-cli-bundle, when the least development happens across the US and Europe). No new schedule is needed.
  • Nightly runs wait a random delay of up to 20 minutes, so repositories don't all query Packagist at the same moment.
  • Abandoned packages are reported but don't fail the job. wp-cli-bundle currently locks the abandoned behat/transliterator, which would otherwise fail every run.

A new advisory then shows up as a failing check on the next pull request and as a failed nightly run, which notifies whoever last changed the schedule. Opening an issue automatically would need every calling workflow to grant issues: write, which isn't worth it for a check that should rarely fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions