Tests: ignore security advisories for PHP_CodeSniffer - #291
Open
jrfnl wants to merge 1 commit into
Open
Conversation
PHP_CodeSniffer has recently released a security fix via the 3.13.6 and 4.0.2 releases.
This fix only affects the `*blame` report formats, so has no impact on the functionality in this Composer plugin.
While end-users _should_, of course, be encouraged to use a secure version of PHP_CodeSniffer, it is not for this package to enforce this, so this package should continue to support a wide range of PHPCS versions.
As this project itself does (deliberately) not use a `composer.lock` file, installation of the project in CI/GHA should not run into problems as Composer will automatically install the latest/safe PHPCS releases.
However, the test suite runs `composer install` with varying versions of PHP_CodeSniffer to safeguard compatibility with all supported versions and that will now run into trouble when `composer install` is run from within the test suite with Composer 2.9 or higher.
For the record:
* Composer 2.4 introduced a `composer audit` command which didn't block anything, but could "audit" whether a package required vulnerable dependencies.
* As of Composer 2.9, Composer blocks the installation of vulnerable dependencies by default.
This could be turned off or selectively ignored via `config.audit` settings.
* As of Composer 2.10, the `config.audit` settings are deprecated and replaced with `config.policy` settings.
This commit takes the above into account and will - conditionally - inject the appropriate setting into any `composer.json` files being created for use in the tests.
Notes:
* The `config.audit`/`config.policy.advisories` settings allow for selectively ignoring specific advisories. I've elected **not** to limit the `ignore`s to the advisories related to the current PHPCS vulnerabilities, but to accept any vulnerable PHPCS version as we need to allow them all for the purpose of testing.
* I've also considered turning off the Composer blocking of vulnerable package completely. I ended up deciding against that to prevent potential new tests introducing a security event for **_this_** package (as CI will run on unmerged PRs from potentially untrusted contributors).
For the record, for the current PHPCS vulnerabilities, we would have had to ignore the following two advisory IDs:
* `GHSA-hmqg-cxww-wqhq` (official advisory published via GitHub and attached to CVE-2026-67434)
* `PKSA-rdkp-vv9z-mjkg` (unofficial advisory published via Packagist)
Refs:
* https://blog.packagist.com/composer-2-4/#auditing-dependencies-for-known-security-vulnerabilities
* https://blog.packagist.com/composer-2-9/#automatic-security-blocking
* https://blog.packagist.com/composer-2-10-release/#dependency-policy-configuration
* GHSA-hmqg-cxww-wqhq
* https://packagist.org/security-advisories/PKSA-rdkp-vv9z-mjkg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
PHP_CodeSniffer has recently released a security fix via the 3.13.6 and 4.0.2 releases. This fix only affects the
*blamereport formats, so has no impact on the functionality in this Composer plugin.While end-users should, of course, be encouraged to use a secure version of PHP_CodeSniffer, it is not for this package to enforce this, so this package should continue to support a wide range of PHPCS versions.
As this project itself does (deliberately) not use a
composer.lockfile, installation of the project in CI/GHA should not run into problems as Composer will automatically install the latest/safe PHPCS releases.However, the test suite runs
composer installwith varying versions of PHP_CodeSniffer to safeguard compatibility with all supported versions and that will now run into trouble whencomposer installis run from within the test suite with Composer 2.9 or higher.For the record:
composer auditcommand which didn't block anything, but could "audit" whether a package required vulnerable dependencies.config.auditsettings.config.auditsettings are deprecated and replaced withconfig.policysettings.This commit takes the above into account and will - conditionally - inject the appropriate setting into any
composer.jsonfiles being created for use in the tests.Notes:
config.audit/config.policy.advisoriessettings allow for selectively ignoring specific advisories. I've elected not to limit theignores to the advisories related to the current PHPCS vulnerabilities, but to accept any vulnerable PHPCS version as we need to allow them all for the purpose of testing.For the record, for the current PHPCS vulnerabilities, we would have had to ignore the following two advisory IDs:
GHSA-hmqg-cxww-wqhq(official advisory published via GitHub and attached to CVE-2026-67434)PKSA-rdkp-vv9z-mjkg(unofficial advisory published via Packagist)Refs:
Suggested changelog entry
N/A