Skip to content

Conversation

Copy link

Copilot AI commented Jan 7, 2026

Plan: Add Must-Use Plugin Checksum Verification

  • Explore repository structure and understand current implementation
  • Understand how plugin checksum verification currently works
  • Create detailed implementation plan
  • Add --exclude-mu-plugins flag to command synopsis
  • Modify Checksum_Plugin_Command::__invoke() to fetch and verify MU plugins
  • Add logic to identify plugin slug from MU plugin path
  • Add MU plugin verification logic (verify_mu_plugin)
  • Add warning messages for single-file MU plugins without matching checksums
  • Add warning messages for custom MU plugin files
  • Add helper methods for MU plugin file handling
  • Pass linting and static analysis checks
  • Add new Behat test scenarios for MU plugin verification
  • Address code review feedback (round 1)
  • Address code review feedback (round 2) - optimize duplicate calls
  • Address code review feedback (round 3) - fix critical bugs and refactor
  • Address code review feedback (round 4) - eliminate code duplication
  • Address code review feedback (round 5) - refactor error handling
  • Address code review feedback (round 6) - remove redundant basename call
  • Address code review feedback (round 7) - use get_plugins for subdirectories
  • Run security checks with CodeQL
  • Final verification and completion
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for checksum verification of must-use plugins</issue_title>
<issue_description>As discussed in #26 (comment) , the plugin checksum verification currently ignores must-use plugins.

Should these be checked by default? ... or only through an additional flag?

I think I'd prefer to have them be included in the checks by default, with a flag to omit them if they should cause trouble.</issue_description>

Comments on the Issue (you are @copilot in this section)

@schlessera The plugin header file can be checked to retrieve the plugin slug.

This works well for normal plugins that were moved into the mu-plugins folder and an MU-loader system like the one from Bedrock or WP-Starter takes care of actually loading them.

It won't work so well for:

  1. Individual plugin files that were put there just to trigger the loading of a subfolder plugin.
  2. Individual plugin files that contain custom logic for that site.

For now, we should throw warnings when 1. or 2. are found, as erroring out would make MU-plugins mostly unusable in terms of checksum verification.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for checksum verification of must-use plugins Add support for checksum verification of must-use plugins Jan 7, 2026
Copilot AI requested a review from swissspidy January 7, 2026 17:38
@swissspidy swissspidy requested a review from Copilot January 9, 2026 10:03

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

- Remove get_mu_plugin_list() wrapper, use get_mu_plugins() directly
- Rename get_plugin_slug_from_header() to get_plugin_slug_from_path() and remove unused parameter
- Extract version retrieval into get_plugin_version_for_verification() method
- Fix critical bug: create check_mu_file_checksum() to properly handle WPMU_PLUGIN_DIR paths

Co-authored-by: swissspidy <[email protected]>

This comment was marked as resolved.

This comment was marked as resolved.

- Add optional base_dir parameter to check_file_checksum() and get_absolute_path()
- Remove duplicate check_mu_file_checksum() method
- Update verify_mu_plugin() to use unified check_file_checksum() with WPMU_PLUGIN_DIR
- Reduces code duplication and improves maintainability

Co-authored-by: swissspidy <[email protected]>
@github-actions

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

- Throw exception when checksums retrieval returns false
- Centralize error handling in single catch block
- Remove duplicate logic for single-file MU plugin warnings
- Improves code maintainability

Co-authored-by: swissspidy <[email protected]>
When strpos() returns false, $mu_file has no '/' character, meaning it's already just a filename without a directory path. The basename() call is redundant in this case.

Co-authored-by: swissspidy <[email protected]>
Changed from get_mu_plugins() to get_plugins('/../mu-plugins') to include both single files in the base mu-plugins directory and plugins in subdirectories. get_mu_plugins() only returns single files in the base directory.

Co-authored-by: swissspidy <[email protected]>
@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 87.14286% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Checksum_Plugin_Command.php 87.14% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review January 11, 2026 21:21
@swissspidy swissspidy requested a review from a team as a code owner January 11, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for checksum verification of must-use plugins

2 participants