Repository navigation
fix/WPS-7849-vulnerability-issue-fix - #310
Open
Stuti-Cedcoss wants to merge 1 commit into
Open
Stuti-Cedcoss wants to merge 1 commit into
Stuti-Cedcoss wants to merge 1 commit into
Conversation
CVE-1 (REST API auth bypass): wps_sfw_validate_secretkey() now trims both values and rejects empty strings before hash_equals(), preventing whitespace- only consumer_secret from bypassing authentication. CVE-2 (CSRF + missing ownership on cancel): wps_sfw_cancel_susbcription() now calls wp_verify_nonce() and wps_sfw_current_user_can_view_subscription() before acting, blocking forged and cross-user cancellation requests. CVE-3 (membership restriction bypass via REST/feed): maybe_restrict_content() now falls through to the restriction message for redirect-behavior rules in REST API and feed contexts (where template_redirect never fires). maybe_filter_archive() now also excludes restricted posts from REST API collection queries (which are not the WP global main query). Tests: add CancelSubscriptionTest covering nonce and ownership cases; extend RestrictionEnforcerTest with redirect-in-REST, redirect-in-feed, and archive-filter-REST scenarios. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Task Link
WPS-7849
Summary
Fix three security vulnerabilities (REST API auth bypass, CSRF on cancel, membership restriction bypass via excerpt) plus a new Retry Renewal Payment admin order action. Version bumped to 2.0.3.
Changes Made
wps_sfw_validate_secretkey()— trim both keys, reject empty, usehash_equals()for constant-time comparisonwps_sfw_cancel_susbcription()— addedwp_verify_nonce()keyed to subscription ID + statusis_singular()guard frommaybe_restrict_content(); addedmaybe_restrict_excerpt()hooked tothe_excerptRestApiAuthTest.php(12 cases); 6 new/updated cases inRestrictionEnforcerTest.phpTesting
Screenshots / Demo (if applicable)
Checklist