Changeset 3805758
- Timestamp:
- 11/16/2026 05:46:12 PM (18 hours ago)
- Location:
- cubewp-forms/trunk
- Files:
-
- 9 edited
-
cube/classes/class-cubewp-forms-custom.php (modified) (1 diff)
-
cube/classes/class-cubewp-forms-dashboard.php (modified) (4 diffs)
-
cube/classes/class-cubewp-forms-data-table.php (modified) (2 diffs)
-
cube/classes/class-cubewp-forms-leads.php (modified) (3 diffs)
-
cube/classes/class-cubewp-forms-rest-api.php (modified) (3 diffs)
-
cube/classes/class-cubewp-forms-table.php (modified) (1 diff)
-
cube/classes/class-cubewp-forms-ui.php (modified) (1 diff)
-
cubewp-forms.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cubewp-forms/trunk/cube/classes/class-cubewp-forms-custom.php
r3800555 r3805758 25 25 * @var string 26 26 */ 27 public static $CubeWp_Forms_version = '1.1.1 2';27 public static $CubeWp_Forms_version = '1.1.13'; 28 28 /** 29 29 * The single instance of the class. -
cubewp-forms/trunk/cube/classes/class-cubewp-forms-dashboard.php
r3800555 r3805758 50 50 $data[$leads['form_id']][$leadid]['dete_time'] = $leads['dete_time']; 51 51 } 52 $fields = unserialize($leads['fields']); 52 // Stored lead data is an array of scalars; refuse to instantiate objects. 53 $fields = unserialize($leads['fields'], array('allowed_classes' => false)); 53 54 foreach($fields as $key=> $lead){ 54 55 if(isset($form_fields[$key])){ … … 114 115 $form_name = $form_detail['form_name']; 115 116 $active_class = $keyind == 0 ? 'cwp-active-tab' : ''; 116 $output .= '<li class="cwp-author-' . $form_id . '-tab ' . $active_class. '">117 <a class="list-group-item" data-toggle="tab" href="#cwp-author-' . $form_id . '">' . $form_name. '</a>117 $output .= '<li class="cwp-author-' . esc_attr( $form_id ) . '-tab ' . esc_attr( $active_class ) . '"> 118 <a class="list-group-item" data-toggle="tab" href="#cwp-author-' . esc_attr( $form_id ) . '">' . esc_html( $form_name ) . '</a> 118 119 </li>'; 119 120 $keyind++; … … 139 140 $active_class = $keyind == 0 ? 'cwp-active-tab-content' : ''; 140 141 if (count($form_details) > 1) { 141 $output .= '<div class="cwp-tab-content ' . $active_class . '" id="cwp-author-' . $form_id. '">';142 $output .= '<div class="cwp-tab-content ' . esc_attr( $active_class ) . '" id="cwp-author-' . esc_attr( $form_id ) . '">'; 142 143 } 143 144 $output .= '<div class="cwp-dashboard-content-table-container"> … … 277 278 if (isset($form_data['fields']) && !empty($form_data['fields'])) { 278 279 $form_fields = CWP()->get_custom_fields('custom_forms'); 279 $fields = unserialize($form_data['fields']); 280 // Stored lead data is an array of scalars; refuse to instantiate objects. 281 $fields = unserialize($form_data['fields'], array('allowed_classes' => false)); 280 282 foreach ($fields as $key => $lead) { 281 283 $field_data = isset($form_fields[$key]) ? $form_fields[$key] : ''; -
cubewp-forms/trunk/cube/classes/class-cubewp-forms-data-table.php
r3420003 r3805758 104 104 protected function process_bulk_action() 105 105 { 106 // Deleting leads is an administrator action. 107 if (! current_user_can('manage_options')) { 108 return; 109 } 106 110 // Detect when a bulk action is being triggered. 107 111 if ('delete' === $this->current_action()) { 108 112 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 109 113 if (isset($_REQUEST['_wpnonce'])) { 110 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash 111 $nonce = sanitize_text_field($_REQUEST['_wpnonce']); 114 $nonce = sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])); 112 115 if (wp_verify_nonce($nonce, 'bulk-' . $this->_args['plural'])) { 113 116 if (isset($_REQUEST['cwp_group_bulk_action'])) { … … 122 125 } 123 126 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 124 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {125 // phpcs:ignore WordPress.Security.NonceVerification.Recommended , WordPress.Security.ValidatedSanitizedInput.MissingUnslash127 if (isset($_REQUEST['action']) && 'delete' === sanitize_text_field(wp_unslash($_REQUEST['action']))) { 128 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 126 129 if (isset($_REQUEST['_wpnonce'])) { 127 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash 128 $nonce = sanitize_text_field($_REQUEST['_wpnonce']); 129 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized 130 $nonce = sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])); 130 131 if (wp_verify_nonce($nonce, 'cwp_delete_group')) { 131 132 if (isset($_REQUEST['leadid'])) { 132 // phpcs:ignore WordPress.Security.NonceVerification.Recommended , WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash133 $leadid = $_REQUEST['leadid'];133 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 134 $leadid = sanitize_text_field(wp_unslash($_REQUEST['leadid'])); 134 135 cwp_remove_lead($leadid); 135 } 136 } 136 137 wp_safe_redirect(CubeWp_Submenu::_page_action('cubewp-custom-form-data')); 137 138 exit(); -
cubewp-forms/trunk/cube/classes/class-cubewp-forms-leads.php
r3420003 r3805758 156 156 if(isset($form_data['fields']) && !empty($form_data['fields'])){ 157 157 $output .= ' <table>'; 158 $fields = unserialize($form_data['fields']); 158 // Stored lead data is an array of scalars; refuse to instantiate objects. 159 $fields = unserialize($form_data['fields'], array('allowed_classes' => false)); 159 160 foreach($fields as $key=> $lead){ 160 161 $data = isset($form_fields[$key]) ? $form_fields[$key] : array(); … … 177 178 if($field_type == 'repeating_field'){ 178 179 $output .= '<tr> 179 <th>'. $data['label'].'</th>180 <th>'.esc_html(isset($data['label']) ? $data['label'] : '').'</th> 180 181 <td class="cwp-forms-repeating-fields">'; 181 182 foreach($repeater['label'] as $k => $label){ 182 183 if(isset($repeater['value'][$k]) && !empty($repeater['value'][$k])){ 183 184 $output .= '<div class="cwp-forms-repeating-field">'; 184 $output .= '<h6>'. $label.' </h6><p>'.$repeater['value'][$k].'</p>';185 $output .= '<h6>'.esc_html($label).' </h6><p>'.wp_kses_post($repeater['value'][$k]).'</p>'; 185 186 $output .= '</div>'; 186 187 } … … 191 192 $label = isset($data['label']) ? $data['label'] : ''; 192 193 $output .= ' <tr> 193 <th>'. $label.'</th>194 <td>'. $value.'</td>194 <th>'.esc_html($label).'</th> 195 <td>'.wp_kses_post($value).'</td> 195 196 </tr>'; 196 197 } -
cubewp-forms/trunk/cube/classes/class-cubewp-forms-rest-api.php
r3800555 r3805758 45 45 array( 46 46 array( 47 'methods' => WP_REST_Server::READABLE, 47 // Security (M2): CREATABLE, not READABLE. A GET that writes is 48 // reachable from an <img> tag and is cacheable. See 49 // cubewp_update_forms() for why the GET could be retired. 50 'methods' => WP_REST_Server::CREATABLE, 48 51 'callback' => array( $this, 'cubewp_update_forms' ), 49 52 'permission_callback' => array( $this, 'get_without_permission_check' ), … … 164 167 $CWP_QUERY = $request->get_param(self::CWP_QUERY); 165 168 166 if ( !empty($CWP_QUERY) && count($CWP_QUERY) > 0) {169 if (is_array($CWP_QUERY) && count($CWP_QUERY) > 0) { 167 170 /* 168 171 * The submission handler reads from $_POST, so the request data is … … 170 173 * restored immediately afterwards, leaving the superglobal unchanged 171 174 * for any later hook in the same request. 175 * 176 * Security (M2 closed): the route no longer MINTS the nonce it then 177 * checks, and it accepts POST only (see register_routes()). 178 * 179 * This line used to set security_nonce to a freshly created 180 * 'cubewp_forms_submit' nonce, so the form's CSRF check could never 181 * fail for anyone who called this route instead of the form. Now the 182 * caller's own security_nonce is passed through untouched, and 183 * cubewp_submit_custom_form() verifies it exactly as it does for the 184 * form's normal admin-ajax submission. A caller gets that nonce the 185 * same way the form does - from the rendered page - so a genuine 186 * integration keeps working and a blind script does not. 187 * 188 * Safe to change: the plugin's own front end submits through 189 * admin-ajax (custom-form-submit.js), never through this route; and 190 * on the CubeWP fleet (2026-11-16) no caller was recorded on any 191 * site, while 14 days of access logs held two scanner-shaped hits. 172 192 */ 173 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Superglobal is only snapshotted here so it can be restored below; the request itself is authorised by the REST permission callback.193 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Superglobal is only snapshotted here so it can be restored below; the nonce is verified by cubewp_submit_custom_form(). 174 194 $original_post = $_POST; 175 $CWP_QUERY['security_nonce'] = wp_create_nonce('cubewp_forms_submit');176 195 // Simulate the $_POST array with the received $CWP_QUERY data 177 196 $_POST = $CWP_QUERY; -
cubewp-forms/trunk/cube/classes/class-cubewp-forms-table.php
r3420003 r3805758 128 128 } 129 129 protected function process_bulk_action() { 130 // Deleting forms is an administrator action. 131 if ( ! current_user_can( 'manage_options' ) ) { 132 return; 133 } 130 134 // Detect when a bulk action is being triggered. 131 if ( 'delete' === $this->current_action() ) { 135 if ( 'delete' === $this->current_action() ) { 132 136 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 133 137 if ( isset( $_REQUEST['_wpnonce'] ) ) { -
cubewp-forms/trunk/cube/classes/class-cubewp-forms-ui.php
r3420003 r3805758 587 587 */ 588 588 protected static function save_group() { 589 // Building forms is an administrator action. 590 if ( ! current_user_can( 'manage_options' ) ) { 591 return; 592 } 589 593 // Verify nonce for form submission 590 594 if ( ! isset( $_POST['cwp_form_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cwp_form_nonce'] ) ), basename( __FILE__ ) ) ) { -
cubewp-forms/trunk/cubewp-forms.php
r3800555 r3805758 4 4 * Plugin URI: https://cubewp.com/ 5 5 * Description: LeadGen & Contact Form by CubeWP – Drag & Drop Form Builder for WordPress 6 * Version: 1.1.1 26 * Version: 1.1.13 7 7 * Author: CubeWP 8 8 * Author URI: https://CubeWp.com -
cubewp-forms/trunk/readme.txt
r3800555 r3805758 6 6 Requires PHP: 7.0 7 7 Tested up to: 7.1 8 Stable tag: 1.1.1 28 Stable tag: 1.1.13 9 9 License: GPLv2 or later 10 10 … … 254 254 == Changelog == 255 255 256 = 1.1.13 2026-11-16 257 258 SECURITY: Field labels and submitted values are now escaped on the admin Leads screen, on both the standard and the repeating field branches. 259 SECURITY: Form names and tab identifiers are now escaped on the frontend dashboard lead tabs. 260 SECURITY: Added capability checks to the lead delete, form delete and form builder save handlers, which previously verified only a nonce. 261 SECURITY: The form submission REST route now accepts POST only and verifies the submitted nonce instead of creating one, so the form's own security check also applies to API submissions. 262 SECURITY: Stored lead data can no longer instantiate PHP objects when it is read back. 263 256 264 = 1.1.12 2026-11-11 257 265
Note:
See TracChangeset
for help on using the changeset viewer.