Skip to content

Reject invalid Requires at least header values - #392

Merged
swissspidy merged 2 commits into
mainfrom
fix/requires-at-least
Aug 4, 2026
Merged

Reject invalid Requires at least header values#392
swissspidy merged 2 commits into
mainfrom
fix/requires-at-least

Conversation

@swissspidy

@swissspidy swissspidy commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Improved plugin readme file parsing to handle different line ending formats (CRLF and EOF).
    • Added validation to ensure only valid WordPress version formats are accepted for plugin requirements.
  • Tests

    • Added test to verify malicious version specifications aren't injected into build configuration.

@swissspidy swissspidy added this to the 3.0.1 milestone Aug 4, 2026
@swissspidy
swissspidy requested a review from a team as a code owner August 4, 2026 15:44
Copilot AI lite review requested due to automatic review settings August 4, 2026 15:44
@swissspidy swissspidy added the command:scaffold Related to 'scaffold' command label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@swissspidy, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0eccaa29-cd9d-40f5-9994-7523da797cc5

📥 Commits

Reviewing files that changed from the base of the PR and between b00d094 and 1e89525.

📒 Files selected for processing (1)
  • features/scaffold-plugin-tests.feature
📝 Walkthrough

Walkthrough

Changes

Plugin version validation

Layer / File(s) Summary
Readme version validation and scaffold coverage
src/Scaffold_Command.php, features/scaffold-plugin-tests.feature
The scaffold command handles CRLF and EOF line endings and adds Requires at least only when it matches a valid WordPress version. The feature test rejects shell-like input and retains the latest test version.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding validation to reject invalid Requires at least header values in the scaffold plugin.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/requires-at-least

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens wp scaffold plugin-tests by parsing the plugin readme.txt “Requires at least” header more defensively so that only valid WordPress version strings are used when generating CI configs (reducing the chance of invalid or malicious values being propagated).

Changes:

  • Update Scaffold_Command::scaffold_plugin_theme_tests() to only add “Requires at least” to the CI test matrix when it matches an allowed version format.
  • Add a Behat scenario ensuring an invalid Requires at least line is ignored when generating CircleCI config.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Scaffold_Command.php Adds validation around parsing Requires at least so invalid values are ignored for the CI matrix.
features/scaffold-plugin-tests.feature Adds an acceptance test scenario covering invalid Requires at least values in readme.txt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +162 to +165
And the {PLUGIN_DIR}/.circleci/config.yml file should not contain:
"""
6.4; echo exploit #
"""
Comment thread features/scaffold-plugin-tests.feature Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy
swissspidy merged commit f031940 into main Aug 4, 2026
11 of 62 checks passed
@swissspidy
swissspidy deleted the fix/requires-at-least branch August 4, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:scaffold Related to 'scaffold' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants