File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66> Relational condition rules’ element ID templates are now rendered in a sandboxed Twig environment, when ` enableTwigSandbox ` is enabled.
77
88- The ` create() ` Twig function now allows ` craft\helpers\ ` classes to be created. ([ #18376 ] ( https://github.com/craftcms/cms/discussions/18376 ) )
9+ - Added ` craft\helpers\ElementHelper::cleanseQueryCriteria() ` .
910- Fixed an error that could occur when editing an element with a Table field. ([ #18408 ] ( https://github.com/craftcms/cms/pull/18408 ) )
1011- Fixed a [ high-severity] ( https://github.com/craftcms/cms/security/policy#severity--remediation ) RCE vulnerability. (GHSA-fp5j -j7j4-mcxc)
1112
Original file line number Diff line number Diff line change @@ -605,20 +605,7 @@ protected function elementQuery(): ElementQueryInterface
605605 }
606606
607607 // Remove unsupported criteria attributes
608- unset(
609- $ criteria ['where ' ],
610- $ criteria ['orderBy ' ],
611- $ criteria ['indexBy ' ],
612- $ criteria ['select ' ],
613- $ criteria ['selectOption ' ],
614- $ criteria ['from ' ],
615- $ criteria ['groupBy ' ],
616- $ criteria ['join ' ],
617- $ criteria ['having ' ],
618- $ criteria ['union ' ],
619- $ criteria ['withQueries ' ],
620- $ criteria ['params ' ],
621- );
608+ ElementHelper::cleanseQueryCriteria ($ criteria );
622609
623610 Craft::configure ($ query , Component::cleanseConfig ($ criteria ));
624611 }
Original file line number Diff line number Diff line change @@ -840,4 +840,28 @@ public static function searchableAttributes(ElementInterface $element): array
840840 }
841841 return array_keys ($ searchableAttributes );
842842 }
843+
844+ /**
845+ * Removes values from a posted element query criteria, which would typically not be user-editable.
846+ *
847+ * @since 4.17.4
848+ */
849+ public static function cleanseQueryCriteria (array $ criteria ): array
850+ {
851+ unset(
852+ $ criteria ['where ' ],
853+ $ criteria ['orderBy ' ],
854+ $ criteria ['indexBy ' ],
855+ $ criteria ['select ' ],
856+ $ criteria ['selectOption ' ],
857+ $ criteria ['from ' ],
858+ $ criteria ['groupBy ' ],
859+ $ criteria ['join ' ],
860+ $ criteria ['having ' ],
861+ $ criteria ['union ' ],
862+ $ criteria ['withQueries ' ],
863+ $ criteria ['params ' ],
864+ );
865+ return $ criteria ;
866+ }
843867}
You can’t perform that action at this time.
0 commit comments