PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.5.4
JetFormBuilder — Dynamic Blocks Form Builder v3.5.4
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
← All changes | modules/validation/module.php +4 -61 trunk3.5.4 View file →
@@ -17,12 +17,9 @@
17 17 use JFB_Components\Module\Base_Module_It;
18 18 use JFB_Components\Module\Base_Module_Url_It;
19 19 use JFB_Components\Module\Base_Module_Url_Trait;
20 20 use JFB_Modules\Block_Parsers\Field_Data_Parser;
21 -use JFB_Modules\Validation\Advanced_Rules\Ssr_Callback_Allowlist;
22 21 use JFB_Modules\Validation\Class_Validation_Handlers;
23 -use JFB_Modules\Validation\Handlers\Validation_Handler;
24 -use JFB_Modules\Validation\Rest_Api\Rest_Validation_Endpoint;
25 22
26 23 // If this file is called directly, abort.
27 24 if ( ! defined( 'WPINC' ) ) {
28 25 die;
@@ -49,12 +46,8 @@
49 46 */
50 47 private $rules;
51 48 private $settings;
52 49 private $inline_messages = array();
53 - /**
54 - * @var Ssr_Callback_Allowlist
55 - */
56 - private $ssr_allowlist;
57 50
58 51 public function rep_item_id() {
59 52 return 'validation';
60 53 }
@@ -130,10 +123,8 @@
130 123 add_action(
131 124 'jet-form-builder/editor-assets/before',
132 125 array( $this, 'localize_editor_config' )
133 126 );
134 -
135 - $this->ssr_allowlist = new Ssr_Callback_Allowlist();
136 127 }
137 128
138 129 public function remove_hooks() {
139 130 remove_filter(
@@ -164,12 +155,8 @@
164 155 remove_action(
165 156 'jet-form-builder/editor-assets/before',
166 157 array( $this, 'localize_editor_config' )
167 158 );
168 -
169 - if ( $this->ssr_allowlist ) {
170 - $this->ssr_allowlist->remove_hooks();
171 - }
172 159 }
173 160
174 161 public function register_scripts() {
175 162 $script_asset = require_once jet_form_builder()->plugin_dir(
@@ -254,46 +241,8 @@
254 241
255 242 if ( ! empty( $rules ) ) {
256 243 $this->get_rules()->prepare_rules( $rules );
257 244
258 - // Security: Add signatures for SSR validation rules
259 - // For repeater fields, we include the repeater name in the signature
260 - // but NOT the row index (which is dynamic). The signature binds the
261 - // field to its structural path: [repeater_name, field_name] or just field_name
262 - $form_id = jet_fb_live()->form_id;
263 - $field_name = $block->block_attrs['name'] ?? '';
264 - $repeater_name = $block->get_repeater_name();
265 -
266 - // Build canonical path for signature (without row index)
267 - $signature_path = $repeater_name
268 - ? array( $repeater_name, $field_name )
269 - : $field_name;
270 -
271 - foreach ( $rules as $index => &$rule ) {
272 - if ( 'ssr' === ( $rule['type'] ?? '' ) ) {
273 - $signature = Rest_Validation_Endpoint::generate_signature(
274 - (int) $form_id,
275 - $signature_path,
276 - (int) $index
277 - );
278 - $signature_key = Validation_Handler::get_signature_key( $signature_path, (int) $index );
279 -
280 - printf(
281 - '<input type="hidden" name="%1$s[%2$s]" value="%3$s" />',
282 - esc_attr( Validation_Handler::MAIN_SIGNATURES_KEY ),
283 - esc_attr( $signature_key ),
284 - esc_attr( $signature )
285 - );
286 -
287 - // Security: only the lookup key is exposed here, never the signature
288 - // itself — the signature already lives in the hidden input above,
289 - // and JS reads it from there instead of duplicating it in this
290 - // public JSON blob (https://github.com/Crocoblock/issues-tracker/issues/20361).
291 - $rule['_sig_key'] = $signature_key;
292 - }
293 - }
294 - unset( $rule );
295 -
296 245 $block->add_attribute(
297 246 'data-validation-rules',
298 247 Tools::encode_json( $rules )
299 248 );
@@ -337,17 +286,11 @@
337 286
338 287 public function is_advanced( array $block_attrs ): bool {
339 288 $type = $block_attrs['validation']['type'] ?? '';
340 289
341 - if ( self::FORMAT_ADVANCED === $type ) {
342 - return true;
343 - }
344 -
345 - if ( '' === $type || 'inherit' === $type ) {
346 - return $this->is_advanced_form();
347 - }
348 -
349 - return false;
290 + return $type
291 + ? self::FORMAT_ADVANCED === $type
292 + : $this->is_advanced_form();
350 293 }
351 294
352 295 public function is_advanced_form(): bool {
353 296 if ( is_null( $this->settings ) ) {
@@ -374,9 +317,9 @@
374 317
375 318 public function validate_block( Field_Data_Parser $parser ) {
376 319 if (
377 320 ! $this->is_advanced( $parser->get_settings() ) ||
378 - Tools::is_empty( $parser->get_value() ) ||
321 + ! $parser->get_value() ||
379 322 $parser->is_inside_conditional()
380 323 ) {
381 324 return;
382 325 }