Slack: Stop unauthenticated requests from fataling the remaining webhook endpoints - #815
Closed
bor0 wants to merge 4 commits into
Closed
Slack: Stop unauthenticated requests from fataling the remaining webhook endpoints#815bor0 wants to merge 4 commits into
bor0 wants to merge 4 commits into
Conversation
…ook endpoints. hash_equals() requires string arguments in PHP 8. A request with an array-valued secret/token param (e.g. ?secret[]=x) bypassed the empty()/?? guards and fatally errored instead of being rejected, the same class of bug already fixed in announce.php and committers.php. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
security-team.php passes $_GET['token'] straight to hash_equals(), which fatals on a non-string in PHP 8. The dispatcher gates on the request URI containing '/security-team.php?token=', but '?token=a&token[]=x' satisfies that check while PHP overwrites the value with an array, so the endpoint still throws the same TypeError the rest of this branch fixes. Guard the token the way announce.php and committers.php do. This file only loads hyperdb, so the request is never slashed and the comparison stays on the raw value, with the WPCS unslash sniff annotated accordingly. Also split the inlined guard in trac-bot.php into the same shape, so all four webhook endpoints read alike. No behaviour change there. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The linter checks changed lines, and this file keeps its whole body flat inside a curly-brace namespace, so the scope sniff reads every line as one level short. That makes any edit inside the namespace fail regardless of what it does, which is what the guard added in the previous commit ran into. Give the file the header committers.php already carries: the reasons the scope, nonce and unslash sniffs do not apply to a standalone server-to-server endpoint, and a phpcs:disable for each. The inline unslash annotation is now redundant, so drop it. Reindenting all 93 lines would fix the scope sniff for real, but that belongs in its own change, not a crash fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
|
Extended it to the remaining file and adjusted the checks to be in line with the prior fixes. |
obenland
approved these changes
Aug 18, 2026
Member
|
Not sure what happened in #815 (comment) |
Member
This was referenced Aug 19, 2026
Member
Author
|
Thanks — reopened from my fork as #821. |
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.
Summary
#dotorg-alertsSlack channel reported repeatedE_ERROR: Uncaught TypeError: hash_equals(): Argument #2 ($user_string) must be of type stringfatals fromcommunity-deputies-calendly-webhook.phpandtrac-bot.php. Both pass$_GET['secret']/$_GET['token']straight tohash_equals(), which requires a string in PHP 8 — a request like?secret[]=xsends an array instead and fatals the endpoint rather than being rejected as invalid.security-team.phphas the same defect and is fixed here too. It did not show up in the alert batch because its dispatcher only runs when the request URI contains/security-team.php?token=, which filters out a bare?token[]=x. A request like?token=a&token[]=xsatisfies that substring check while PHP overwrites the value with an array, so the endpoint throws the sameTypeError.announce.php,committers.php, and thearray_combine()fatal inticket.phpreported in the same alert batch were already fixed by prior commits (announce.php/committers.php inffdecba27, ticket.php inc05f7c3b4); this PR closes out the remaining call sites using the same guard pattern.Notes
trac-bot.php,community-deputies-calendly-webhook.php) compare the value throughwp_unslash(), becausewp_magic_quotes()has already slashed$_GETby the time the guard runs.security-team.phponly loads hyperdb, so its request data is never slashed and the comparison stays on the raw value, with the WPCS unslash sniff annotated the waycommitters.phpdoes it.trac-bot.php's guard is split into a separate early return so all four webhook endpoints read alike. The calendly guard stays as a single condition, since splitting it would duplicate itsheader()+die()response in both branches.subgroup.phpwas checked and needs no change — its signature comes from$_SERVERheaders, which are always strings.Test plan
php -lon all changed files?token[]=x/?secret[]=x/?token=a&token[]=xrequests now return early instead of fataling in production🤖 Generated with Claude Code