Skip to content

v0.4.1 e2e patch: --no-audit does not bypass Composer block-insecure #24

@apermo

Description

@apermo

Summary

The patch added in v0.4.1 (fix(e2e): patch wp-env for Composer 2.8 advisory, #23) does not fix the wp-env image build. The PKSA-5jz8-6tcw-pbk4 / PKSA-z3gr-8qht-p93v advisories still block the composer global require phpunit/phpunit step inside the wp-env Dockerfiles, so e2e consumers remain red.

Root cause

The patch rewrites the composer command to:

RUN COMPOSER_NO_AUDIT=1 composer global require --no-audit --dev phpunit/phpunit:"..."

COMPOSER_NO_AUDIT / --no-audit only skip the post-install audit. The advisory block is enforced by a separate setting, audit.block-insecure, during dependency resolution — which runs before any audit. Composer's own error output points at the correct toggle:

To ignore the advisories, add them to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.

Reproduction

Any consumer pinned to reusable-wp-e2e.yml@v0.4.1. Example job (site-bookkeeper-dashboard PR #22, commit 082caad):

https://github.com/apermo/site-bookkeeper-dashboard/actions/runs/24599790524/job/71936418275

Relevant excerpt:

> [cli 14/14] RUN composer global require --dev phpunit/phpunit:"^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0"
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Root composer.json requires phpunit/phpunit ^5.7.21 || ... || ^10.0, found phpunit/phpunit[...]
      but these were not loaded, because they are affected by security advisories
      ("PKSA-5jz8-6tcw-pbk4", "PKSA-z3gr-8qht-p93v").

Note this now fires on the cli image, not tests-cli, because both Dockerfiles run the same composer global require and v0.4.1's sed targets both but fixes neither.

Suggested fix

Rewrite the command so the Dockerfile disables block-insecure (or sets an explicit audit.ignore) before the require:

sed -i 's|composer global require|composer config --global audit.block-insecure false \&\& composer global require|g' "$f"

Or, more conservatively, ignore just the two PKSA IDs:

sed -i 's|composer global require|composer config --global --json audit.ignore '"'"'{"PKSA-5jz8-6tcw-pbk4":"PHPUnit EOL","PKSA-z3gr-8qht-p93v":"PHPUnit EOL"}'"'"' \&\& composer global require|g' "$f"

The --no-audit flag added in v0.4.1 can be dropped — it has no effect on resolution-time errors.

Scope

  • Same fix needed in reusable-wp-visual-regression.yml and reusable-lhci.yml if they also patch wp-env Dockerfiles.
  • reusable-wp-integration.yml is unaffected (it runs composer in the host, so consumers can set config.audit.ignore in their own composer.json — see site-bookkeeper-dashboard 4c39a96).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions