PluginProbe
wpForo Forum / 3.1.6
wpForo Forum v3.1.6
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
← All changes | classes/PostMeta.php +12 -8 3.1.03.1.6 View file →
@@ -533,11 +533,12 @@
533 533 if( ! empty( $topic['postmetas'] ) ) {
534 534 $fields_list = WPF()->post->get_topic_fields_list( false, $forum, ! WPF()->current_userid );
535 535 foreach( $topic['postmetas'] as $metakey => $metavalue ) {
536 536 if( in_array( $metakey, $fields_list ) ) {
537 - // Security: Only accept array values for file-type fields to prevent file path injection
537 + // Security: drop array values from single-value field types.
538 + $multi_value_types = apply_filters( 'wpforo_postmeta_array_field_types', [ 'file', 'checkbox', 'multiselect', 'tags', 'secondary_groups' ] );
538 539 $field = WPF()->post->get_field( $metakey, 'topic', $forum );
539 - if( is_array( $metavalue ) && wpfval( $field, 'type' ) !== 'file' ) continue;
540 + if( is_array( $metavalue ) && ! in_array( (string) wpfval( $field, 'type' ), $multi_value_types, true ) ) continue;
540 541 $postmeta = [
541 542 'postid' => $topic['first_postid'],
542 543 'metakey' => $metakey,
543 544 'metavalue' => $metavalue,
@@ -559,11 +560,12 @@
559 560 if( ! empty( $args['postmetas'] ) ) {
560 561 $fields_list = WPF()->post->get_topic_fields_list( false, $forum, ! WPF()->current_userid );
561 562 foreach( $args['postmetas'] as $metakey => $metavalue ) {
562 563 if( in_array( $metakey, $fields_list ) ) {
563 - // Security: Only accept array values for file-type fields to prevent file path injection
564 + // Security: drop array values from single-value field types.
565 + $multi_value_types = apply_filters( 'wpforo_postmeta_array_field_types', [ 'file', 'checkbox', 'multiselect', 'tags', 'secondary_groups' ] );
564 566 $field = WPF()->post->get_field( $metakey, 'topic', $forum );
565 - if( is_array( $metavalue ) && wpfval( $field, 'type' ) !== 'file' ) continue;
567 + if( is_array( $metavalue ) && ! in_array( (string) wpfval( $field, 'type' ), $multi_value_types, true ) ) continue;
566 568 $postmeta = [
567 569 'metavalue' => $metavalue,
568 570 'forumid' => $topic['forumid'],
569 571 'topicid' => $topic['topicid'],
@@ -592,11 +594,12 @@
592 594 if( ! empty( $post['postmetas'] ) ) {
593 595 $fields_list = WPF()->post->get_post_fields_list( false, $forum, ! WPF()->current_userid );
594 596 foreach( $post['postmetas'] as $metakey => $metavalue ) {
595 597 if( in_array( $metakey, $fields_list ) ) {
596 - // Security: Only accept array values for file-type fields to prevent file path injection
598 + // Security: drop array values from single-value field types.
599 + $multi_value_types = apply_filters( 'wpforo_postmeta_array_field_types', [ 'file', 'checkbox', 'multiselect', 'tags', 'secondary_groups' ] );
597 600 $field = WPF()->post->get_field( $metakey, 'post', $forum );
598 - if( is_array( $metavalue ) && wpfval( $field, 'type' ) !== 'file' ) continue;
601 + if( is_array( $metavalue ) && ! in_array( (string) wpfval( $field, 'type' ), $multi_value_types, true ) ) continue;
599 602 $postmeta = [
600 603 'postid' => $post['postid'],
601 604 'metakey' => $metakey,
602 605 'metavalue' => $metavalue,
@@ -618,11 +621,12 @@
618 621 if( ! empty( $args['postmetas'] ) ) {
619 622 $fields_list = WPF()->post->get_post_fields_list( false, $forum, ! WPF()->current_userid );
620 623 foreach( $args['postmetas'] as $metakey => $metavalue ) {
621 624 if( in_array( $metakey, $fields_list ) ) {
622 - // Security: Only accept array values for file-type fields to prevent file path injection
625 + // Security: drop array values from single-value field types.
626 + $multi_value_types = apply_filters( 'wpforo_postmeta_array_field_types', [ 'file', 'checkbox', 'multiselect', 'tags', 'secondary_groups' ] );
623 627 $field = WPF()->post->get_field( $metakey, 'post', $forum );
624 - if( is_array( $metavalue ) && wpfval( $field, 'type' ) !== 'file' ) continue;
628 + if( is_array( $metavalue ) && ! in_array( (string) wpfval( $field, 'type' ), $multi_value_types, true ) ) continue;
625 629 $postmeta = [
626 630 'metavalue' => $metavalue,
627 631 'forumid' => $post['forumid'],
628 632 'topicid' => $post['topicid'],