PROD-10104 - #5033
Conversation
…et before assigning its role Fixes a privilege-escalation path (CWE-269) where a self-registering visitor could assign themselves any Profile Type — and its mapped WP role — by injecting the member-type xprofile field into the signup POST. The membertypes field's is_valid() accepted any post ID and nothing re-checked, at activation, whether the submitted type is actually offered on the registration form, so a Profile Type hidden from the registration dropdown but mapped to a privileged role (editor/admin) could be self-assigned. bp_assign_default_member_type_to_activate_user() now ignores a self-submitted Profile Type that is not offered at registration (bb_is_member_type_allowed_on_registration(): active member-type post whose _bp_member_type_enable_profile_field is unset or '1', mirroring the registration dropdown's own gate), falling back to the admin-configured default type. This is the single chokepoint the three registrant branches read, and it fires on bp_core_activated_user, so it covers both the web form and REST /signup. Admin-driven paths (send-invite type, default registration type) are unaffected. BP_XProfile_Field_Type_Member_Types::is_valid() additionally restricts the value to member-type posts (was: any post), rejecting an arbitrary post ID crafted into the field. Context-free, so profile edits that keep a member's currently-assigned type are unaffected.
…n the signup form Fixes a privilege-escalation path (CWE-269): a self-registering visitor could inject the member-type xprofile field into the signup POST and assign themselves any Profile Type — and its mapped WP role. The membertypes field's is_valid() accepted any post ID, and nothing checked that the submitted type is actually offered on the registration form, so a Profile Type hidden from the registration dropdown but mapped to a privileged role (editor/admin) could be self-assigned at activation. register.php now rejects, with a "Please select a valid profile type" error, a submitted member type that is not offered at registration (bb_is_member_type_allowed_on_registration(): active member-type post whose _bp_member_type_enable_profile_field is unset or '1', mirroring the registration dropdown's own gate). As a backstop, bp_assign_default_member_type_to_activate_user() ignores a not-offered self-submitted type at activation and falls back to the admin-configured default; this runs on bp_core_activated_user so it also covers REST signup. Admin-driven paths (send-invite type, default registration type) are unaffected. BP_XProfile_Field_Type_Member_Types::is_valid() additionally restricts the value to member-type posts (was: any post). Context-free, so profile edits that keep a member's currently-assigned type are unaffected.
Guards the self-submitted member-type value against an array-crafted field_<id> (e.g. field_85[]=x) before absint(), avoiding a PHP 8.1+ deprecation notice in bp_core_screen_signup(). Also updates the BP_XProfile_Field_Type_Member_Types::is_valid() docblock to note that registration eligibility is enforced at the register.php input check and, as a backstop, at bp_assign_default_member_type_to_activate_user().
|
@claude Please review PR |
|
Claude finished @jitendrabanjara1991's task in 2m 53s —— View job Claude finished reviewing this PRTodo list:
SummaryThis PR closes a mass-assignment / privilege-escalation vector: the registration form's Profile Type field is a hidden
I verified Findings1. REST signup endpoint doesn't get the same friendly validation (minor, not a security hole) 2. Minor 3. Pre-existing, not introduced by this PR Notes
|
Jira Issue:
https://buddyboss.atlassian.net/browse/PROD-10104
https://buddyboss.atlassian.net/browse/PROD-10328
General Note
Keep all conversations related to this PR in the associated Jira issue(s). Do NOT add comment on this PR or edit this PR’s description.
Notes to Developer
Notes to Reviewer