Skip to content

WP/EnqueuedResourceParameters: remove eval() from is_falsy() - #2771

Merged
jrfnl merged 1 commit into
developfrom
security/enqueuedresourceparams-fix-is-falsy
Jul 27, 2026
Merged

WP/EnqueuedResourceParameters: remove eval() from is_falsy()#2771
jrfnl merged 1 commit into
developfrom
security/enqueuedresourceparams-fix-is-falsy

Conversation

@jrfnl

@jrfnl jrfnl commented Jul 27, 2026

Copy link
Copy Markdown
Member

Description

This PR is a fix for CVE-2026-45293 / GHSA-3pwp-g2mj-5p3v.

Replace the eval()-based logic with explicit token-level checks for a small set of literal falsy values:

  • Boolean false.
  • An integer or float equal to zero.
  • A text string with the content '0' or '' (single or double-quoted, heredoc, or nowdoc).
  • An empty array.

Other forms that the previous implementation recognised via eval() are no longer detected, such as a value wrapped in a type cast (e.g. (int) 0). Supporting them doesn't justify the risks of using eval().

This commit also clarifies test case comments as the previous version was inaccurate. "0, false or NULL" are not the only values that are not allowed. Also, NULL and missing $ver parameter generate a warning instead of an error.

Suggested changelog entry

  • SECURITY FIX: Running the WordPress.WP.EnqueuedResourceParameters sniff over untrusted PHP code, for example, in a CI pipeline that lints pull requests, or on a developer machine reviewing third-party code, could lead to arbitrary command execution on the scanning host. [#xx]
    This affects users of the WordPress and WordPress-Extra rulesets. The WordPress-Core ruleset and the WordPress-Docs ruleset are not affected.
    For more details, see the security advisory.

This PR is a fix for CVE-2026-45293 / [GHSA-3pwp-g2mj-5p3v](GHSA-3pwp-g2mj-5p3v).

Replace the eval()-based logic with explicit token-level checks for a
small set of literal falsy values:

- Boolean false.
- An integer or float equal to zero.
- A text string with the content `'0'` or `''` (single or double-quoted,
  heredoc, or nowdoc).
- An empty array.

Other forms that the previous implementation recognised via eval() are no
longer detected, such as a value wrapped in a type cast (e.g. `(int) 0`).
Supporting them doesn't justify the risks of using eval().

This commit also clarifies test case comments as the previous version was
inaccurate. "0, false or NULL" are not the only values that are not allowed.
Also, NULL and missing $ver parameter generate a warning instead of an error.
@jrfnl jrfnl added this to the 3.4.1 milestone Jul 27, 2026
@jrfnl
jrfnl merged commit a29048d into develop Jul 27, 2026
42 checks passed
@jrfnl
jrfnl deleted the security/enqueuedresourceparams-fix-is-falsy branch July 27, 2026 11:42
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.

2 participants