Skip to content

Commit 924f5a4

Browse files
committed
SQL sanitization reviewed
1 parent c60d92c commit 924f5a4

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

core/Datastore/Meta_Datastore.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ protected function get_storage_array( Field $field, $storage_key_patterns ) {
2626

2727
$storage_key_comparisons = $this->key_toolset->storage_key_patterns_to_sql( '`meta_key`', $storage_key_patterns );
2828

29+
// @codingStandardsIgnoreStart sanitized in `storage_key_patterns_to_sql`
2930
$storage_array = $wpdb->get_results( '
3031
SELECT `meta_key` AS `key`, `meta_value` AS `value`
3132
FROM ' . $this->get_table_name() . '
3233
WHERE `' . $this->get_table_field_name() . '` = ' . intval( $this->get_object_id() ) . '
3334
AND ' . $storage_key_comparisons . '
3435
ORDER BY `meta_key` ASC
3536
' );
37+
// @codingStandardsIgnoreEnd
3638

3739
$storage_array = apply_filters( 'carbon_fields_datastore_storage_array', $storage_array, $this, $storage_key_patterns );
3840

core/Datastore/Theme_Options_Datastore.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ protected function get_storage_array( Field $field, $storage_key_patterns ) {
2626

2727
$storage_key_comparisons = $this->key_toolset->storage_key_patterns_to_sql( '`option_name`', $storage_key_patterns );
2828

29+
// @codingStandardsIgnoreStart sanitized in `storage_key_patterns_to_sql`
2930
$storage_array = $wpdb->get_results( '
3031
SELECT `option_name` AS `key`, `option_value` AS `value`
3132
FROM ' . $wpdb->options . '
3233
WHERE ' . $storage_key_comparisons . '
3334
ORDER BY `option_name` ASC
3435
' );
36+
// @codingStandardsIgnoreEnd
3537

3638
$storage_array = apply_filters( 'carbon_fields_datastore_storage_array', $storage_array, $this, $storage_key_patterns );
3739

core/Helper/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ public static function get_attachment_metadata( $id, $type ) {
625625
* @return array
626626
*/
627627
public static function input() {
628-
$input = ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) ? $_POST : $_GET;
628+
$input = ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) ? $_POST : $_GET; // CSRF ok. Nonce verfied elsewhere.
629629
$input = stripslashes_deep( $input );
630630

631631
if ( \Carbon_Fields\COMPACT_INPUT ) {

core/Service/Legacy_Storage_Service_v_1_5.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ protected function get_legacy_storage_array_from_database( Container $container,
231231
WHERE ' . $where_clause . '
232232
';
233233

234+
// @codingStandardsIgnoreStart sanitized above
234235
$raw_results = $wpdb->get_results( $query );
236+
// @codingStandardsIgnoreEnd
235237

236238
$results = array();
237239
foreach ( $raw_results as $result ) {

0 commit comments

Comments
 (0)