Fix Rector config and clear high-severity npm audit findings - #542
Merged
Conversation
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.
Two independent CI failures, both pre-existing on
develop.Rector
composer rectorwas failing outright before it linted anything:The
rector-phpunitbundled withrector/rector2.x dropped the version-pinned sets (PHPUNIT_100,PHPUNIT_110, …).PHPUnitSetListnow only exposesPHPUNIT_MOCK_TO_STUB,PHPUNIT_CODE_QUALITY,PHPUNIT_NARROW_ASSERTS,ANNOTATIONS_TO_ATTRIBUTES, andCOMPOSER_BASED.->withComposerBased( phpunit: true ), which binds each rule to the PHPUnit version actually installed percomposer.json— so this no longer needs editing when the PHPUnit constraint moves.PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTESfor the equivalent->withAttributesSets( phpunit: true ), which drops the now-unusedPHPUnitSetListimport.->withSkip():DisallowedEmptyRuleFixerRectoris deprecated and no longer registered by any set, and Rector warns to remove it. The section is kept as the documented place for future skips.npm audit
The Node job runs
npm audit --audit-level=high --omit=dev --package-lock-only, which was reporting four high and one critical advisory. All five are transitive, and all have a patched release inside the major already in the tree, so they're pinned forward withoverrides— the same approach #538 took forfast-uri:fast-urijs-yaml!!omapnanoidpostcss</style>, arbitrary.mapread viasourceMappingURLserovalfromJSON()type confusion invokes attacker-controlled methodsThe
js-yamloverride is keyedjs-yaml@^4because a 3.14.2 copy also lives in the tree and js-yaml 4 is a breaking API change; only the 4.x copy is in the advisory range, so the 3.x one is left alone.npm audit fixisn't usable here — it tries to resolve the react 18 / react-dom 19 peer conflict in@wordpress/edit-postand aborts.31 moderate/low advisories remain, all in
@wordpress/*transitives with no in-range fix. They're below the--audit-level=highthreshold and out of scope for a CI fix.Verification
composer rectorexits 0 with no warnings;vendor/bin/phpcs rector.phppasses.npm audit --audit-level=high --omit=dev --package-lock-onlyexits 0.npm ciagainst the regenerated lockfile,npm run buildandnpm test(check-types + eslint + stylelint + jest) both exit 0.